2011-01-16 Oliver Hunt <[email protected]>
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 <[email protected]>
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):