Changeset 63566 in webkit for trunk/JavaScriptCore/parser/Lexer.h


Ignore:
Timestamp:
Jul 16, 2010, 11:32:42 AM (15 years ago)
Author:
[email protected]
Message:

2010-07-16 Oliver Hunt <[email protected]>

Reviewed by Geoffrey Garen.

ES5 allows use of reserved words as IdentifierName
https://bugs.webkit.org/show_bug.cgi?id=42471

Modify the lexer to allow us to avoid identifying reserved
words in those contexts where they are valid identifiers, and
we know it's safe. Additionally tag the reserved word tokens
so we can easily identify them in those cases where we can't
guarantee that we've skipped reserved word identification.

  • parser/JSParser.cpp: (JSC::JSParser::next): (JSC::JSParser::parseProperty): (JSC::JSParser::parseMemberExpression):
  • parser/JSParser.h: (JSC::):
  • parser/Lexer.cpp: (JSC::Lexer::lex):
  • parser/Lexer.h: (JSC::Lexer::):

2010-07-16 Oliver Hunt <[email protected]>

Reviewed by Geoffrey Garen.

ES5 allows use of reserved words as IdentifierName
https://bugs.webkit.org/show_bug.cgi?id=42471

Add tests to check for correct handling of reserved words with
the ES5 semantics.

  • fast/js/reserved-words-as-property-expected.txt: Added.
  • fast/js/reserved-words-as-property.html: Added.
  • fast/js/script-tests/reserved-words-as-property.js: Added. ():
  • fast/js/sputnik/Conformance/11_Expressions/11.1_Primary_Expressions/11.1.5_Object_Initializer/S11.1.5_A4.1-expected.txt:
  • fast/js/sputnik/Conformance/11_Expressions/11.1_Primary_Expressions/11.1.5_Object_Initializer/S11.1.5_A4.2-expected.txt: These tests are wrong, unsure how to get sputnik tests corrected.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/parser/Lexer.h

    r63273 r63566  
    5151
    5252        // Functions for the parser itself.
    53         JSTokenType lex(JSTokenData* lvalp, JSTokenInfo* llocp);
     53        enum LexType { IdentifyReservedWords, IgnoreReservedWords };
     54        JSTokenType lex(JSTokenData* lvalp, JSTokenInfo* llocp, LexType);
    5455        int lineNumber() const { return m_lineNumber; }
    5556        void setLastLineNumber(int lastLineNumber) { m_lastLineNumber = lastLineNumber; }
Note: See TracChangeset for help on using the changeset viewer.