Changeset 89109 in webkit
- Timestamp:
- Jun 16, 2011 8:17:11 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r89108 r89109 1 2011-06-16 Gavin Barraclough <barraclough@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 https://bugs.webkit.org/show_bug.cgi?id=53014 6 ES5 strict mode keyword restrictions aren't implemented 7 8 The following are future restricted words is strict mode code: 9 implements, interface, let, package, private, protected, public, static, yield 10 11 * fast/js/keywords-and-reserved_words-expected.txt: Added. 12 * fast/js/keywords-and-reserved_words.html: Added. 13 * fast/js/script-tests/keywords-and-reserved_words.js: Added. 14 (isKeyword): 15 (isStrictKeyword): 16 (classifyIdentifier): 17 1 18 2011-06-16 Yuta Kitamura <yutak@chromium.org> 2 19 -
trunk/Source/JavaScriptCore/ChangeLog
r89100 r89109 1 2011-06-16 Gavin Barraclough <barraclough@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 https://bugs.webkit.org/show_bug.cgi?id=53014 6 ES5 strict mode keyword restrictions aren't implemented 7 8 The following are future restricted words is strict mode code: 9 implements, interface, let, package, private, protected, public, static, yield 10 11 * parser/JSParser.h: 12 - Add RESERVED_IF_STRICT token. 13 * parser/Keywords.table: 14 - Add new future restricted words. 15 * parser/Lexer.cpp: 16 (JSC::Lexer::parseIdentifier): 17 - Check for RESERVED_IF_STRICT; in nonstrict code this is converted to IDENT. 18 (JSC::Lexer::lex): 19 - Pass strictMode flag to parseIdentifier. 20 * parser/Lexer.h: 21 - parseIdentifier needs a strictMode flag. 22 * runtime/CommonIdentifiers.h: 23 - Add identifiers for new reserved words. 24 1 25 2011-06-16 Gavin Barraclough <barraclough@apple.com> 2 26 -
trunk/Source/JavaScriptCore/parser/JSParser.h
r75408 r89109 67 67 WITH, 68 68 RESERVED, 69 RESERVED_IF_STRICT, 69 70 THROW, 70 71 TRY, -
trunk/Source/JavaScriptCore/parser/Keywords.table
r44224 r89109 1 1 # main keywords 2 @begin mainTable 4 12 @begin mainTable 47 3 3 4 4 # types … … 44 44 super RESERVED 45 45 46 # these words are reserved for future use in the ECMA spec, but not in WinIE 47 # (see http://bugs.webkit.org/show_bug.cgi?id=6179) 48 # abstract RESERVED 49 # boolean RESERVED 50 # byte RESERVED 51 # char RESERVED 52 # double RESERVED 53 # final RESERVED 54 # float RESERVED 55 # goto RESERVED 56 # implements RESERVED 57 # int RESERVED 58 # interface RESERVED 59 # long RESERVED 60 # native RESERVED 61 # package RESERVED 62 # private RESERVED 63 # protected RESERVED 64 # public RESERVED 65 # short RESERVED 66 # static RESERVED 67 # synchronized RESERVED 68 # throws RESERVED 69 # transient RESERVED 70 # volatile RESERVED 46 # reserved for future use in strict code 47 implements RESERVED_IF_STRICT 48 interface RESERVED_IF_STRICT 49 let RESERVED_IF_STRICT 50 package RESERVED_IF_STRICT 51 private RESERVED_IF_STRICT 52 protected RESERVED_IF_STRICT 53 public RESERVED_IF_STRICT 54 static RESERVED_IF_STRICT 55 yield RESERVED_IF_STRICT 56 71 57 @end 72 58 -
trunk/Source/JavaScriptCore/parser/Lexer.cpp
r89100 r89109 406 406 } 407 407 408 template <bool shouldCreateIdentifier> ALWAYS_INLINE JSTokenType Lexer::parseIdentifier(JSTokenData* tokenData, unsigned lexType )408 template <bool shouldCreateIdentifier> ALWAYS_INLINE JSTokenType Lexer::parseIdentifier(JSTokenData* tokenData, unsigned lexType, bool strictMode) 409 409 { 410 410 const ptrdiff_t remaining = m_codeEnd - m_code; 411 411 if ((remaining >= maxTokenLength) && !(lexType & IgnoreReservedWords)) { 412 412 JSTokenType keyword = parseKeyword<shouldCreateIdentifier>(tokenData); 413 if (keyword != IDENT ) {413 if (keyword != IDENT && (keyword != RESERVED_IF_STRICT || strictMode)) { 414 414 ASSERT((!shouldCreateIdentifier) || tokenData->ident); 415 415 return keyword; … … 470 470 const HashEntry* entry = m_keywordTable.entry(m_globalData, *ident); 471 471 ASSERT((remaining < maxTokenLength) || !entry); 472 return entry ? static_cast<JSTokenType>(entry->lexerValue()) : IDENT; 472 if (!entry) 473 return IDENT; 474 JSTokenType token = static_cast<JSTokenType>(entry->lexerValue()); 475 return (token != RESERVED_IF_STRICT) || strictMode ? token : IDENT; 473 476 } 474 477 return IDENT; … … 1083 1086 case CharacterBackSlash: 1084 1087 if (lexType & DontBuildKeywords) 1085 token = parseIdentifier<false>(tokenData, lexType );1088 token = parseIdentifier<false>(tokenData, lexType, strictMode); 1086 1089 else 1087 token = parseIdentifier<true>(tokenData, lexType );1090 token = parseIdentifier<true>(tokenData, lexType, strictMode); 1088 1091 break; 1089 1092 case CharacterLineTerminator: -
trunk/Source/JavaScriptCore/parser/Lexer.h
r88974 r89109 119 119 template <int shiftAmount, ShiftType shouldBoundsCheck> void internalShift(); 120 120 template <bool shouldCreateIdentifier> ALWAYS_INLINE JSTokenType parseKeyword(JSTokenData*); 121 template <bool shouldBuildIdentifiers> ALWAYS_INLINE JSTokenType parseIdentifier(JSTokenData*, unsigned );121 template <bool shouldBuildIdentifiers> ALWAYS_INLINE JSTokenType parseIdentifier(JSTokenData*, unsigned, bool strictMode); 122 122 template <bool shouldBuildStrings> ALWAYS_INLINE bool parseString(JSTokenData*, bool strictMode); 123 123 ALWAYS_INLINE void parseHex(double& returnValue); -
trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h
r88094 r89109 112 112 macro(extends) \ 113 113 macro(import) \ 114 macro(super) 114 macro(super) \ 115 macro(implements) \ 116 macro(interface) \ 117 macro(let) \ 118 macro(package) \ 119 macro(private) \ 120 macro(protected) \ 121 macro(public) \ 122 macro(static) \ 123 macro(yield) 115 124 116 125 namespace JSC {
Note: See TracChangeset
for help on using the changeset viewer.