Ignore:
Timestamp:
Jan 30, 2012, 3:59:20 PM (13 years ago)
Author:
[email protected]
Message:

Unexpected syntax error
https://bugs.webkit.org/show_bug.cgi?id=77340

Reviewed by Gavin Barraclough.

Source/JavaScriptCore:

Function calls and new expressions have the same semantics for
assignment, so should simply share their lhs handling.

  • parser/Parser.cpp:

(JSC::::parseMemberExpression):

LayoutTests:

Add new tests for correct parsing of new expressions

  • fast/js/parser-syntax-check-expected.txt:
  • fast/js/script-tests/parser-syntax-check.js:

(runTest):
(invalid):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/parser/Parser.cpp

    r105638 r106297  
    15131513        case OPENPAREN: {
    15141514            m_nonTrivialExpressionCount++;
     1515            int nonLHSCount = m_nonLHSCount;
    15151516            if (newCount) {
    15161517                newCount--;
    1517                 if (match(OPENPAREN)) {
    1518                     int exprEnd = lastTokenEnd();
    1519                     TreeArguments arguments = parseArguments(context);
    1520                     failIfFalse(arguments);
    1521                     base = context.createNewExpr(m_lexer->lastLineNumber(), base, arguments, start, exprEnd, lastTokenEnd());
    1522                 } else
    1523                     base = context.createNewExpr(m_lexer->lastLineNumber(), base, start, lastTokenEnd());               
     1518                int exprEnd = lastTokenEnd();
     1519                TreeArguments arguments = parseArguments(context);
     1520                failIfFalse(arguments);
     1521                base = context.createNewExpr(m_lexer->lastLineNumber(), base, arguments, start, exprEnd, lastTokenEnd());           
    15241522            } else {
    1525                 int nonLHSCount = m_nonLHSCount;
    15261523                int expressionEnd = lastTokenEnd();
    15271524                TreeArguments arguments = parseArguments(context);
    15281525                failIfFalse(arguments);
    15291526                base = context.makeFunctionCallNode(m_lexer->lastLineNumber(), base, arguments, expressionStart, expressionEnd, lastTokenEnd());
    1530                 m_nonLHSCount = nonLHSCount;
    15311527            }
     1528            m_nonLHSCount = nonLHSCount;
    15321529            break;
    15331530        }
Note: See TracChangeset for help on using the changeset viewer.