Skip to content
  • oliver@apple.com's avatar
    2011-01-16 Oliver Hunt <oliver@apple.com> · fc1b3f8f
    oliver@apple.com authored
            Reviewed by Geoffrey Garen.
    
            Strict mode restrictions on arguments and eval usage aren't complete
            https://bugs.webkit.org/show_bug.cgi?id=52528
    
            Add a helper function to aid parse failure tests by testing both direct
            eval/global code, and nested code (so that we test the syntax checker
            mode as well)
    
            * fast/js/basic-strict-mode-expected.txt:
            * fast/js/script-tests/basic-strict-mode.js:
            (shouldBeSyntaxError):
    2011-01-16  Oliver Hunt  <oliver@apple.com>
    
            Reviewed by Geoffrey Garen.
    
            Strict mode restrictions on arguments and eval usage aren't complete
            https://bugs.webkit.org/show_bug.cgi?id=52528
    
            Fix a few bugs in strict mode where we incorrect allow mutation of
            arguments and eval in the parser.
    
            Alas the "optimisation" used by the syntax checker for validating
            binary and unary expressions was too aggressive: we do actually need
            a stack for operations and operands although it needn't be as complete
            as that used for the full AST builder.
    
            Also disallow assignment to arguments in all cases as allowing arguments
            to be assignable is always an error in strict mode, regardless of context.
    
            * parser/ASTBuilder.h:
            (JSC::ASTBuilder::BinaryExprContext::BinaryExprContext):
            (JSC::ASTBuilder::UnaryExprContext::UnaryExprContext):
            * parser/JSParser.cpp:
            (JSC::JSParser::parseAssignmentExpression):
            (JSC::JSParser::parseBinaryExpression):
            (JSC::JSParser::parseUnaryExpression):
            * parser/SyntaxChecker.h:
            (JSC::SyntaxChecker::BinaryExprContext::BinaryExprContext):
            (JSC::SyntaxChecker::BinaryExprContext::~BinaryExprContext):
            (JSC::SyntaxChecker::UnaryExprContext::UnaryExprContext):
            (JSC::SyntaxChecker::UnaryExprContext::~UnaryExprContext):
            (JSC::SyntaxChecker::appendBinaryExpressionInfo):
            (JSC::SyntaxChecker::operatorStackPop):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75896 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    fc1b3f8f