Changeset 179159 in webkit for trunk/Source/JavaScriptCore


Ignore:
Timestamp:
Jan 26, 2015, 5:14:14 PM (10 years ago)
Author:
[email protected]
Message:

Parse a function expression as a primary expression
https://bugs.webkit.org/show_bug.cgi?id=140908

Reviewed by Mark Lam.

Moved the code to generate an AST node for a function expression from parseMemberExpression
to parsePrimaryExpression to match the ES6 specification terminology:
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-primary-expression

There should be no behavior change from this change since parsePrimaryExpression is only
called in parseMemberExpression other than the fact failIfStackOverflow() is called.

  • parser/Parser.cpp:

(JSC::Parser<LexerType>::parsePrimaryExpression):
(JSC::Parser<LexerType>::parseMemberExpression):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r179124 r179159  
     12015-01-26  Ryosuke Niwa  <[email protected]>
     2
     3        Parse a function expression as a primary expression
     4        https://bugs.webkit.org/show_bug.cgi?id=140908
     5
     6        Reviewed by Mark Lam.
     7
     8        Moved the code to generate an AST node for a function expression from parseMemberExpression
     9        to parsePrimaryExpression to match the ES6 specification terminology:
     10        https://people.mozilla.org/~jorendorff/es6-draft.html#sec-primary-expression
     11
     12        There should be no behavior change from this change since parsePrimaryExpression is only
     13        called in parseMemberExpression other than the fact failIfStackOverflow() is called.
     14
     15        * parser/Parser.cpp:
     16        (JSC::Parser<LexerType>::parsePrimaryExpression):
     17        (JSC::Parser<LexerType>::parseMemberExpression):
     18
    1192015-01-26  Myles C. Maxfield  <[email protected]>
    220
  • trunk/Source/JavaScriptCore/parser/Parser.cpp

    r178888 r179159  
    20282028    failIfStackOverflow();
    20292029    switch (m_token.m_type) {
     2030    case FUNCTION: {
     2031        JSTokenLocation location(tokenLocation());
     2032        unsigned functionKeywordStart = tokenStart();
     2033        next();
     2034        ParserFunctionInfo<TreeBuilder> info;
     2035        info.name = &m_vm->propertyNames->nullIdentifier;
     2036        failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, FunctionMode, false, info)), "Cannot parse function expression");
     2037        return context.createFunctionExpr(location, info, functionKeywordStart);
     2038    }
    20302039    case OPENBRACE:
    20312040        if (strictMode())
     
    21642173    }
    21652174
    2166     if (match(FUNCTION)) {
    2167         unsigned functionKeywordStart = tokenStart();
    2168         location = tokenLocation();
    2169         next();
    2170         ParserFunctionInfo<TreeBuilder> info;
    2171         info.name = &m_vm->propertyNames->nullIdentifier;
    2172         failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, FunctionMode, false, info)), "Cannot parse function expression");
    2173         base = context.createFunctionExpr(location, info, functionKeywordStart);
    2174     } else
    2175         base = parsePrimaryExpression(context);
     2175    base = parsePrimaryExpression(context);
    21762176   
    21772177    failIfFalse(base, "Cannot parse base expression");
Note: See TracChangeset for help on using the changeset viewer.