Reland "Reland "Let all early errors be SyntaxErrors.""

This is a reland of 89d93e3851

Original change's description:
> Reland "Let all early errors be SyntaxErrors."
> 
> This is a reland of 99fd5b9b9d which includes a missed update to
> test/test262/test262.status.
> 
> Implement the spec change from the following TC39 PR:
> https://github.com/tc39/ecma262/pull/1527
> 
> Bug: v8:9326
> Change-Id: Ie3aac60db550e90fb648fc30886a05419fa41afe
> TBR: adamk@chromium.org
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1682989
> Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#62500}

Bug: v8:9326
Change-Id: Ic30280400dfa5b83a4a397888e563eee479446c5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1688271
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Tamer Tas <tmrts@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62553}
This commit is contained in:
Ross Kirsling 2019-06-28 19:50:53 -07:00 committed by Commit Bot
parent e0e076c044
commit 7fc00d8aa6
27 changed files with 296 additions and 325 deletions

View File

@ -162,6 +162,7 @@ Rob Wu <rob@robwu.nl>
Robert Meijer <robert.s.meijer@gmail.com>
Robert Mustacchi <rm@fingolfin.org>
Robert Nagy <robert.nagy@gmail.com>
Ross Kirsling <rkirsling@gmail.com>
Ruben Bridgewater <ruben@bridgewater.de>
Ryan Dahl <ry@tinyclouds.org>
Sakthipriyan Vairamani (thefourtheye) <thechargingvolcano@gmail.com>

2
DEPS
View File

@ -177,7 +177,7 @@ deps = {
'v8/test/mozilla/data':
Var('chromium_url') + '/v8/deps/third_party/mozilla-tests.git' + '@' + 'f6c578a10ea707b1a8ab0b88943fe5115ce2b9be',
'v8/test/test262/data':
Var('chromium_url') + '/external/github.com/tc39/test262.git' + '@' + '49eee8bf9d69e3e137e9a196f6e0906a7c6a2cd4',
Var('chromium_url') + '/external/github.com/tc39/test262.git' + '@' + '079b004ac418db8ddcd9134d7cf36b0f5c4a6110',
'v8/test/test262/harness':
Var('chromium_url') + '/external/github.com/test262-utils/test262-harness-py.git' + '@' + '4555345a943d0c99a9461182705543fb171dda4b',
'v8/third_party/qemu-linux-x64': {

View File

@ -2469,8 +2469,7 @@ bool ClassScope::ResolvePrivateNames(ParseInfo* info) {
Scanner::Location loc = proxy->location();
info->pending_error_handler()->ReportMessageAt(
loc.beg_pos, loc.end_pos,
MessageTemplate::kInvalidPrivateFieldResolution, proxy->raw_name(),
kSyntaxError);
MessageTemplate::kInvalidPrivateFieldResolution, proxy->raw_name());
return false;
} else {
var->set_is_used();

View File

@ -1170,8 +1170,6 @@ enum MaybeAssignedFlag : uint8_t { kNotAssigned, kMaybeAssigned };
enum RequiresBrandCheckFlag : uint8_t { kNoBrandCheck, kRequiresBrandCheck };
enum ParseErrorType { kSyntaxError = 0, kReferenceError = 1 };
enum class InterpreterPushArgsMode : unsigned {
kArrayFunction,
kWithFinalSpread,

View File

@ -437,8 +437,7 @@ class ExpressionParsingScope : public ExpressionScope<Types> {
}
this->mark_verified();
return this->parser()->RewriteInvalidReferenceExpression(
expression, beg_pos, end_pos, MessageTemplate::kInvalidLhsInFor,
kSyntaxError);
expression, beg_pos, end_pos, MessageTemplate::kInvalidLhsInFor);
}
void RecordExpressionError(const Scanner::Location& loc,

View File

@ -785,7 +785,7 @@ class ParserBase {
if (scanner()->current_token() == Token::AWAIT && !is_async_function()) {
ReportMessageAt(scanner()->location(),
MessageTemplate::kAwaitNotInAsyncFunction, kSyntaxError);
MessageTemplate::kAwaitNotInAsyncFunction);
return;
}
@ -935,21 +935,19 @@ class ParserBase {
V8_NOINLINE void ReportMessage(MessageTemplate message) {
Scanner::Location source_location = scanner()->location();
impl()->ReportMessageAt(source_location, message,
static_cast<const char*>(nullptr), kSyntaxError);
static_cast<const char*>(nullptr));
}
template <typename T>
V8_NOINLINE void ReportMessage(MessageTemplate message, T arg,
ParseErrorType error_type = kSyntaxError) {
V8_NOINLINE void ReportMessage(MessageTemplate message, T arg) {
Scanner::Location source_location = scanner()->location();
impl()->ReportMessageAt(source_location, message, arg, error_type);
impl()->ReportMessageAt(source_location, message, arg);
}
V8_NOINLINE void ReportMessageAt(Scanner::Location location,
MessageTemplate message,
ParseErrorType error_type) {
MessageTemplate message) {
impl()->ReportMessageAt(location, message,
static_cast<const char*>(nullptr), error_type);
static_cast<const char*>(nullptr));
}
V8_NOINLINE void ReportUnexpectedToken(Token::Value token);
@ -1218,9 +1216,9 @@ class ParserBase {
// Checks if the expression is a valid reference expression (e.g., on the
// left-hand side of assignments). Although ruled out by ECMA as early errors,
// we allow calls for web compatibility and rewrite them to a runtime throw.
ExpressionT RewriteInvalidReferenceExpression(
ExpressionT expression, int beg_pos, int end_pos, MessageTemplate message,
ParseErrorType type = kReferenceError);
ExpressionT RewriteInvalidReferenceExpression(ExpressionT expression,
int beg_pos, int end_pos,
MessageTemplate message);
bool IsValidReferenceExpression(ExpressionT expression);
@ -1572,8 +1570,7 @@ ParserBase<Impl>::ParsePropertyOrPrivatePropertyName() {
if (class_scope == nullptr) {
impl()->ReportMessageAt(Scanner::Location(pos, pos + 1),
MessageTemplate::kInvalidPrivateFieldResolution,
impl()->GetRawNameFromIdentifier(name),
kSyntaxError);
impl()->GetRawNameFromIdentifier(name));
return impl()->FailureExpression();
}
key = impl()->ExpressionFromPrivateName(class_scope, name, pos);
@ -2661,13 +2658,11 @@ ParserBase<Impl>::ParseAssignmentExpressionCoverGrammar() {
impl()->ReportMessageAt(loc,
MessageTemplate::kInvalidDestructuringTarget);
} else {
// Reference Error if LHS is neither object literal nor an array literal
// Syntax Error if LHS is neither object literal nor an array literal
// (Parenthesized literals are
// CoverParenthesizedExpressionAndArrowParameterList).
// #sec-assignment-operators-static-semantics-early-errors
impl()->ReportMessageAt(loc, MessageTemplate::kInvalidLhsInAssignment,
static_cast<const char*>(nullptr),
kReferenceError);
impl()->ReportMessageAt(loc, MessageTemplate::kInvalidLhsInAssignment);
}
}
expression_scope()->ValidateAsPattern(expression, lhs_beg_pos,
@ -4306,7 +4301,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseClassLiteral(
impl()->ReportMessageAt(Scanner::Location(unresolvable->position(),
unresolvable->position() + 1),
MessageTemplate::kInvalidPrivateFieldResolution,
unresolvable->raw_name(), kSyntaxError);
unresolvable->raw_name());
return impl()->FailureExpression();
}
@ -4457,15 +4452,14 @@ template <typename Impl>
typename ParserBase<Impl>::ExpressionT
ParserBase<Impl>::RewriteInvalidReferenceExpression(ExpressionT expression,
int beg_pos, int end_pos,
MessageTemplate message,
ParseErrorType type) {
MessageTemplate message) {
DCHECK(!IsValidReferenceExpression(expression));
if (impl()->IsIdentifier(expression)) {
DCHECK(is_strict(language_mode()));
DCHECK(impl()->IsEvalOrArguments(impl()->AsIdentifier(expression)));
ReportMessageAt(Scanner::Location(beg_pos, end_pos),
MessageTemplate::kStrictEvalArguments, kSyntaxError);
MessageTemplate::kStrictEvalArguments);
return impl()->FailureExpression();
}
if (expression->IsCall() && !expression->AsCall()->is_tagged_template()) {
@ -4482,7 +4476,7 @@ ParserBase<Impl>::RewriteInvalidReferenceExpression(ExpressionT expression,
ExpressionT error = impl()->NewThrowReferenceError(message, beg_pos);
return factory()->NewProperty(expression, error, beg_pos);
}
ReportMessageAt(Scanner::Location(beg_pos, end_pos), message, type);
ReportMessageAt(Scanner::Location(beg_pos, end_pos), message);
return impl()->FailureExpression();
}
@ -4576,7 +4570,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseV8Intrinsic() {
if (has_spread) {
ReportMessageAt(Scanner::Location(pos, position()),
MessageTemplate::kIntrinsicWithSpread, kSyntaxError);
MessageTemplate::kIntrinsicWithSpread);
return impl()->FailureExpression();
}

View File

@ -696,11 +696,9 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
// Reporting errors.
void ReportMessageAt(Scanner::Location source_location,
MessageTemplate message, const char* arg = nullptr,
ParseErrorType error_type = kSyntaxError) {
pending_error_handler()->ReportMessageAt(source_location.beg_pos,
source_location.end_pos, message,
arg, error_type);
MessageTemplate message, const char* arg = nullptr) {
pending_error_handler()->ReportMessageAt(
source_location.beg_pos, source_location.end_pos, message, arg);
scanner_.set_parser_error();
}
@ -709,11 +707,9 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
V8_INLINE void ReportUnidentifiableError() { UNREACHABLE(); }
void ReportMessageAt(Scanner::Location source_location,
MessageTemplate message, const AstRawString* arg,
ParseErrorType error_type = kSyntaxError) {
pending_error_handler()->ReportMessageAt(source_location.beg_pos,
source_location.end_pos, message,
arg, error_type);
MessageTemplate message, const AstRawString* arg) {
pending_error_handler()->ReportMessageAt(
source_location.beg_pos, source_location.end_pos, message, arg);
scanner_.set_parser_error();
}

View File

@ -30,26 +30,26 @@ MessageLocation PendingCompilationErrorHandler::MessageDetails::GetLocation(
return MessageLocation(script, start_position_, end_position_);
}
void PendingCompilationErrorHandler::ReportMessageAt(
int start_position, int end_position, MessageTemplate message,
const char* arg, ParseErrorType error_type) {
void PendingCompilationErrorHandler::ReportMessageAt(int start_position,
int end_position,
MessageTemplate message,
const char* arg) {
if (has_pending_error_) return;
has_pending_error_ = true;
error_details_ =
MessageDetails(start_position, end_position, message, nullptr, arg);
error_type_ = error_type;
}
void PendingCompilationErrorHandler::ReportMessageAt(
int start_position, int end_position, MessageTemplate message,
const AstRawString* arg, ParseErrorType error_type) {
void PendingCompilationErrorHandler::ReportMessageAt(int start_position,
int end_position,
MessageTemplate message,
const AstRawString* arg) {
if (has_pending_error_) return;
has_pending_error_ = true;
error_details_ =
MessageDetails(start_position, end_position, message, arg, nullptr);
error_type_ = error_type;
}
void PendingCompilationErrorHandler::ReportWarningAt(int start_position,
@ -97,17 +97,8 @@ void PendingCompilationErrorHandler::ThrowPendingError(Isolate* isolate,
isolate->debug()->OnCompileError(script);
Factory* factory = isolate->factory();
Handle<Object> error;
switch (error_type_) {
case kReferenceError:
error = factory->NewReferenceError(error_details_.message(), argument);
break;
case kSyntaxError:
error = factory->NewSyntaxError(error_details_.message(), argument);
break;
default:
UNREACHABLE();
}
Handle<Object> error =
factory->NewSyntaxError(error_details_.message(), argument);
if (!error->IsJSObject()) {
isolate->Throw(*error, &location);

View File

@ -25,17 +25,13 @@ class Script;
class PendingCompilationErrorHandler {
public:
PendingCompilationErrorHandler()
: has_pending_error_(false),
stack_overflow_(false),
error_type_(kSyntaxError) {}
: has_pending_error_(false), stack_overflow_(false) {}
void ReportMessageAt(int start_position, int end_position,
MessageTemplate message, const char* arg = nullptr,
ParseErrorType error_type = kSyntaxError);
MessageTemplate message, const char* arg = nullptr);
void ReportMessageAt(int start_position, int end_position,
MessageTemplate message, const AstRawString* arg,
ParseErrorType error_type = kSyntaxError);
MessageTemplate message, const AstRawString* arg);
void ReportWarningAt(int start_position, int end_position,
MessageTemplate message, const char* arg = nullptr);
@ -110,7 +106,6 @@ class PendingCompilationErrorHandler {
bool unidentifiable_error_ = false;
MessageDetails error_details_;
ParseErrorType error_type_;
std::forward_list<MessageDetails> warning_messages_;

View File

@ -1483,11 +1483,9 @@ class PreParser : public ParserBase<PreParser> {
// Reporting errors.
void ReportMessageAt(Scanner::Location source_location,
MessageTemplate message, const char* arg = nullptr,
ParseErrorType error_type = kSyntaxError) {
pending_error_handler()->ReportMessageAt(source_location.beg_pos,
source_location.end_pos, message,
arg, error_type);
MessageTemplate message, const char* arg = nullptr) {
pending_error_handler()->ReportMessageAt(
source_location.beg_pos, source_location.end_pos, message, arg);
scanner()->set_parser_error();
}
@ -1498,17 +1496,14 @@ class PreParser : public ParserBase<PreParser> {
V8_INLINE void ReportMessageAt(Scanner::Location source_location,
MessageTemplate message,
const PreParserIdentifier& arg,
ParseErrorType error_type = kSyntaxError) {
const PreParserIdentifier& arg) {
UNREACHABLE();
}
void ReportMessageAt(Scanner::Location source_location,
MessageTemplate message, const AstRawString* arg,
ParseErrorType error_type = kSyntaxError) {
pending_error_handler()->ReportMessageAt(source_location.beg_pos,
source_location.end_pos, message,
arg, error_type);
MessageTemplate message, const AstRawString* arg) {
pending_error_handler()->ReportMessageAt(
source_location.beg_pos, source_location.end_pos, message, arg);
scanner()->set_parser_error();
}

View File

@ -1,4 +1,4 @@
*%(basename)s:5: ReferenceError: Invalid left-hand side in assignment
*%(basename)s:5: SyntaxError: Invalid left-hand side in assignment
function f() { new.target = 5 }
^^^^^^^^^^
ReferenceError: Invalid left-hand side in assignment
SyntaxError: Invalid left-hand side in assignment

View File

@ -1,4 +1,4 @@
*%(basename)s:5: ReferenceError: Invalid left-hand side expression in postfix operation
*%(basename)s:5: SyntaxError: Invalid left-hand side expression in postfix operation
function f() { new.target++ }
^^^^^^^^^^
ReferenceError: Invalid left-hand side expression in postfix operation
SyntaxError: Invalid left-hand side expression in postfix operation

View File

@ -1,4 +1,4 @@
*%(basename)s:5: ReferenceError: Invalid left-hand side expression in prefix operation
*%(basename)s:5: SyntaxError: Invalid left-hand side expression in prefix operation
function f() { ++new.target }
^^^^^^^^^^
ReferenceError: Invalid left-hand side expression in prefix operation
SyntaxError: Invalid left-hand side expression in prefix operation

View File

@ -401,13 +401,13 @@ function get_new_target() { return new.target; }
(function TestEarlyErrors() {
assertThrows(function() { Function("new.target = 42"); }, ReferenceError);
assertThrows(function() { Function("var foo = 1; new.target = foo = 42"); }, ReferenceError);
assertThrows(function() { Function("var foo = 1; foo = new.target = 42"); }, ReferenceError);
assertThrows(function() { Function("new.target--"); }, ReferenceError);
assertThrows(function() { Function("--new.target"); }, ReferenceError);
assertThrows(function() { Function("(new.target)++"); }, ReferenceError);
assertThrows(function() { Function("++(new.target)"); }, ReferenceError);
assertThrows(function() { Function("new.target = 42"); }, SyntaxError);
assertThrows(function() { Function("var foo = 1; new.target = foo = 42"); }, SyntaxError);
assertThrows(function() { Function("var foo = 1; foo = new.target = 42"); }, SyntaxError);
assertThrows(function() { Function("new.target--"); }, SyntaxError);
assertThrows(function() { Function("--new.target"); }, SyntaxError);
assertThrows(function() { Function("(new.target)++"); }, SyntaxError);
assertThrows(function() { Function("++(new.target)"); }, SyntaxError);
assertThrows(function() { Function("for (new.target of {});"); }, SyntaxError);
})();

View File

@ -725,20 +725,20 @@ var global = this;
(function testTaggedTemplateInvalidAssignmentTargetStrict() {
"use strict";
function f() {}
assertThrows(() => Function("++f`foo`"), ReferenceError);
assertThrows(() => Function("f`foo`++"), ReferenceError);
assertThrows(() => Function("--f`foo`"), ReferenceError);
assertThrows(() => Function("f`foo`--"), ReferenceError);
assertThrows(() => Function("f`foo` = 1"), ReferenceError);
assertThrows(() => Function("++f`foo`"), SyntaxError);
assertThrows(() => Function("f`foo`++"), SyntaxError);
assertThrows(() => Function("--f`foo`"), SyntaxError);
assertThrows(() => Function("f`foo`--"), SyntaxError);
assertThrows(() => Function("f`foo` = 1"), SyntaxError);
})();
(function testTaggedTemplateInvalidAssignmentTargetSloppy() {
function f() {}
assertThrows(() => Function("++f`foo`"), ReferenceError);
assertThrows(() => Function("f`foo`++"), ReferenceError);
assertThrows(() => Function("--f`foo`"), ReferenceError);
assertThrows(() => Function("f`foo`--"), ReferenceError);
assertThrows(() => Function("f`foo` = 1"), ReferenceError);
assertThrows(() => Function("++f`foo`"), SyntaxError);
assertThrows(() => Function("f`foo`++"), SyntaxError);
assertThrows(() => Function("--f`foo`"), SyntaxError);
assertThrows(() => Function("f`foo`--"), SyntaxError);
assertThrows(() => Function("f`foo` = 1"), SyntaxError);
})();
// Disable eval caching if a tagged template occurs in a nested function

View File

@ -264,13 +264,13 @@ function TestOverrideMathPow() {
TestOverrideMathPow();
function TestBadAssignmentLHS() {
assertThrows("if (false) { 17 **= 10; }", ReferenceError);
assertThrows("if (false) { '17' **= 10; }", ReferenceError);
assertThrows("if (false) { /17/ **= 10; }", ReferenceError);
assertThrows("if (false) { 17 **= 10; }", SyntaxError);
assertThrows("if (false) { '17' **= 10; }", SyntaxError);
assertThrows("if (false) { /17/ **= 10; }", SyntaxError);
assertThrows("if (false) { ({ valueOf() { return 17; } } **= 10); }",
ReferenceError);
// TODO(caitp): a Call expression as LHS should be an early ReferenceError!
// assertThrows("if (false) { Array() **= 10; }", ReferenceError);
SyntaxError);
// TODO(caitp): a Call expression as LHS should be an early SyntaxError!
// assertThrows("if (false) { Array() **= 10; }", SyntaxError);
assertThrows(() => Array() **= 10, ReferenceError);
}
TestBadAssignmentLHS();

View File

@ -29,23 +29,23 @@
// exceptions are delayed until runtime.
// Normal assignments:
assertThrows("12 = 12", ReferenceError);
assertThrows("x++ = 12", ReferenceError);
assertThrows("12 = 12", SyntaxError);
assertThrows("x++ = 12", SyntaxError);
assertThrows("eval('var x') = 12", ReferenceError);
assertThrows("if (false) 12 = 12", ReferenceError);
assertThrows("if (false) 12 = 12", SyntaxError);
assertDoesNotThrow("if (false) eval('var x') = 12");
// Pre- and post-fix operations:
assertThrows("12++", ReferenceError);
assertThrows("12--", ReferenceError);
assertThrows("++12", ReferenceError);
assertThrows("--12", ReferenceError);
assertThrows("12++", SyntaxError);
assertThrows("12--", SyntaxError);
assertThrows("++12", SyntaxError);
assertThrows("--12", SyntaxError);
assertThrows("++(eval('12'))", ReferenceError);
assertThrows("(eval('12'))++", ReferenceError);
assertThrows("if (false) 12++", ReferenceError);
assertThrows("if (false) 12--", ReferenceError);
assertThrows("if (false) ++12", ReferenceError);
assertThrows("if (false) --12", ReferenceError);
assertThrows("if (false) 12++", SyntaxError);
assertThrows("if (false) 12--", SyntaxError);
assertThrows("if (false) ++12", SyntaxError);
assertThrows("if (false) --12", SyntaxError);
assertDoesNotThrow("if (false) ++(eval('12'))");
assertDoesNotThrow("if (false) (eval('12'))++");
@ -56,19 +56,19 @@ assertThrows("if (false) for (12 in [1]) print(12);", SyntaxError);
assertDoesNotThrow("if (false) for (eval('0') in [1]) print(12);");
// For:
assertThrows("for (12 = 1;;) print(12);", ReferenceError);
assertThrows("for (12 = 1;;) print(12);", SyntaxError);
assertThrows("for (eval('var x') = 1;;) print(12);", ReferenceError);
assertThrows("if (false) for (12 = 1;;) print(12);", ReferenceError);
assertThrows("if (false) for (12 = 1;;) print(12);", SyntaxError);
assertDoesNotThrow("if (false) for (eval('var x') = 1;;) print(12);");
// Assignments to 'this'.
assertThrows("this = 42", ReferenceError);
assertThrows("function f() { this = 12; }", ReferenceError);
assertThrows("this = 42", SyntaxError);
assertThrows("function f() { this = 12; }", SyntaxError);
assertThrows("for (this in {x:3, y:4, z:5}) ;", SyntaxError);
assertThrows("for (this = 0;;) ;", ReferenceError);
assertThrows("this++", ReferenceError);
assertThrows("++this", ReferenceError);
assertThrows("this--", ReferenceError);
assertThrows("--this", ReferenceError);
assertThrows("if (false) this = 42", ReferenceError);
assertThrows("if (false) this++", ReferenceError);
assertThrows("for (this = 0;;) ;", SyntaxError);
assertThrows("this++", SyntaxError);
assertThrows("++this", SyntaxError);
assertThrows("this--", SyntaxError);
assertThrows("--this", SyntaxError);
assertThrows("if (false) this = 42", SyntaxError);
assertThrows("if (false) this++", SyntaxError);

View File

@ -7,7 +7,7 @@
// Parameters can't have parentheses (both patterns and identifiers)
assertThrows("( ({x: 1}) ) => {};", SyntaxError);
assertThrows("( (x) ) => {}", SyntaxError);
assertThrows("( ({x: 1}) = y ) => {}", ReferenceError);
assertThrows("( ({x: 1}) = y ) => {}", SyntaxError);
assertThrows("( (x) = y ) => {}", SyntaxError);
// Declarations can't have parentheses (both patterns and identifiers)
@ -21,8 +21,8 @@ assertThrows("var [({x: 1}) = y] = [];", SyntaxError);
assertThrows("var [(x) = y] = [];", SyntaxError);
// Patterns can't have parentheses in assignments either
assertThrows("[({x: 1}) = y] = [];", ReferenceError);
assertThrows("({a,b}) = {a:2,b:3}", ReferenceError);
assertThrows("[({x: 1}) = y] = [];", SyntaxError);
assertThrows("({a,b}) = {a:2,b:3}", SyntaxError);
// Parentheses are fine around identifiers in assignments though, even inside a
// pattern

View File

@ -2,4 +2,4 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
assertThrows("/*for..in*/for(var [x5, functional] = this = function(id) { return id } in false) var x2, x;", ReferenceError);
assertThrows("/*for..in*/for(var [x5, functional] = this = function(id) { return id } in false) var x2, x;", SyntaxError);

View File

@ -10,5 +10,5 @@ try {
f();
assertUnreachable();
} catch(e) {
assertTrue(e instanceof ReferenceError);
assertTrue(e instanceof SyntaxError);
}

View File

@ -901,23 +901,23 @@
'language/expressions/dynamic-import/reuse-namespace-object': [SKIP],
'language/expressions/dynamic-import/reuse-namespace-object-from-import': [SKIP],
'language/expressions/dynamic-import/reuse-namespace-object-from-script': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-10-lhs-assignment-operator-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-11-lhs-assignment-operator-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-12-lhs-assignment-operator-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-13-lhs-assignment-operator-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-14-lhs-assignment-operator-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-15-lhs-assignment-operator-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-16-lhs-assignment-operator-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-17-lhs-assignment-operator-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-1-update-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-2-update-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-3-update-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-4-update-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-5-lhs-equals-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-6-lhs-assignment-operator-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-7-lhs-assignment-operator-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-8-lhs-assignment-operator-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-9-lhs-assignment-operator-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-10-lhs-assignment-operator-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-11-lhs-assignment-operator-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-12-lhs-assignment-operator-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-13-lhs-assignment-operator-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-14-lhs-assignment-operator-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-15-lhs-assignment-operator-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-16-lhs-assignment-operator-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-17-lhs-assignment-operator-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-1-update-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-2-update-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-3-update-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-4-update-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-5-lhs-equals-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-6-lhs-assignment-operator-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-7-lhs-assignment-operator-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-8-lhs-assignment-operator-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-9-lhs-assignment-operator-assignment-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-assignment-expr-not-optional': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-no-new-call-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-no-rest-param': [SKIP],

View File

@ -153,22 +153,22 @@ PASS (function (){'use strict'; function f() { --arguments }}) threw exception S
PASS 'use strict'; function f() { arguments-- } threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){'use strict'; function f() { arguments-- }}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS global.eval('"use strict"; if (0) ++arguments; true;') threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS 'use strict'; ++(1, eval) threw exception ReferenceError: Invalid left-hand side expression in prefix operation.
PASS (function (){'use strict'; ++(1, eval)}) threw exception ReferenceError: Invalid left-hand side expression in prefix operation.
PASS 'use strict'; (1, eval)++ threw exception ReferenceError: Invalid left-hand side expression in postfix operation.
PASS (function (){'use strict'; (1, eval)++}) threw exception ReferenceError: Invalid left-hand side expression in postfix operation.
PASS 'use strict'; --(1, eval) threw exception ReferenceError: Invalid left-hand side expression in prefix operation.
PASS (function (){'use strict'; --(1, eval)}) threw exception ReferenceError: Invalid left-hand side expression in prefix operation.
PASS 'use strict'; (1, eval)-- threw exception ReferenceError: Invalid left-hand side expression in postfix operation.
PASS (function (){'use strict'; (1, eval)--}) threw exception ReferenceError: Invalid left-hand side expression in postfix operation.
PASS 'use strict'; function f() { ++(1, arguments) } threw exception ReferenceError: Invalid left-hand side expression in prefix operation.
PASS (function (){'use strict'; function f() { ++(1, arguments) }}) threw exception ReferenceError: Invalid left-hand side expression in prefix operation.
PASS 'use strict'; function f() { (1, arguments)++ } threw exception ReferenceError: Invalid left-hand side expression in postfix operation.
PASS (function (){'use strict'; function f() { (1, arguments)++ }}) threw exception ReferenceError: Invalid left-hand side expression in postfix operation.
PASS 'use strict'; function f() { --(1, arguments) } threw exception ReferenceError: Invalid left-hand side expression in prefix operation.
PASS (function (){'use strict'; function f() { --(1, arguments) }}) threw exception ReferenceError: Invalid left-hand side expression in prefix operation.
PASS 'use strict'; function f() { (1, arguments)-- } threw exception ReferenceError: Invalid left-hand side expression in postfix operation.
PASS (function (){'use strict'; function f() { (1, arguments)-- }}) threw exception ReferenceError: Invalid left-hand side expression in postfix operation.
PASS 'use strict'; ++(1, eval) threw exception SyntaxError: Invalid left-hand side expression in prefix operation.
PASS (function (){'use strict'; ++(1, eval)}) threw exception SyntaxError: Invalid left-hand side expression in prefix operation.
PASS 'use strict'; (1, eval)++ threw exception SyntaxError: Invalid left-hand side expression in postfix operation.
PASS (function (){'use strict'; (1, eval)++}) threw exception SyntaxError: Invalid left-hand side expression in postfix operation.
PASS 'use strict'; --(1, eval) threw exception SyntaxError: Invalid left-hand side expression in prefix operation.
PASS (function (){'use strict'; --(1, eval)}) threw exception SyntaxError: Invalid left-hand side expression in prefix operation.
PASS 'use strict'; (1, eval)-- threw exception SyntaxError: Invalid left-hand side expression in postfix operation.
PASS (function (){'use strict'; (1, eval)--}) threw exception SyntaxError: Invalid left-hand side expression in postfix operation.
PASS 'use strict'; function f() { ++(1, arguments) } threw exception SyntaxError: Invalid left-hand side expression in prefix operation.
PASS (function (){'use strict'; function f() { ++(1, arguments) }}) threw exception SyntaxError: Invalid left-hand side expression in prefix operation.
PASS 'use strict'; function f() { (1, arguments)++ } threw exception SyntaxError: Invalid left-hand side expression in postfix operation.
PASS (function (){'use strict'; function f() { (1, arguments)++ }}) threw exception SyntaxError: Invalid left-hand side expression in postfix operation.
PASS 'use strict'; function f() { --(1, arguments) } threw exception SyntaxError: Invalid left-hand side expression in prefix operation.
PASS (function (){'use strict'; function f() { --(1, arguments) }}) threw exception SyntaxError: Invalid left-hand side expression in prefix operation.
PASS 'use strict'; function f() { (1, arguments)-- } threw exception SyntaxError: Invalid left-hand side expression in postfix operation.
PASS (function (){'use strict'; function f() { (1, arguments)-- }}) threw exception SyntaxError: Invalid left-hand side expression in postfix operation.
FAIL 'use strict'; undefined; if (0) delete +a.b should throw an exception. Was undefined.
FAIL (function (){'use strict'; undefined; if (0) delete +a.b}) should throw an exception. Was function (){'use strict'; undefined; if (0) delete +a.b}.
FAIL 'use strict'; undefined; if (0) delete ++a.b should throw an exception. Was undefined.

View File

@ -234,145 +234,145 @@ PASS compileAndSerialize('a || b || c') is 'a || b || c'
PASS compileAndSerialize('(a || b) || c') is '(a || b) || c'
PASS compileAndSerialize('a || (b || c)') is 'a || (b || c)'
PASS compileAndSerialize('a = b = c') is 'a = b = c'
FAIL compileAndSerialize('(a = b) = c') should be (a = b) = c. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(a = b) = c') should be (a = b) = c. Threw exception SyntaxError: Invalid left-hand side in assignment
PASS compileAndSerialize('a = (b = c)') is 'a = (b = c)'
PASS compileAndSerialize('a = b + c') is 'a = b + c'
PASS compileAndSerialize('(a = b) + c') is '(a = b) + c'
PASS compileAndSerialize('a = (b + c)') is 'a = (b + c)'
PASS compileAndSerialize('a + b = c') threw exception ReferenceError: Invalid left-hand side in assignment.
FAIL compileAndSerialize('(a + b) = c') should be (a + b) = c. Threw exception ReferenceError: Invalid left-hand side in assignment
PASS compileAndSerialize('a + b = c') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(a + b) = c') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('a + (b = c)') is 'a + (b = c)'
PASS compileAndSerialize('a *= b *= c') is 'a *= b *= c'
FAIL compileAndSerialize('(a *= b) *= c') should be (a *= b) *= c. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(a *= b) *= c') should be (a *= b) *= c. Threw exception SyntaxError: Invalid left-hand side in assignment
PASS compileAndSerialize('a *= (b *= c)') is 'a *= (b *= c)'
PASS compileAndSerialize('a = b *= c') is 'a = b *= c'
FAIL compileAndSerialize('(a = b) *= c') should be (a = b) *= c. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(a = b) *= c') should be (a = b) *= c. Threw exception SyntaxError: Invalid left-hand side in assignment
PASS compileAndSerialize('a = (b *= c)') is 'a = (b *= c)'
PASS compileAndSerialize('a *= b + c') is 'a *= b + c'
PASS compileAndSerialize('(a *= b) + c') is '(a *= b) + c'
PASS compileAndSerialize('a *= (b + c)') is 'a *= (b + c)'
PASS compileAndSerialize('a + b *= c') threw exception ReferenceError: Invalid left-hand side in assignment.
FAIL compileAndSerialize('(a + b) *= c') should be (a + b) *= c. Threw exception ReferenceError: Invalid left-hand side in assignment
PASS compileAndSerialize('a + b *= c') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(a + b) *= c') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('a + (b *= c)') is 'a + (b *= c)'
PASS compileAndSerialize('a /= b /= c') is 'a /= b /= c'
FAIL compileAndSerialize('(a /= b) /= c') should be (a /= b) /= c. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(a /= b) /= c') should be (a /= b) /= c. Threw exception SyntaxError: Invalid left-hand side in assignment
PASS compileAndSerialize('a /= (b /= c)') is 'a /= (b /= c)'
PASS compileAndSerialize('a = b /= c') is 'a = b /= c'
FAIL compileAndSerialize('(a = b) /= c') should be (a = b) /= c. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(a = b) /= c') should be (a = b) /= c. Threw exception SyntaxError: Invalid left-hand side in assignment
PASS compileAndSerialize('a = (b /= c)') is 'a = (b /= c)'
PASS compileAndSerialize('a /= b + c') is 'a /= b + c'
PASS compileAndSerialize('(a /= b) + c') is '(a /= b) + c'
PASS compileAndSerialize('a /= (b + c)') is 'a /= (b + c)'
PASS compileAndSerialize('a + b /= c') threw exception ReferenceError: Invalid left-hand side in assignment.
FAIL compileAndSerialize('(a + b) /= c') should be (a + b) /= c. Threw exception ReferenceError: Invalid left-hand side in assignment
PASS compileAndSerialize('a + b /= c') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(a + b) /= c') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('a + (b /= c)') is 'a + (b /= c)'
PASS compileAndSerialize('a %= b %= c') is 'a %= b %= c'
FAIL compileAndSerialize('(a %= b) %= c') should be (a %= b) %= c. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(a %= b) %= c') should be (a %= b) %= c. Threw exception SyntaxError: Invalid left-hand side in assignment
PASS compileAndSerialize('a %= (b %= c)') is 'a %= (b %= c)'
PASS compileAndSerialize('a = b %= c') is 'a = b %= c'
FAIL compileAndSerialize('(a = b) %= c') should be (a = b) %= c. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(a = b) %= c') should be (a = b) %= c. Threw exception SyntaxError: Invalid left-hand side in assignment
PASS compileAndSerialize('a = (b %= c)') is 'a = (b %= c)'
PASS compileAndSerialize('a %= b + c') is 'a %= b + c'
PASS compileAndSerialize('(a %= b) + c') is '(a %= b) + c'
PASS compileAndSerialize('a %= (b + c)') is 'a %= (b + c)'
PASS compileAndSerialize('a + b %= c') threw exception ReferenceError: Invalid left-hand side in assignment.
FAIL compileAndSerialize('(a + b) %= c') should be (a + b) %= c. Threw exception ReferenceError: Invalid left-hand side in assignment
PASS compileAndSerialize('a + b %= c') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(a + b) %= c') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('a + (b %= c)') is 'a + (b %= c)'
PASS compileAndSerialize('a += b += c') is 'a += b += c'
FAIL compileAndSerialize('(a += b) += c') should be (a += b) += c. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(a += b) += c') should be (a += b) += c. Threw exception SyntaxError: Invalid left-hand side in assignment
PASS compileAndSerialize('a += (b += c)') is 'a += (b += c)'
PASS compileAndSerialize('a = b += c') is 'a = b += c'
FAIL compileAndSerialize('(a = b) += c') should be (a = b) += c. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(a = b) += c') should be (a = b) += c. Threw exception SyntaxError: Invalid left-hand side in assignment
PASS compileAndSerialize('a = (b += c)') is 'a = (b += c)'
PASS compileAndSerialize('a += b + c') is 'a += b + c'
PASS compileAndSerialize('(a += b) + c') is '(a += b) + c'
PASS compileAndSerialize('a += (b + c)') is 'a += (b + c)'
PASS compileAndSerialize('a + b += c') threw exception ReferenceError: Invalid left-hand side in assignment.
FAIL compileAndSerialize('(a + b) += c') should be (a + b) += c. Threw exception ReferenceError: Invalid left-hand side in assignment
PASS compileAndSerialize('a + b += c') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(a + b) += c') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('a + (b += c)') is 'a + (b += c)'
PASS compileAndSerialize('a -= b -= c') is 'a -= b -= c'
FAIL compileAndSerialize('(a -= b) -= c') should be (a -= b) -= c. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(a -= b) -= c') should be (a -= b) -= c. Threw exception SyntaxError: Invalid left-hand side in assignment
PASS compileAndSerialize('a -= (b -= c)') is 'a -= (b -= c)'
PASS compileAndSerialize('a = b -= c') is 'a = b -= c'
FAIL compileAndSerialize('(a = b) -= c') should be (a = b) -= c. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(a = b) -= c') should be (a = b) -= c. Threw exception SyntaxError: Invalid left-hand side in assignment
PASS compileAndSerialize('a = (b -= c)') is 'a = (b -= c)'
PASS compileAndSerialize('a -= b + c') is 'a -= b + c'
PASS compileAndSerialize('(a -= b) + c') is '(a -= b) + c'
PASS compileAndSerialize('a -= (b + c)') is 'a -= (b + c)'
PASS compileAndSerialize('a + b -= c') threw exception ReferenceError: Invalid left-hand side in assignment.
FAIL compileAndSerialize('(a + b) -= c') should be (a + b) -= c. Threw exception ReferenceError: Invalid left-hand side in assignment
PASS compileAndSerialize('a + b -= c') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(a + b) -= c') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('a + (b -= c)') is 'a + (b -= c)'
PASS compileAndSerialize('a <<= b <<= c') is 'a <<= b <<= c'
FAIL compileAndSerialize('(a <<= b) <<= c') should be (a <<= b) <<= c. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(a <<= b) <<= c') should be (a <<= b) <<= c. Threw exception SyntaxError: Invalid left-hand side in assignment
PASS compileAndSerialize('a <<= (b <<= c)') is 'a <<= (b <<= c)'
PASS compileAndSerialize('a = b <<= c') is 'a = b <<= c'
FAIL compileAndSerialize('(a = b) <<= c') should be (a = b) <<= c. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(a = b) <<= c') should be (a = b) <<= c. Threw exception SyntaxError: Invalid left-hand side in assignment
PASS compileAndSerialize('a = (b <<= c)') is 'a = (b <<= c)'
PASS compileAndSerialize('a <<= b + c') is 'a <<= b + c'
PASS compileAndSerialize('(a <<= b) + c') is '(a <<= b) + c'
PASS compileAndSerialize('a <<= (b + c)') is 'a <<= (b + c)'
PASS compileAndSerialize('a + b <<= c') threw exception ReferenceError: Invalid left-hand side in assignment.
FAIL compileAndSerialize('(a + b) <<= c') should be (a + b) <<= c. Threw exception ReferenceError: Invalid left-hand side in assignment
PASS compileAndSerialize('a + b <<= c') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(a + b) <<= c') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('a + (b <<= c)') is 'a + (b <<= c)'
PASS compileAndSerialize('a >>= b >>= c') is 'a >>= b >>= c'
FAIL compileAndSerialize('(a >>= b) >>= c') should be (a >>= b) >>= c. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(a >>= b) >>= c') should be (a >>= b) >>= c. Threw exception SyntaxError: Invalid left-hand side in assignment
PASS compileAndSerialize('a >>= (b >>= c)') is 'a >>= (b >>= c)'
PASS compileAndSerialize('a = b >>= c') is 'a = b >>= c'
FAIL compileAndSerialize('(a = b) >>= c') should be (a = b) >>= c. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(a = b) >>= c') should be (a = b) >>= c. Threw exception SyntaxError: Invalid left-hand side in assignment
PASS compileAndSerialize('a = (b >>= c)') is 'a = (b >>= c)'
PASS compileAndSerialize('a >>= b + c') is 'a >>= b + c'
PASS compileAndSerialize('(a >>= b) + c') is '(a >>= b) + c'
PASS compileAndSerialize('a >>= (b + c)') is 'a >>= (b + c)'
PASS compileAndSerialize('a + b >>= c') threw exception ReferenceError: Invalid left-hand side in assignment.
FAIL compileAndSerialize('(a + b) >>= c') should be (a + b) >>= c. Threw exception ReferenceError: Invalid left-hand side in assignment
PASS compileAndSerialize('a + b >>= c') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(a + b) >>= c') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('a + (b >>= c)') is 'a + (b >>= c)'
PASS compileAndSerialize('a >>>= b >>>= c') is 'a >>>= b >>>= c'
FAIL compileAndSerialize('(a >>>= b) >>>= c') should be (a >>>= b) >>>= c. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(a >>>= b) >>>= c') should be (a >>>= b) >>>= c. Threw exception SyntaxError: Invalid left-hand side in assignment
PASS compileAndSerialize('a >>>= (b >>>= c)') is 'a >>>= (b >>>= c)'
PASS compileAndSerialize('a = b >>>= c') is 'a = b >>>= c'
FAIL compileAndSerialize('(a = b) >>>= c') should be (a = b) >>>= c. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(a = b) >>>= c') should be (a = b) >>>= c. Threw exception SyntaxError: Invalid left-hand side in assignment
PASS compileAndSerialize('a = (b >>>= c)') is 'a = (b >>>= c)'
PASS compileAndSerialize('a >>>= b + c') is 'a >>>= b + c'
PASS compileAndSerialize('(a >>>= b) + c') is '(a >>>= b) + c'
PASS compileAndSerialize('a >>>= (b + c)') is 'a >>>= (b + c)'
PASS compileAndSerialize('a + b >>>= c') threw exception ReferenceError: Invalid left-hand side in assignment.
FAIL compileAndSerialize('(a + b) >>>= c') should be (a + b) >>>= c. Threw exception ReferenceError: Invalid left-hand side in assignment
PASS compileAndSerialize('a + b >>>= c') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(a + b) >>>= c') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('a + (b >>>= c)') is 'a + (b >>>= c)'
PASS compileAndSerialize('a &= b &= c') is 'a &= b &= c'
FAIL compileAndSerialize('(a &= b) &= c') should be (a &= b) &= c. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(a &= b) &= c') should be (a &= b) &= c. Threw exception SyntaxError: Invalid left-hand side in assignment
PASS compileAndSerialize('a &= (b &= c)') is 'a &= (b &= c)'
PASS compileAndSerialize('a = b &= c') is 'a = b &= c'
FAIL compileAndSerialize('(a = b) &= c') should be (a = b) &= c. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(a = b) &= c') should be (a = b) &= c. Threw exception SyntaxError: Invalid left-hand side in assignment
PASS compileAndSerialize('a = (b &= c)') is 'a = (b &= c)'
PASS compileAndSerialize('a &= b + c') is 'a &= b + c'
PASS compileAndSerialize('(a &= b) + c') is '(a &= b) + c'
PASS compileAndSerialize('a &= (b + c)') is 'a &= (b + c)'
PASS compileAndSerialize('a + b &= c') threw exception ReferenceError: Invalid left-hand side in assignment.
FAIL compileAndSerialize('(a + b) &= c') should be (a + b) &= c. Threw exception ReferenceError: Invalid left-hand side in assignment
PASS compileAndSerialize('a + b &= c') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(a + b) &= c') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('a + (b &= c)') is 'a + (b &= c)'
PASS compileAndSerialize('a ^= b ^= c') is 'a ^= b ^= c'
FAIL compileAndSerialize('(a ^= b) ^= c') should be (a ^= b) ^= c. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(a ^= b) ^= c') should be (a ^= b) ^= c. Threw exception SyntaxError: Invalid left-hand side in assignment
PASS compileAndSerialize('a ^= (b ^= c)') is 'a ^= (b ^= c)'
PASS compileAndSerialize('a = b ^= c') is 'a = b ^= c'
FAIL compileAndSerialize('(a = b) ^= c') should be (a = b) ^= c. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(a = b) ^= c') should be (a = b) ^= c. Threw exception SyntaxError: Invalid left-hand side in assignment
PASS compileAndSerialize('a = (b ^= c)') is 'a = (b ^= c)'
PASS compileAndSerialize('a ^= b + c') is 'a ^= b + c'
PASS compileAndSerialize('(a ^= b) + c') is '(a ^= b) + c'
PASS compileAndSerialize('a ^= (b + c)') is 'a ^= (b + c)'
PASS compileAndSerialize('a + b ^= c') threw exception ReferenceError: Invalid left-hand side in assignment.
FAIL compileAndSerialize('(a + b) ^= c') should be (a + b) ^= c. Threw exception ReferenceError: Invalid left-hand side in assignment
PASS compileAndSerialize('a + b ^= c') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(a + b) ^= c') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('a + (b ^= c)') is 'a + (b ^= c)'
PASS compileAndSerialize('a |= b |= c') is 'a |= b |= c'
FAIL compileAndSerialize('(a |= b) |= c') should be (a |= b) |= c. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(a |= b) |= c') should be (a |= b) |= c. Threw exception SyntaxError: Invalid left-hand side in assignment
PASS compileAndSerialize('a |= (b |= c)') is 'a |= (b |= c)'
PASS compileAndSerialize('a = b |= c') is 'a = b |= c'
FAIL compileAndSerialize('(a = b) |= c') should be (a = b) |= c. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(a = b) |= c') should be (a = b) |= c. Threw exception SyntaxError: Invalid left-hand side in assignment
PASS compileAndSerialize('a = (b |= c)') is 'a = (b |= c)'
PASS compileAndSerialize('a |= b + c') is 'a |= b + c'
PASS compileAndSerialize('(a |= b) + c') is '(a |= b) + c'
PASS compileAndSerialize('a |= (b + c)') is 'a |= (b + c)'
PASS compileAndSerialize('a + b |= c') threw exception ReferenceError: Invalid left-hand side in assignment.
FAIL compileAndSerialize('(a + b) |= c') should be (a + b) |= c. Threw exception ReferenceError: Invalid left-hand side in assignment
PASS compileAndSerialize('a + b |= c') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(a + b) |= c') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('a + (b |= c)') is 'a + (b |= c)'
PASS compileAndSerialize('delete a + b') is 'delete a + b'
PASS compileAndSerialize('(delete a) + b') is '(delete a) + b'
@ -391,12 +391,12 @@ PASS compileAndSerialize('!typeof a') is '!typeof a'
PASS compileAndSerialize('!(typeof a)') is '!(typeof a)'
PASS compileAndSerialize('++a + b') is '++a + b'
PASS compileAndSerialize('(++a) + b') is '(++a) + b'
FAIL compileAndSerialize('++(a + b)') should be ++(a + b). Threw exception ReferenceError: Invalid left-hand side expression in prefix operation
PASS compileAndSerialize('++(a + b)') threw exception SyntaxError: Invalid left-hand side expression in prefix operation.
PASS compileAndSerialize('!++a') is '!++a'
PASS compileAndSerialize('!(++a)') is '!(++a)'
PASS compileAndSerialize('--a + b') is '--a + b'
PASS compileAndSerialize('(--a) + b') is '(--a) + b'
FAIL compileAndSerialize('--(a + b)') should be --(a + b). Threw exception ReferenceError: Invalid left-hand side expression in prefix operation
PASS compileAndSerialize('--(a + b)') threw exception SyntaxError: Invalid left-hand side expression in prefix operation.
PASS compileAndSerialize('!--a') is '!--a'
PASS compileAndSerialize('!(--a)') is '!(--a)'
PASS compileAndSerialize('+ a + b') is '+ a + b'
@ -421,10 +421,10 @@ PASS compileAndSerialize('!!a') is '!!a'
PASS compileAndSerialize('!(!a)') is '!(!a)'
PASS compileAndSerialize('!a++') is '!a++'
PASS compileAndSerialize('!(a++)') is '!(a++)'
FAIL compileAndSerialize('(!a)++') should be (!a)++. Threw exception ReferenceError: Invalid left-hand side expression in postfix operation
PASS compileAndSerialize('(!a)++') threw exception SyntaxError: Invalid left-hand side expression in postfix operation.
PASS compileAndSerialize('!a--') is '!a--'
PASS compileAndSerialize('!(a--)') is '!(a--)'
FAIL compileAndSerialize('(!a)--') should be (!a)--. Threw exception ReferenceError: Invalid left-hand side expression in postfix operation
PASS compileAndSerialize('(!a)--') threw exception SyntaxError: Invalid left-hand side expression in postfix operation.
PASS compileAndSerialize('(-1)[a]') is '(-1)[a]'
PASS compileAndSerialize('(-1)[a] = b') is '(-1)[a] = b'
PASS compileAndSerialize('(-1)[a] += b') is '(-1)[a] += b'
@ -464,42 +464,42 @@ PASS compileAndSerialize('(1).a += b') is '(1).a += b'
PASS compileAndSerialize('(1).a++') is '(1).a++'
PASS compileAndSerialize('++(1).a') is '++(1).a'
PASS compileAndSerialize('(1).a()') is '(1).a()'
FAIL compileAndSerialize('(-1) = a') should be (-1) = a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(- 0) = a') should be (- 0) = a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('1 = a') should be 1 = a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(-1) *= a') should be (-1) *= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(- 0) *= a') should be (- 0) *= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('1 *= a') should be 1 *= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(-1) /= a') should be (-1) /= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(- 0) /= a') should be (- 0) /= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('1 /= a') should be 1 /= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(-1) %= a') should be (-1) %= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(- 0) %= a') should be (- 0) %= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('1 %= a') should be 1 %= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(-1) += a') should be (-1) += a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(- 0) += a') should be (- 0) += a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('1 += a') should be 1 += a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(-1) -= a') should be (-1) -= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(- 0) -= a') should be (- 0) -= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('1 -= a') should be 1 -= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(-1) <<= a') should be (-1) <<= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(- 0) <<= a') should be (- 0) <<= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('1 <<= a') should be 1 <<= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(-1) >>= a') should be (-1) >>= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(- 0) >>= a') should be (- 0) >>= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('1 >>= a') should be 1 >>= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(-1) >>>= a') should be (-1) >>>= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(- 0) >>>= a') should be (- 0) >>>= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('1 >>>= a') should be 1 >>>= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(-1) &= a') should be (-1) &= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(- 0) &= a') should be (- 0) &= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('1 &= a') should be 1 &= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(-1) ^= a') should be (-1) ^= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(- 0) ^= a') should be (- 0) ^= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('1 ^= a') should be 1 ^= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(-1) |= a') should be (-1) |= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('(- 0) |= a') should be (- 0) |= a. Threw exception ReferenceError: Invalid left-hand side in assignment
FAIL compileAndSerialize('1 |= a') should be 1 |= a. Threw exception ReferenceError: Invalid left-hand side in assignment
PASS compileAndSerialize('(-1) = a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(- 0) = a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('1 = a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(-1) *= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(- 0) *= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('1 *= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(-1) /= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(- 0) /= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('1 /= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(-1) %= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(- 0) %= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('1 %= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(-1) += a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(- 0) += a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('1 += a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(-1) -= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(- 0) -= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('1 -= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(-1) <<= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(- 0) <<= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('1 <<= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(-1) >>= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(- 0) >>= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('1 >>= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(-1) >>>= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(- 0) >>>= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('1 >>>= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(-1) &= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(- 0) &= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('1 &= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(-1) ^= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(- 0) ^= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('1 ^= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(-1) |= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('(- 0) |= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerialize('1 |= a') threw exception SyntaxError: Invalid left-hand side in assignment.
PASS compileAndSerializeLeftmostTest('({ }).x') is '({ }).x'
PASS compileAndSerializeLeftmostTest('x = { }') is 'x = { }'
PASS compileAndSerializeLeftmostTest('(function () { })()') is '(function () { })()'

View File

@ -127,7 +127,7 @@ for (i = 0; i < assignmentOperators.length; ++i) {
testRightAssociativeSame("=", op);
testLowerFirst(op, "+");
shouldThrow("compileAndSerialize('a + b " + op + " c')");
testKeepParentheses("(a + b) " + op + " c");
shouldThrow("compileAndSerialize('(a + b) " + op + " c')");
testKeepParentheses("a + (b " + op + " c)");
}
@ -138,7 +138,10 @@ for (i = 0; i < prefixOperators.length; ++i) {
var op = prefixOperators[i] + prefixOperatorSpace[i];
testKeepParentheses("" + op + "a + b");
testOptionalParentheses("(" + op + "a) + b");
testKeepParentheses("" + op + "(a + b)");
if (prefixOperators[i] !== "++" && prefixOperators[i] !== "--")
testKeepParentheses("" + op + "(a + b)");
else
shouldThrow("compileAndSerialize('" + op + "(a + b)')");
testKeepParentheses("!" + op + "a");
testOptionalParentheses("!(" + op + "a)");
}
@ -146,11 +149,11 @@ for (i = 0; i < prefixOperators.length; ++i) {
testKeepParentheses("!a++");
testOptionalParentheses("!(a++)");
testKeepParentheses("(!a)++");
shouldThrow("compileAndSerialize('(!a)++')");
testKeepParentheses("!a--");
testOptionalParentheses("!(a--)");
testKeepParentheses("(!a)--");
shouldThrow("compileAndSerialize('(!a)--')");
testKeepParentheses("(-1)[a]");
testKeepParentheses("(-1)[a] = b");
@ -205,9 +208,9 @@ testKeepParentheses("(1).a()");
for (i = 0; i < assignmentOperators.length; ++i) {
var op = assignmentOperators[i];
testKeepParentheses("(-1) " + op + " a");
testKeepParentheses("(- 0) " + op + " a");
testKeepParentheses("1 " + op + " a");
shouldThrow("compileAndSerialize('(-1) " + op + " a')");
shouldThrow("compileAndSerialize('(- 0) " + op + " a')");
shouldThrow("compileAndSerialize('1 " + op + " a')");
}
shouldBe("compileAndSerializeLeftmostTest('({ }).x')", "'({ }).x'");

View File

@ -47,32 +47,32 @@ PASS Invalid: "new -a"
PASS Invalid: "function f() { new -a }"
PASS Valid: "new (-1)"
PASS Valid: "function f() { new (-1) }"
PASS Valid: "a: b: c: new f(x++)++"
PASS Valid: "function f() { a: b: c: new f(x++)++ }"
PASS Invalid: "a: b: c: new f(x++)++"
PASS Invalid: "function f() { a: b: c: new f(x++)++ }"
PASS Valid: "(a)++"
PASS Valid: "function f() { (a)++ }"
PASS Valid: "(1--).x"
PASS Valid: "function f() { (1--).x }"
PASS Invalid: "(1--).x"
PASS Invalid: "function f() { (1--).x }"
PASS Invalid: "a-- ++"
PASS Invalid: "function f() { a-- ++ }"
PASS Invalid: "(a:) --b"
PASS Invalid: "function f() { (a:) --b }"
PASS Valid: "++ -- ++ a"
PASS Valid: "function f() { ++ -- ++ a }"
PASS Valid: "++ new new a ++"
PASS Valid: "function f() { ++ new new a ++ }"
PASS Invalid: "++ -- ++ a"
PASS Invalid: "function f() { ++ -- ++ a }"
PASS Invalid: "++ new new a ++"
PASS Invalid: "function f() { ++ new new a ++ }"
PASS Valid: "delete void 0"
PASS Valid: "function f() { delete void 0 }"
PASS Invalid: "delete the void"
PASS Invalid: "function f() { delete the void }"
PASS Invalid: "(a++"
PASS Invalid: "function f() { (a++ }"
PASS Valid: "++a--"
PASS Valid: "function f() { ++a-- }"
PASS Valid: "++((a))--"
PASS Valid: "function f() { ++((a))-- }"
PASS Valid: "(a.x++)++"
PASS Valid: "function f() { (a.x++)++ }"
PASS Invalid: "++a--"
PASS Invalid: "function f() { ++a-- }"
PASS Invalid: "++((a))--"
PASS Invalid: "function f() { ++((a))-- }"
PASS Invalid: "(a.x++)++"
PASS Invalid: "function f() { (a.x++)++ }"
PASS Invalid: "1: null"
PASS Invalid: "function f() { 1: null }"
PASS Invalid: "+-!~"
@ -114,18 +114,18 @@ PASS Invalid: "a in instanceof b.l"
PASS Invalid: "function f() { a in instanceof b.l }"
PASS Valid: "- - true % 5"
PASS Valid: "function f() { - - true % 5 }"
FAIL Invalid: "- false = 3" should throw undefined
FAIL Invalid: "function f() { - false = 3 }" should throw undefined
PASS Valid: "a: b: c: (1 + null) = 3"
PASS Valid: "function f() { a: b: c: (1 + null) = 3 }"
PASS Invalid: "- false = 3"
PASS Invalid: "function f() { - false = 3 }"
PASS Invalid: "a: b: c: (1 + null) = 3"
PASS Invalid: "function f() { a: b: c: (1 + null) = 3 }"
PASS Valid: "a[2] = b.l += c /= 4 * 7 ^ !6"
PASS Valid: "function f() { a[2] = b.l += c /= 4 * 7 ^ !6 }"
FAIL Invalid: "a + typeof b += c in d" should throw undefined
FAIL Invalid: "function f() { a + typeof b += c in d }" should throw undefined
FAIL Invalid: "typeof a &= typeof b" should throw undefined
FAIL Invalid: "function f() { typeof a &= typeof b }" should throw undefined
PASS Valid: "a: ((typeof (a))) >>>= a || b.l && c"
PASS Valid: "function f() { a: ((typeof (a))) >>>= a || b.l && c }"
PASS Invalid: "a + typeof b += c in d"
PASS Invalid: "function f() { a + typeof b += c in d }"
PASS Invalid: "typeof a &= typeof b"
PASS Invalid: "function f() { typeof a &= typeof b }"
PASS Invalid: "a: ((typeof (a))) >>>= a || b.l && c"
PASS Invalid: "function f() { a: ((typeof (a))) >>>= a || b.l && c }"
PASS Valid: "a: b: c[a /= f[a %= b]].l[c[x] = 7] -= a ? b <<= f : g"
PASS Valid: "function f() { a: b: c[a /= f[a %= b]].l[c[x] = 7] -= a ? b <<= f : g }"
PASS Valid: "-void+x['y'].l == x.l != 5 - f[7]"
@ -133,8 +133,8 @@ PASS Valid: "function f() { -void+x['y'].l == x.l != 5 - f[7] }"
Function calls (and new with arguments)
PASS Valid: "a()()()"
PASS Valid: "function f() { a()()() }"
PASS Valid: "s: l: a[2](4 == 6, 5 = 6)(f[4], 6)"
PASS Valid: "function f() { s: l: a[2](4 == 6, 5 = 6)(f[4], 6) }"
PASS Invalid: "s: l: a[2](4 == 6, 5 = 6)(f[4], 6)"
PASS Invalid: "function f() { s: l: a[2](4 == 6, 5 = 6)(f[4], 6) }"
PASS Valid: "s: eval(a.apply(), b.call(c[5] - f[7]))"
PASS Valid: "function f() { s: eval(a.apply(), b.call(c[5] - f[7])) }"
PASS Invalid: "a("
@ -143,8 +143,8 @@ PASS Invalid: "a(5"
PASS Invalid: "function f() { a(5 }"
PASS Invalid: "a(5,"
PASS Invalid: "function f() { a(5, }"
FAIL Invalid: "a(5,)" should throw undefined
FAIL Invalid: "function f() { a(5,) }" should throw undefined
PASS Valid: "a(5,)"
PASS Valid: "function f() { a(5,) }"
PASS Invalid: "a(5,6"
PASS Invalid: "function f() { a(5,6 }"
PASS Valid: "a(b[7], c <d> e.l, new a() > b)"
@ -178,8 +178,8 @@ PASS Invalid: "function () {}"
PASS Invalid: "function f() { function () {} }"
PASS Invalid: "function f(a b) {}"
PASS Invalid: "function f() { function f(a b) {} }"
FAIL Invalid: "function f(a,) {}" should throw undefined
FAIL Invalid: "function f() { function f(a,) {} }" should throw undefined
PASS Valid: "function f(a,) {}"
PASS Valid: "function f() { function f(a,) {} }"
PASS Invalid: "function f(a,"
PASS Invalid: "function f() { function f(a, }"
PASS Invalid: "function f(a, 1) {}"
@ -341,8 +341,8 @@ PASS Invalid: "var a = if (b) { c }"
PASS Invalid: "function f() { var a = if (b) { c } }"
PASS Invalid: "var a = var b"
PASS Invalid: "function f() { var a = var b }"
FAIL Valid: "const a = b += c, a, a, a = (b - f())" should NOT throw
FAIL Valid: "function f() { const a = b += c, a, a, a = (b - f()) }" should NOT throw
PASS Invalid: "const a = b += c, a, a, a = (b - f())"
PASS Invalid: "function f() { const a = b += c, a, a, a = (b - f()) }"
PASS Invalid: "var a %= b | 5"
PASS Invalid: "function f() { var a %= b | 5 }"
PASS Invalid: "var (a) = 5"
@ -355,10 +355,10 @@ PASS Invalid: "var var = 3"
PASS Invalid: "function f() { var var = 3 }"
PASS Valid: "var varr = 3 in 1"
PASS Valid: "function f() { var varr = 3 in 1 }"
FAIL Valid: "const a, a, a = void 7 - typeof 8, a = 8" should NOT throw
FAIL Valid: "function f() { const a, a, a = void 7 - typeof 8, a = 8 }" should NOT throw
PASS Valid: "const x_x = 6 /= 7 ? e : f"
PASS Valid: "function f() { const x_x = 6 /= 7 ? e : f }"
PASS Invalid: "const a, a, a = void 7 - typeof 8, a = 8"
PASS Invalid: "function f() { const a, a, a = void 7 - typeof 8, a = 8 }"
PASS Invalid: "const x_x = 6 /= 7 ? e : f"
PASS Invalid: "function f() { const x_x = 6 /= 7 ? e : f }"
PASS Invalid: "var a = ?"
PASS Invalid: "function f() { var a = ? }"
PASS Invalid: "const a = *7"
@ -452,8 +452,8 @@ PASS Invalid: "for ((a ? b : c) in c) break"
PASS Invalid: "function f() { for ((a ? b : c) in c) break }"
PASS Valid: "for (var a in b in c) break"
PASS Valid: "function f() { for (var a in b in c) break }"
PASS Valid: "for (var a = 5 += 6 in b) break"
PASS Valid: "function f() { for (var a = 5 += 6 in b) break }"
PASS Invalid: "for (var a = 5 += 6 in b) break"
PASS Invalid: "function f() { for (var a = 5 += 6 in b) break }"
PASS Invalid: "for (var a += 5 in b) break"
PASS Invalid: "function f() { for (var a += 5 in b) break }"
PASS Invalid: "for (var a = in b) break"
@ -470,8 +470,8 @@ PASS Invalid: "for (var a = (b in c in d) break"
PASS Invalid: "function f() { for (var a = (b in c in d) break }"
PASS Invalid: "for (var (a) in b) { }"
PASS Invalid: "function f() { for (var (a) in b) { } }"
PASS Valid: "for (var a = 7, b = c < d >= d ; f()[6]++ ; --i()[1]++ ) {}"
PASS Valid: "function f() { for (var a = 7, b = c < d >= d ; f()[6]++ ; --i()[1]++ ) {} }"
PASS Invalid: "for (var a = 7, b = c < d >= d ; f()[6]++ ; --i()[1]++ ) {}"
PASS Invalid: "function f() { for (var a = 7, b = c < d >= d ; f()[6]++ ; --i()[1]++ ) {} }"
try statement
PASS Valid: "try {} finally { c++ }"
PASS Valid: "function f() { try {} finally { c++ } }"
@ -582,8 +582,8 @@ PASS Valid: "if (0) obj.foo\u03bb; "
PASS Valid: "function f() { if (0) obj.foo\u03bb; }"
PASS Valid: "if (0) new a(b+c).d = 5"
PASS Valid: "function f() { if (0) new a(b+c).d = 5 }"
PASS Valid: "if (0) new a(b+c) = 5"
PASS Valid: "function f() { if (0) new a(b+c) = 5 }"
PASS Invalid: "if (0) new a(b+c) = 5"
PASS Invalid: "function f() { if (0) new a(b+c) = 5 }"
PASS Valid: "([1 || 1].a = 1)"
PASS Valid: "function f() { ([1 || 1].a = 1) }"
PASS Valid: "({a: 1 || 1}.a = 1)"

View File

@ -85,19 +85,19 @@ invalid("a.'l'");
valid ("a: +~!new a");
invalid("new -a");
valid ("new (-1)")
valid ("a: b: c: new f(x++)++")
invalid("a: b: c: new f(x++)++")
valid ("(a)++");
valid ("(1--).x");
invalid("(1--).x");
invalid("a-- ++");
invalid("(a:) --b");
valid ("++ -- ++ a");
valid ("++ new new a ++");
invalid("++ -- ++ a");
invalid("++ new new a ++");
valid ("delete void 0");
invalid("delete the void");
invalid("(a++");
valid ("++a--");
valid ("++((a))--");
valid ("(a.x++)++");
invalid("++a--");
invalid("++((a))--");
invalid("(a.x++)++");
invalid("1: null");
invalid("+-!~");
invalid("+-!~((");
@ -122,23 +122,23 @@ valid ("a in b instanceof delete -c");
invalid("a in instanceof b.l");
valid ("- - true % 5");
invalid("- false = 3");
valid ("a: b: c: (1 + null) = 3");
invalid("a: b: c: (1 + null) = 3");
valid ("a[2] = b.l += c /= 4 * 7 ^ !6");
invalid("a + typeof b += c in d");
invalid("typeof a &= typeof b");
valid ("a: ((typeof (a))) >>>= a || b.l && c");
invalid("a: ((typeof (a))) >>>= a || b.l && c");
valid ("a: b: c[a /= f[a %= b]].l[c[x] = 7] -= a ? b <<= f : g");
valid ("-void+x['y'].l == x.l != 5 - f[7]");
debug ("Function calls (and new with arguments)");
valid ("a()()()");
valid ("s: l: a[2](4 == 6, 5 = 6)(f[4], 6)");
invalid("s: l: a[2](4 == 6, 5 = 6)(f[4], 6)");
valid ("s: eval(a.apply(), b.call(c[5] - f[7]))");
invalid("a(");
invalid("a(5");
invalid("a(5,");
invalid("a(5,)");
valid("a(5,)");
invalid("a(5,6");
valid ("a(b[7], c <d> e.l, new a() > b)");
invalid("a(b[5)");
@ -158,7 +158,7 @@ valid ("function f() {}");
valid ("function f(a,b) {}");
invalid("function () {}");
invalid("function f(a b) {}");
invalid("function f(a,) {}");
valid("function f(a,) {}");
invalid("function f(a,");
invalid("function f(a, 1) {}");
valid ("function g(arguments, eval) {}");
@ -248,15 +248,15 @@ invalid("var 5 = 6");
valid ("while (0) var a, b, c=6, d, e, f=5*6, g=f*h, h");
invalid("var a = if (b) { c }");
invalid("var a = var b");
valid ("const a = b += c, a, a, a = (b - f())");
invalid("const a = b += c, a, a, a = (b - f())");
invalid("var a %= b | 5");
invalid("var (a) = 5");
invalid("var a = (4, b = 6");
invalid("const 'l' = 3");
invalid("var var = 3");
valid ("var varr = 3 in 1");
valid ("const a, a, a = void 7 - typeof 8, a = 8");
valid ("const x_x = 6 /= 7 ? e : f");
invalid("const a, a, a = void 7 - typeof 8, a = 8");
invalid("const x_x = 6 /= 7 ? e : f");
invalid("var a = ?");
invalid("const a = *7");
invalid("var a = :)");
@ -306,7 +306,7 @@ invalid("for ((a, b) in c) break");
invalid("for (a ? b : c in c) break");
invalid("for ((a ? b : c) in c) break");
valid ("for (var a in b in c) break");
valid ("for (var a = 5 += 6 in b) break");
invalid("for (var a = 5 += 6 in b) break");
invalid("for (var a += 5 in b) break");
invalid("for (var a = in b) break");
invalid("for (var a, b in b) break");
@ -315,7 +315,7 @@ invalid("for (var a, b = 8 in b) break");
valid ("for (var a = (b in c) in d) break");
invalid("for (var a = (b in c in d) break");
invalid("for (var (a) in b) { }");
valid ("for (var a = 7, b = c < d >= d ; f()[6]++ ; --i()[1]++ ) {}");
invalid("for (var a = 7, b = c < d >= d ; f()[6]++ ; --i()[1]++ ) {}");
debug ("try statement");
@ -379,7 +379,7 @@ valid("if (0) obj.foo$; ")
valid("if (0) obj.foo_; ")
valid("if (0) obj.foo\\u03bb; ")
valid("if (0) new a(b+c).d = 5");
valid("if (0) new a(b+c) = 5");
invalid("if (0) new a(b+c) = 5");
valid("([1 || 1].a = 1)");
valid("({a: 1 || 1}.a = 1)");

View File

@ -26,9 +26,9 @@ Test to ensure correct handling of --> as a single line comment when at the begi
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS 'should be a syntax error' --> threw exception ReferenceError: Invalid left-hand side expression in postfix operation.
PASS /**/ 1 --> threw exception ReferenceError: Invalid left-hand side expression in postfix operation.
PASS 1 /**/ --> threw exception ReferenceError: Invalid left-hand side expression in postfix operation.
PASS 'should be a syntax error' --> threw exception SyntaxError: Invalid left-hand side expression in postfix operation.
PASS /**/ 1 --> threw exception SyntaxError: Invalid left-hand side expression in postfix operation.
PASS 1 /**/ --> threw exception SyntaxError: Invalid left-hand side expression in postfix operation.
PASS 1/*
*/--> is 1
PASS --> is undefined.