Commit 7fc00d8a authored by Ross Kirsling's avatar Ross Kirsling Committed by Commit Bot

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

This is a reland of 89d93e38

Original change's description:
> Reland "Let all early errors be SyntaxErrors."
> 
> This is a reland of 99fd5b9b 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/+/1688271Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarTamer Tas <tmrts@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62553}
parent e0e076c0
...@@ -162,6 +162,7 @@ Rob Wu <rob@robwu.nl> ...@@ -162,6 +162,7 @@ Rob Wu <rob@robwu.nl>
Robert Meijer <robert.s.meijer@gmail.com> Robert Meijer <robert.s.meijer@gmail.com>
Robert Mustacchi <rm@fingolfin.org> Robert Mustacchi <rm@fingolfin.org>
Robert Nagy <robert.nagy@gmail.com> Robert Nagy <robert.nagy@gmail.com>
Ross Kirsling <rkirsling@gmail.com>
Ruben Bridgewater <ruben@bridgewater.de> Ruben Bridgewater <ruben@bridgewater.de>
Ryan Dahl <ry@tinyclouds.org> Ryan Dahl <ry@tinyclouds.org>
Sakthipriyan Vairamani (thefourtheye) <thechargingvolcano@gmail.com> Sakthipriyan Vairamani (thefourtheye) <thechargingvolcano@gmail.com>
......
...@@ -177,7 +177,7 @@ deps = { ...@@ -177,7 +177,7 @@ deps = {
'v8/test/mozilla/data': 'v8/test/mozilla/data':
Var('chromium_url') + '/v8/deps/third_party/mozilla-tests.git' + '@' + 'f6c578a10ea707b1a8ab0b88943fe5115ce2b9be', Var('chromium_url') + '/v8/deps/third_party/mozilla-tests.git' + '@' + 'f6c578a10ea707b1a8ab0b88943fe5115ce2b9be',
'v8/test/test262/data': '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': 'v8/test/test262/harness':
Var('chromium_url') + '/external/github.com/test262-utils/test262-harness-py.git' + '@' + '4555345a943d0c99a9461182705543fb171dda4b', Var('chromium_url') + '/external/github.com/test262-utils/test262-harness-py.git' + '@' + '4555345a943d0c99a9461182705543fb171dda4b',
'v8/third_party/qemu-linux-x64': { 'v8/third_party/qemu-linux-x64': {
......
...@@ -2469,8 +2469,7 @@ bool ClassScope::ResolvePrivateNames(ParseInfo* info) { ...@@ -2469,8 +2469,7 @@ bool ClassScope::ResolvePrivateNames(ParseInfo* info) {
Scanner::Location loc = proxy->location(); Scanner::Location loc = proxy->location();
info->pending_error_handler()->ReportMessageAt( info->pending_error_handler()->ReportMessageAt(
loc.beg_pos, loc.end_pos, loc.beg_pos, loc.end_pos,
MessageTemplate::kInvalidPrivateFieldResolution, proxy->raw_name(), MessageTemplate::kInvalidPrivateFieldResolution, proxy->raw_name());
kSyntaxError);
return false; return false;
} else { } else {
var->set_is_used(); var->set_is_used();
......
...@@ -1170,8 +1170,6 @@ enum MaybeAssignedFlag : uint8_t { kNotAssigned, kMaybeAssigned }; ...@@ -1170,8 +1170,6 @@ enum MaybeAssignedFlag : uint8_t { kNotAssigned, kMaybeAssigned };
enum RequiresBrandCheckFlag : uint8_t { kNoBrandCheck, kRequiresBrandCheck }; enum RequiresBrandCheckFlag : uint8_t { kNoBrandCheck, kRequiresBrandCheck };
enum ParseErrorType { kSyntaxError = 0, kReferenceError = 1 };
enum class InterpreterPushArgsMode : unsigned { enum class InterpreterPushArgsMode : unsigned {
kArrayFunction, kArrayFunction,
kWithFinalSpread, kWithFinalSpread,
......
...@@ -437,8 +437,7 @@ class ExpressionParsingScope : public ExpressionScope<Types> { ...@@ -437,8 +437,7 @@ class ExpressionParsingScope : public ExpressionScope<Types> {
} }
this->mark_verified(); this->mark_verified();
return this->parser()->RewriteInvalidReferenceExpression( return this->parser()->RewriteInvalidReferenceExpression(
expression, beg_pos, end_pos, MessageTemplate::kInvalidLhsInFor, expression, beg_pos, end_pos, MessageTemplate::kInvalidLhsInFor);
kSyntaxError);
} }
void RecordExpressionError(const Scanner::Location& loc, void RecordExpressionError(const Scanner::Location& loc,
......
...@@ -785,7 +785,7 @@ class ParserBase { ...@@ -785,7 +785,7 @@ class ParserBase {
if (scanner()->current_token() == Token::AWAIT && !is_async_function()) { if (scanner()->current_token() == Token::AWAIT && !is_async_function()) {
ReportMessageAt(scanner()->location(), ReportMessageAt(scanner()->location(),
MessageTemplate::kAwaitNotInAsyncFunction, kSyntaxError); MessageTemplate::kAwaitNotInAsyncFunction);
return; return;
} }
...@@ -935,21 +935,19 @@ class ParserBase { ...@@ -935,21 +935,19 @@ class ParserBase {
V8_NOINLINE void ReportMessage(MessageTemplate message) { V8_NOINLINE void ReportMessage(MessageTemplate message) {
Scanner::Location source_location = scanner()->location(); Scanner::Location source_location = scanner()->location();
impl()->ReportMessageAt(source_location, message, impl()->ReportMessageAt(source_location, message,
static_cast<const char*>(nullptr), kSyntaxError); static_cast<const char*>(nullptr));
} }
template <typename T> template <typename T>
V8_NOINLINE void ReportMessage(MessageTemplate message, T arg, V8_NOINLINE void ReportMessage(MessageTemplate message, T arg) {
ParseErrorType error_type = kSyntaxError) {
Scanner::Location source_location = scanner()->location(); 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, V8_NOINLINE void ReportMessageAt(Scanner::Location location,
MessageTemplate message, MessageTemplate message) {
ParseErrorType error_type) {
impl()->ReportMessageAt(location, message, impl()->ReportMessageAt(location, message,
static_cast<const char*>(nullptr), error_type); static_cast<const char*>(nullptr));
} }
V8_NOINLINE void ReportUnexpectedToken(Token::Value token); V8_NOINLINE void ReportUnexpectedToken(Token::Value token);
...@@ -1218,9 +1216,9 @@ class ParserBase { ...@@ -1218,9 +1216,9 @@ class ParserBase {
// Checks if the expression is a valid reference expression (e.g., on the // 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, // 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. // we allow calls for web compatibility and rewrite them to a runtime throw.
ExpressionT RewriteInvalidReferenceExpression( ExpressionT RewriteInvalidReferenceExpression(ExpressionT expression,
ExpressionT expression, int beg_pos, int end_pos, MessageTemplate message, int beg_pos, int end_pos,
ParseErrorType type = kReferenceError); MessageTemplate message);
bool IsValidReferenceExpression(ExpressionT expression); bool IsValidReferenceExpression(ExpressionT expression);
...@@ -1572,8 +1570,7 @@ ParserBase<Impl>::ParsePropertyOrPrivatePropertyName() { ...@@ -1572,8 +1570,7 @@ ParserBase<Impl>::ParsePropertyOrPrivatePropertyName() {
if (class_scope == nullptr) { if (class_scope == nullptr) {
impl()->ReportMessageAt(Scanner::Location(pos, pos + 1), impl()->ReportMessageAt(Scanner::Location(pos, pos + 1),
MessageTemplate::kInvalidPrivateFieldResolution, MessageTemplate::kInvalidPrivateFieldResolution,
impl()->GetRawNameFromIdentifier(name), impl()->GetRawNameFromIdentifier(name));
kSyntaxError);
return impl()->FailureExpression(); return impl()->FailureExpression();
} }
key = impl()->ExpressionFromPrivateName(class_scope, name, pos); key = impl()->ExpressionFromPrivateName(class_scope, name, pos);
...@@ -2661,13 +2658,11 @@ ParserBase<Impl>::ParseAssignmentExpressionCoverGrammar() { ...@@ -2661,13 +2658,11 @@ ParserBase<Impl>::ParseAssignmentExpressionCoverGrammar() {
impl()->ReportMessageAt(loc, impl()->ReportMessageAt(loc,
MessageTemplate::kInvalidDestructuringTarget); MessageTemplate::kInvalidDestructuringTarget);
} else { } 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 // (Parenthesized literals are
// CoverParenthesizedExpressionAndArrowParameterList). // CoverParenthesizedExpressionAndArrowParameterList).
// #sec-assignment-operators-static-semantics-early-errors // #sec-assignment-operators-static-semantics-early-errors
impl()->ReportMessageAt(loc, MessageTemplate::kInvalidLhsInAssignment, impl()->ReportMessageAt(loc, MessageTemplate::kInvalidLhsInAssignment);
static_cast<const char*>(nullptr),
kReferenceError);
} }
} }
expression_scope()->ValidateAsPattern(expression, lhs_beg_pos, expression_scope()->ValidateAsPattern(expression, lhs_beg_pos,
...@@ -4306,7 +4301,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseClassLiteral( ...@@ -4306,7 +4301,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseClassLiteral(
impl()->ReportMessageAt(Scanner::Location(unresolvable->position(), impl()->ReportMessageAt(Scanner::Location(unresolvable->position(),
unresolvable->position() + 1), unresolvable->position() + 1),
MessageTemplate::kInvalidPrivateFieldResolution, MessageTemplate::kInvalidPrivateFieldResolution,
unresolvable->raw_name(), kSyntaxError); unresolvable->raw_name());
return impl()->FailureExpression(); return impl()->FailureExpression();
} }
...@@ -4457,15 +4452,14 @@ template <typename Impl> ...@@ -4457,15 +4452,14 @@ template <typename Impl>
typename ParserBase<Impl>::ExpressionT typename ParserBase<Impl>::ExpressionT
ParserBase<Impl>::RewriteInvalidReferenceExpression(ExpressionT expression, ParserBase<Impl>::RewriteInvalidReferenceExpression(ExpressionT expression,
int beg_pos, int end_pos, int beg_pos, int end_pos,
MessageTemplate message, MessageTemplate message) {
ParseErrorType type) {
DCHECK(!IsValidReferenceExpression(expression)); DCHECK(!IsValidReferenceExpression(expression));
if (impl()->IsIdentifier(expression)) { if (impl()->IsIdentifier(expression)) {
DCHECK(is_strict(language_mode())); DCHECK(is_strict(language_mode()));
DCHECK(impl()->IsEvalOrArguments(impl()->AsIdentifier(expression))); DCHECK(impl()->IsEvalOrArguments(impl()->AsIdentifier(expression)));
ReportMessageAt(Scanner::Location(beg_pos, end_pos), ReportMessageAt(Scanner::Location(beg_pos, end_pos),
MessageTemplate::kStrictEvalArguments, kSyntaxError); MessageTemplate::kStrictEvalArguments);
return impl()->FailureExpression(); return impl()->FailureExpression();
} }
if (expression->IsCall() && !expression->AsCall()->is_tagged_template()) { if (expression->IsCall() && !expression->AsCall()->is_tagged_template()) {
...@@ -4482,7 +4476,7 @@ ParserBase<Impl>::RewriteInvalidReferenceExpression(ExpressionT expression, ...@@ -4482,7 +4476,7 @@ ParserBase<Impl>::RewriteInvalidReferenceExpression(ExpressionT expression,
ExpressionT error = impl()->NewThrowReferenceError(message, beg_pos); ExpressionT error = impl()->NewThrowReferenceError(message, beg_pos);
return factory()->NewProperty(expression, error, 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(); return impl()->FailureExpression();
} }
...@@ -4576,7 +4570,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseV8Intrinsic() { ...@@ -4576,7 +4570,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseV8Intrinsic() {
if (has_spread) { if (has_spread) {
ReportMessageAt(Scanner::Location(pos, position()), ReportMessageAt(Scanner::Location(pos, position()),
MessageTemplate::kIntrinsicWithSpread, kSyntaxError); MessageTemplate::kIntrinsicWithSpread);
return impl()->FailureExpression(); return impl()->FailureExpression();
} }
......
...@@ -696,11 +696,9 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { ...@@ -696,11 +696,9 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
// Reporting errors. // Reporting errors.
void ReportMessageAt(Scanner::Location source_location, void ReportMessageAt(Scanner::Location source_location,
MessageTemplate message, const char* arg = nullptr, MessageTemplate message, const char* arg = nullptr) {
ParseErrorType error_type = kSyntaxError) { pending_error_handler()->ReportMessageAt(
pending_error_handler()->ReportMessageAt(source_location.beg_pos, source_location.beg_pos, source_location.end_pos, message, arg);
source_location.end_pos, message,
arg, error_type);
scanner_.set_parser_error(); scanner_.set_parser_error();
} }
...@@ -709,11 +707,9 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { ...@@ -709,11 +707,9 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
V8_INLINE void ReportUnidentifiableError() { UNREACHABLE(); } V8_INLINE void ReportUnidentifiableError() { UNREACHABLE(); }
void ReportMessageAt(Scanner::Location source_location, void ReportMessageAt(Scanner::Location source_location,
MessageTemplate message, const AstRawString* arg, MessageTemplate message, const AstRawString* arg) {
ParseErrorType error_type = kSyntaxError) { pending_error_handler()->ReportMessageAt(
pending_error_handler()->ReportMessageAt(source_location.beg_pos, source_location.beg_pos, source_location.end_pos, message, arg);
source_location.end_pos, message,
arg, error_type);
scanner_.set_parser_error(); scanner_.set_parser_error();
} }
......
...@@ -30,26 +30,26 @@ MessageLocation PendingCompilationErrorHandler::MessageDetails::GetLocation( ...@@ -30,26 +30,26 @@ MessageLocation PendingCompilationErrorHandler::MessageDetails::GetLocation(
return MessageLocation(script, start_position_, end_position_); return MessageLocation(script, start_position_, end_position_);
} }
void PendingCompilationErrorHandler::ReportMessageAt( void PendingCompilationErrorHandler::ReportMessageAt(int start_position,
int start_position, int end_position, MessageTemplate message, int end_position,
const char* arg, ParseErrorType error_type) { MessageTemplate message,
const char* arg) {
if (has_pending_error_) return; if (has_pending_error_) return;
has_pending_error_ = true; has_pending_error_ = true;
error_details_ = error_details_ =
MessageDetails(start_position, end_position, message, nullptr, arg); MessageDetails(start_position, end_position, message, nullptr, arg);
error_type_ = error_type;
} }
void PendingCompilationErrorHandler::ReportMessageAt( void PendingCompilationErrorHandler::ReportMessageAt(int start_position,
int start_position, int end_position, MessageTemplate message, int end_position,
const AstRawString* arg, ParseErrorType error_type) { MessageTemplate message,
const AstRawString* arg) {
if (has_pending_error_) return; if (has_pending_error_) return;
has_pending_error_ = true; has_pending_error_ = true;
error_details_ = error_details_ =
MessageDetails(start_position, end_position, message, arg, nullptr); MessageDetails(start_position, end_position, message, arg, nullptr);
error_type_ = error_type;
} }
void PendingCompilationErrorHandler::ReportWarningAt(int start_position, void PendingCompilationErrorHandler::ReportWarningAt(int start_position,
...@@ -97,17 +97,8 @@ void PendingCompilationErrorHandler::ThrowPendingError(Isolate* isolate, ...@@ -97,17 +97,8 @@ void PendingCompilationErrorHandler::ThrowPendingError(Isolate* isolate,
isolate->debug()->OnCompileError(script); isolate->debug()->OnCompileError(script);
Factory* factory = isolate->factory(); Factory* factory = isolate->factory();
Handle<Object> error; Handle<Object> error =
switch (error_type_) { factory->NewSyntaxError(error_details_.message(), argument);
case kReferenceError:
error = factory->NewReferenceError(error_details_.message(), argument);
break;
case kSyntaxError:
error = factory->NewSyntaxError(error_details_.message(), argument);
break;
default:
UNREACHABLE();
}
if (!error->IsJSObject()) { if (!error->IsJSObject()) {
isolate->Throw(*error, &location); isolate->Throw(*error, &location);
......
...@@ -25,17 +25,13 @@ class Script; ...@@ -25,17 +25,13 @@ class Script;
class PendingCompilationErrorHandler { class PendingCompilationErrorHandler {
public: public:
PendingCompilationErrorHandler() PendingCompilationErrorHandler()
: has_pending_error_(false), : has_pending_error_(false), stack_overflow_(false) {}
stack_overflow_(false),
error_type_(kSyntaxError) {}
void ReportMessageAt(int start_position, int end_position, void ReportMessageAt(int start_position, int end_position,
MessageTemplate message, const char* arg = nullptr, MessageTemplate message, const char* arg = nullptr);
ParseErrorType error_type = kSyntaxError);
void ReportMessageAt(int start_position, int end_position, void ReportMessageAt(int start_position, int end_position,
MessageTemplate message, const AstRawString* arg, MessageTemplate message, const AstRawString* arg);
ParseErrorType error_type = kSyntaxError);
void ReportWarningAt(int start_position, int end_position, void ReportWarningAt(int start_position, int end_position,
MessageTemplate message, const char* arg = nullptr); MessageTemplate message, const char* arg = nullptr);
...@@ -110,7 +106,6 @@ class PendingCompilationErrorHandler { ...@@ -110,7 +106,6 @@ class PendingCompilationErrorHandler {
bool unidentifiable_error_ = false; bool unidentifiable_error_ = false;
MessageDetails error_details_; MessageDetails error_details_;
ParseErrorType error_type_;
std::forward_list<MessageDetails> warning_messages_; std::forward_list<MessageDetails> warning_messages_;
......
...@@ -1483,11 +1483,9 @@ class PreParser : public ParserBase<PreParser> { ...@@ -1483,11 +1483,9 @@ class PreParser : public ParserBase<PreParser> {
// Reporting errors. // Reporting errors.
void ReportMessageAt(Scanner::Location source_location, void ReportMessageAt(Scanner::Location source_location,
MessageTemplate message, const char* arg = nullptr, MessageTemplate message, const char* arg = nullptr) {
ParseErrorType error_type = kSyntaxError) { pending_error_handler()->ReportMessageAt(
pending_error_handler()->ReportMessageAt(source_location.beg_pos, source_location.beg_pos, source_location.end_pos, message, arg);
source_location.end_pos, message,
arg, error_type);
scanner()->set_parser_error(); scanner()->set_parser_error();
} }
...@@ -1498,17 +1496,14 @@ class PreParser : public ParserBase<PreParser> { ...@@ -1498,17 +1496,14 @@ class PreParser : public ParserBase<PreParser> {
V8_INLINE void ReportMessageAt(Scanner::Location source_location, V8_INLINE void ReportMessageAt(Scanner::Location source_location,
MessageTemplate message, MessageTemplate message,
const PreParserIdentifier& arg, const PreParserIdentifier& arg) {
ParseErrorType error_type = kSyntaxError) {
UNREACHABLE(); UNREACHABLE();
} }
void ReportMessageAt(Scanner::Location source_location, void ReportMessageAt(Scanner::Location source_location,
MessageTemplate message, const AstRawString* arg, MessageTemplate message, const AstRawString* arg) {
ParseErrorType error_type = kSyntaxError) { pending_error_handler()->ReportMessageAt(
pending_error_handler()->ReportMessageAt(source_location.beg_pos, source_location.beg_pos, source_location.end_pos, message, arg);
source_location.end_pos, message,
arg, error_type);
scanner()->set_parser_error(); scanner()->set_parser_error();
} }
......
*%(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 } function f() { new.target = 5 }
^^^^^^^^^^ ^^^^^^^^^^
ReferenceError: Invalid left-hand side in assignment SyntaxError: Invalid left-hand side in assignment
*%(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++ } function f() { new.target++ }
^^^^^^^^^^ ^^^^^^^^^^
ReferenceError: Invalid left-hand side expression in postfix operation SyntaxError: Invalid left-hand side expression in postfix operation
*%(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 } function f() { ++new.target }
^^^^^^^^^^ ^^^^^^^^^^
ReferenceError: Invalid left-hand side expression in prefix operation SyntaxError: Invalid left-hand side expression in prefix operation
...@@ -401,13 +401,13 @@ function get_new_target() { return new.target; } ...@@ -401,13 +401,13 @@ function get_new_target() { return new.target; }
(function TestEarlyErrors() { (function TestEarlyErrors() {
assertThrows(function() { Function("new.target = 42"); }, ReferenceError); assertThrows(function() { Function("new.target = 42"); }, SyntaxError);
assertThrows(function() { Function("var foo = 1; new.target = foo = 42"); }, ReferenceError); assertThrows(function() { Function("var foo = 1; new.target = foo = 42"); }, SyntaxError);
assertThrows(function() { Function("var foo = 1; foo = new.target = 42"); }, ReferenceError); assertThrows(function() { Function("var foo = 1; foo = new.target = 42"); }, SyntaxError);
assertThrows(function() { Function("new.target--"); }, ReferenceError); assertThrows(function() { Function("new.target--"); }, SyntaxError);
assertThrows(function() { Function("--new.target"); }, ReferenceError); assertThrows(function() { Function("--new.target"); }, SyntaxError);
assertThrows(function() { Function("(new.target)++"); }, ReferenceError); assertThrows(function() { Function("(new.target)++"); }, SyntaxError);
assertThrows(function() { Function("++(new.target)"); }, ReferenceError); assertThrows(function() { Function("++(new.target)"); }, SyntaxError);
assertThrows(function() { Function("for (new.target of {});"); }, SyntaxError); assertThrows(function() { Function("for (new.target of {});"); }, SyntaxError);
})(); })();
......
...@@ -725,20 +725,20 @@ var global = this; ...@@ -725,20 +725,20 @@ var global = this;
(function testTaggedTemplateInvalidAssignmentTargetStrict() { (function testTaggedTemplateInvalidAssignmentTargetStrict() {
"use strict"; "use strict";
function f() {} function f() {}
assertThrows(() => Function("++f`foo`"), ReferenceError); assertThrows(() => Function("++f`foo`"), SyntaxError);
assertThrows(() => Function("f`foo`++"), ReferenceError); assertThrows(() => Function("f`foo`++"), SyntaxError);
assertThrows(() => Function("--f`foo`"), ReferenceError); assertThrows(() => Function("--f`foo`"), SyntaxError);
assertThrows(() => Function("f`foo`--"), ReferenceError); assertThrows(() => Function("f`foo`--"), SyntaxError);
assertThrows(() => Function("f`foo` = 1"), ReferenceError); assertThrows(() => Function("f`foo` = 1"), SyntaxError);
})(); })();
(function testTaggedTemplateInvalidAssignmentTargetSloppy() { (function testTaggedTemplateInvalidAssignmentTargetSloppy() {
function f() {} function f() {}
assertThrows(() => Function("++f`foo`"), ReferenceError); assertThrows(() => Function("++f`foo`"), SyntaxError);
assertThrows(() => Function("f`foo`++"), ReferenceError); assertThrows(() => Function("f`foo`++"), SyntaxError);
assertThrows(() => Function("--f`foo`"), ReferenceError); assertThrows(() => Function("--f`foo`"), SyntaxError);
assertThrows(() => Function("f`foo`--"), ReferenceError); assertThrows(() => Function("f`foo`--"), SyntaxError);
assertThrows(() => Function("f`foo` = 1"), ReferenceError); assertThrows(() => Function("f`foo` = 1"), SyntaxError);
})(); })();
// Disable eval caching if a tagged template occurs in a nested function // Disable eval caching if a tagged template occurs in a nested function
......
...@@ -264,13 +264,13 @@ function TestOverrideMathPow() { ...@@ -264,13 +264,13 @@ function TestOverrideMathPow() {
TestOverrideMathPow(); TestOverrideMathPow();
function TestBadAssignmentLHS() { function TestBadAssignmentLHS() {
assertThrows("if (false) { 17 **= 10; }", ReferenceError); assertThrows("if (false) { 17 **= 10; }", SyntaxError);
assertThrows("if (false) { '17' **= 10; }", ReferenceError); assertThrows("if (false) { '17' **= 10; }", SyntaxError);
assertThrows("if (false) { /17/ **= 10; }", ReferenceError); assertThrows("if (false) { /17/ **= 10; }", SyntaxError);
assertThrows("if (false) { ({ valueOf() { return 17; } } **= 10); }", assertThrows("if (false) { ({ valueOf() { return 17; } } **= 10); }",
ReferenceError); SyntaxError);
// TODO(caitp): a Call expression as LHS should be an early ReferenceError! // TODO(caitp): a Call expression as LHS should be an early SyntaxError!
// assertThrows("if (false) { Array() **= 10; }", ReferenceError); // assertThrows("if (false) { Array() **= 10; }", SyntaxError);
assertThrows(() => Array() **= 10, ReferenceError); assertThrows(() => Array() **= 10, ReferenceError);
} }
TestBadAssignmentLHS(); TestBadAssignmentLHS();
...@@ -29,23 +29,23 @@ ...@@ -29,23 +29,23 @@
// exceptions are delayed until runtime. // exceptions are delayed until runtime.
// Normal assignments: // Normal assignments:
assertThrows("12 = 12", ReferenceError); assertThrows("12 = 12", SyntaxError);
assertThrows("x++ = 12", ReferenceError); assertThrows("x++ = 12", SyntaxError);
assertThrows("eval('var x') = 12", ReferenceError); 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"); assertDoesNotThrow("if (false) eval('var x') = 12");
// Pre- and post-fix operations: // Pre- and post-fix operations:
assertThrows("12++", ReferenceError); assertThrows("12++", SyntaxError);
assertThrows("12--", ReferenceError); assertThrows("12--", SyntaxError);
assertThrows("++12", ReferenceError); assertThrows("++12", SyntaxError);
assertThrows("--12", ReferenceError); assertThrows("--12", SyntaxError);
assertThrows("++(eval('12'))", ReferenceError); assertThrows("++(eval('12'))", ReferenceError);
assertThrows("(eval('12'))++", ReferenceError); assertThrows("(eval('12'))++", ReferenceError);
assertThrows("if (false) 12++", ReferenceError); assertThrows("if (false) 12++", SyntaxError);
assertThrows("if (false) 12--", ReferenceError); assertThrows("if (false) 12--", SyntaxError);
assertThrows("if (false) ++12", ReferenceError); assertThrows("if (false) ++12", SyntaxError);
assertThrows("if (false) --12", ReferenceError); assertThrows("if (false) --12", SyntaxError);
assertDoesNotThrow("if (false) ++(eval('12'))"); assertDoesNotThrow("if (false) ++(eval('12'))");
assertDoesNotThrow("if (false) (eval('12'))++"); assertDoesNotThrow("if (false) (eval('12'))++");
...@@ -56,19 +56,19 @@ assertThrows("if (false) for (12 in [1]) print(12);", SyntaxError); ...@@ -56,19 +56,19 @@ assertThrows("if (false) for (12 in [1]) print(12);", SyntaxError);
assertDoesNotThrow("if (false) for (eval('0') in [1]) print(12);"); assertDoesNotThrow("if (false) for (eval('0') in [1]) print(12);");
// For: // 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("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);"); assertDoesNotThrow("if (false) for (eval('var x') = 1;;) print(12);");
// Assignments to 'this'. // Assignments to 'this'.
assertThrows("this = 42", ReferenceError); assertThrows("this = 42", SyntaxError);
assertThrows("function f() { this = 12; }", ReferenceError); assertThrows("function f() { this = 12; }", SyntaxError);
assertThrows("for (this in {x:3, y:4, z:5}) ;", SyntaxError); assertThrows("for (this in {x:3, y:4, z:5}) ;", SyntaxError);
assertThrows("for (this = 0;;) ;", ReferenceError); assertThrows("for (this = 0;;) ;", SyntaxError);
assertThrows("this++", ReferenceError); assertThrows("this++", SyntaxError);
assertThrows("++this", ReferenceError); assertThrows("++this", SyntaxError);
assertThrows("this--", ReferenceError); assertThrows("this--", SyntaxError);
assertThrows("--this", ReferenceError); assertThrows("--this", SyntaxError);
assertThrows("if (false) this = 42", ReferenceError); assertThrows("if (false) this = 42", SyntaxError);
assertThrows("if (false) this++", ReferenceError); assertThrows("if (false) this++", SyntaxError);
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
// Parameters can't have parentheses (both patterns and identifiers) // Parameters can't have parentheses (both patterns and identifiers)
assertThrows("( ({x: 1}) ) => {};", SyntaxError); assertThrows("( ({x: 1}) ) => {};", SyntaxError);
assertThrows("( (x) ) => {}", SyntaxError); assertThrows("( (x) ) => {}", SyntaxError);
assertThrows("( ({x: 1}) = y ) => {}", ReferenceError); assertThrows("( ({x: 1}) = y ) => {}", SyntaxError);
assertThrows("( (x) = y ) => {}", SyntaxError); assertThrows("( (x) = y ) => {}", SyntaxError);
// Declarations can't have parentheses (both patterns and identifiers) // Declarations can't have parentheses (both patterns and identifiers)
...@@ -21,8 +21,8 @@ assertThrows("var [({x: 1}) = y] = [];", SyntaxError); ...@@ -21,8 +21,8 @@ assertThrows("var [({x: 1}) = y] = [];", SyntaxError);
assertThrows("var [(x) = y] = [];", SyntaxError); assertThrows("var [(x) = y] = [];", SyntaxError);
// Patterns can't have parentheses in assignments either // Patterns can't have parentheses in assignments either
assertThrows("[({x: 1}) = y] = [];", ReferenceError); assertThrows("[({x: 1}) = y] = [];", SyntaxError);
assertThrows("({a,b}) = {a:2,b:3}", ReferenceError); assertThrows("({a,b}) = {a:2,b:3}", SyntaxError);
// Parentheses are fine around identifiers in assignments though, even inside a // Parentheses are fine around identifiers in assignments though, even inside a
// pattern // pattern
......
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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);
...@@ -10,5 +10,5 @@ try { ...@@ -10,5 +10,5 @@ try {
f(); f();
assertUnreachable(); assertUnreachable();
} catch(e) { } catch(e) {
assertTrue(e instanceof ReferenceError); assertTrue(e instanceof SyntaxError);
} }
...@@ -901,23 +901,23 @@ ...@@ -901,23 +901,23 @@
'language/expressions/dynamic-import/reuse-namespace-object': [SKIP], '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-import': [SKIP],
'language/expressions/dynamic-import/reuse-namespace-object-from-script': [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-assignmenttargettype-syntax-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-assignmenttargettype-syntax-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-assignmenttargettype-syntax-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-assignmenttargettype-syntax-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-assignmenttargettype-syntax-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-assignmenttargettype-syntax-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-assignmenttargettype-syntax-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-assignmenttargettype-syntax-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-assignmenttargettype-syntax-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-assignmenttargettype-syntax-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-assignmenttargettype-syntax-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-assignmenttargettype-syntax-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-assignmenttargettype-syntax-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-assignmenttargettype-syntax-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-assignmenttargettype-syntax-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-assignmenttargettype-syntax-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-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-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-new-call-expression': [SKIP],
'language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-no-rest-param': [SKIP], 'language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-no-rest-param': [SKIP],
......
...@@ -153,22 +153,22 @@ PASS (function (){'use strict'; function f() { --arguments }}) threw exception S ...@@ -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 '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 (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 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 'use strict'; ++(1, eval) threw exception SyntaxError: 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 (function (){'use strict'; ++(1, eval)}) threw exception SyntaxError: 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 'use strict'; (1, eval)++ threw exception SyntaxError: 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 (function (){'use strict'; (1, eval)++}) threw exception SyntaxError: 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 'use strict'; --(1, eval) threw exception SyntaxError: 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 (function (){'use strict'; --(1, eval)}) threw exception SyntaxError: 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 'use strict'; (1, eval)-- threw exception SyntaxError: 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 (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 ReferenceError: Invalid left-hand side expression in prefix 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 ReferenceError: 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 ReferenceError: Invalid left-hand side expression in postfix 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 ReferenceError: 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 ReferenceError: Invalid left-hand side expression in prefix 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 ReferenceError: 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 ReferenceError: Invalid left-hand side expression in postfix 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 ReferenceError: 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 '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 (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. FAIL 'use strict'; undefined; if (0) delete ++a.b should throw an exception. Was undefined.
......
...@@ -127,7 +127,7 @@ for (i = 0; i < assignmentOperators.length; ++i) { ...@@ -127,7 +127,7 @@ for (i = 0; i < assignmentOperators.length; ++i) {
testRightAssociativeSame("=", op); testRightAssociativeSame("=", op);
testLowerFirst(op, "+"); testLowerFirst(op, "+");
shouldThrow("compileAndSerialize('a + b " + op + " c')"); shouldThrow("compileAndSerialize('a + b " + op + " c')");
testKeepParentheses("(a + b) " + op + " c"); shouldThrow("compileAndSerialize('(a + b) " + op + " c')");
testKeepParentheses("a + (b " + op + " c)"); testKeepParentheses("a + (b " + op + " c)");
} }
...@@ -138,7 +138,10 @@ for (i = 0; i < prefixOperators.length; ++i) { ...@@ -138,7 +138,10 @@ for (i = 0; i < prefixOperators.length; ++i) {
var op = prefixOperators[i] + prefixOperatorSpace[i]; var op = prefixOperators[i] + prefixOperatorSpace[i];
testKeepParentheses("" + op + "a + b"); testKeepParentheses("" + op + "a + b");
testOptionalParentheses("(" + 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"); testKeepParentheses("!" + op + "a");
testOptionalParentheses("!(" + op + "a)"); testOptionalParentheses("!(" + op + "a)");
} }
...@@ -146,11 +149,11 @@ for (i = 0; i < prefixOperators.length; ++i) { ...@@ -146,11 +149,11 @@ for (i = 0; i < prefixOperators.length; ++i) {
testKeepParentheses("!a++"); testKeepParentheses("!a++");
testOptionalParentheses("!(a++)"); testOptionalParentheses("!(a++)");
testKeepParentheses("(!a)++"); shouldThrow("compileAndSerialize('(!a)++')");
testKeepParentheses("!a--"); testKeepParentheses("!a--");
testOptionalParentheses("!(a--)"); testOptionalParentheses("!(a--)");
testKeepParentheses("(!a)--"); shouldThrow("compileAndSerialize('(!a)--')");
testKeepParentheses("(-1)[a]"); testKeepParentheses("(-1)[a]");
testKeepParentheses("(-1)[a] = b"); testKeepParentheses("(-1)[a] = b");
...@@ -205,9 +208,9 @@ testKeepParentheses("(1).a()"); ...@@ -205,9 +208,9 @@ testKeepParentheses("(1).a()");
for (i = 0; i < assignmentOperators.length; ++i) { for (i = 0; i < assignmentOperators.length; ++i) {
var op = assignmentOperators[i]; var op = assignmentOperators[i];
testKeepParentheses("(-1) " + op + " a"); shouldThrow("compileAndSerialize('(-1) " + op + " a')");
testKeepParentheses("(- 0) " + op + " a"); shouldThrow("compileAndSerialize('(- 0) " + op + " a')");
testKeepParentheses("1 " + op + " a"); shouldThrow("compileAndSerialize('1 " + op + " a')");
} }
shouldBe("compileAndSerializeLeftmostTest('({ }).x')", "'({ }).x'"); shouldBe("compileAndSerializeLeftmostTest('({ }).x')", "'({ }).x'");
......
...@@ -47,32 +47,32 @@ PASS Invalid: "new -a" ...@@ -47,32 +47,32 @@ PASS Invalid: "new -a"
PASS Invalid: "function f() { new -a }" PASS Invalid: "function f() { new -a }"
PASS Valid: "new (-1)" PASS Valid: "new (-1)"
PASS Valid: "function f() { new (-1) }" PASS Valid: "function f() { new (-1) }"
PASS Valid: "a: b: c: new f(x++)++" PASS Invalid: "a: b: c: new f(x++)++"
PASS Valid: "function f() { a: b: c: new f(x++)++ }" PASS Invalid: "function f() { a: b: c: new f(x++)++ }"
PASS Valid: "(a)++" PASS Valid: "(a)++"
PASS Valid: "function f() { (a)++ }" PASS Valid: "function f() { (a)++ }"
PASS Valid: "(1--).x" PASS Invalid: "(1--).x"
PASS Valid: "function f() { (1--).x }" PASS Invalid: "function f() { (1--).x }"
PASS Invalid: "a-- ++" PASS Invalid: "a-- ++"
PASS Invalid: "function f() { a-- ++ }" PASS Invalid: "function f() { a-- ++ }"
PASS Invalid: "(a:) --b" PASS Invalid: "(a:) --b"
PASS Invalid: "function f() { (a:) --b }" PASS Invalid: "function f() { (a:) --b }"
PASS Valid: "++ -- ++ a" PASS Invalid: "++ -- ++ a"
PASS Valid: "function f() { ++ -- ++ a }" PASS Invalid: "function f() { ++ -- ++ a }"
PASS Valid: "++ new new a ++" PASS Invalid: "++ new new a ++"
PASS Valid: "function f() { ++ new new a ++ }" PASS Invalid: "function f() { ++ new new a ++ }"
PASS Valid: "delete void 0" PASS Valid: "delete void 0"
PASS Valid: "function f() { delete void 0 }" PASS Valid: "function f() { delete void 0 }"
PASS Invalid: "delete the void" PASS Invalid: "delete the void"
PASS Invalid: "function f() { delete the void }" PASS Invalid: "function f() { delete the void }"
PASS Invalid: "(a++" PASS Invalid: "(a++"
PASS Invalid: "function f() { (a++ }" PASS Invalid: "function f() { (a++ }"
PASS Valid: "++a--" PASS Invalid: "++a--"
PASS Valid: "function f() { ++a-- }" PASS Invalid: "function f() { ++a-- }"
PASS Valid: "++((a))--" PASS Invalid: "++((a))--"
PASS Valid: "function f() { ++((a))-- }" PASS Invalid: "function f() { ++((a))-- }"
PASS Valid: "(a.x++)++" PASS Invalid: "(a.x++)++"
PASS Valid: "function f() { (a.x++)++ }" PASS Invalid: "function f() { (a.x++)++ }"
PASS Invalid: "1: null" PASS Invalid: "1: null"
PASS Invalid: "function f() { 1: null }" PASS Invalid: "function f() { 1: null }"
PASS Invalid: "+-!~" PASS Invalid: "+-!~"
...@@ -114,18 +114,18 @@ PASS Invalid: "a in instanceof b.l" ...@@ -114,18 +114,18 @@ PASS Invalid: "a in instanceof b.l"
PASS Invalid: "function f() { a in instanceof b.l }" PASS Invalid: "function f() { a in instanceof b.l }"
PASS Valid: "- - true % 5" PASS Valid: "- - true % 5"
PASS Valid: "function f() { - - true % 5 }" PASS Valid: "function f() { - - true % 5 }"
FAIL Invalid: "- false = 3" should throw undefined PASS Invalid: "- false = 3"
FAIL Invalid: "function f() { - false = 3 }" should throw undefined PASS Invalid: "function f() { - false = 3 }"
PASS Valid: "a: b: c: (1 + null) = 3" PASS Invalid: "a: b: c: (1 + null) = 3"
PASS Valid: "function f() { 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: "a[2] = b.l += c /= 4 * 7 ^ !6"
PASS Valid: "function f() { 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 PASS Invalid: "a + typeof b += c in d"
FAIL Invalid: "function f() { a + typeof b += c in d }" should throw undefined PASS Invalid: "function f() { a + typeof b += c in d }"
FAIL Invalid: "typeof a &= typeof b" should throw undefined PASS Invalid: "typeof a &= typeof b"
FAIL Invalid: "function f() { typeof a &= typeof b }" should throw undefined PASS Invalid: "function f() { typeof a &= typeof b }"
PASS Valid: "a: ((typeof (a))) >>>= a || b.l && c" PASS Invalid: "a: ((typeof (a))) >>>= a || b.l && c"
PASS Valid: "function f() { 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: "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: "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]" 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] }" ...@@ -133,8 +133,8 @@ PASS Valid: "function f() { -void+x['y'].l == x.l != 5 - f[7] }"
Function calls (and new with arguments) Function calls (and new with arguments)
PASS Valid: "a()()()" PASS Valid: "a()()()"
PASS Valid: "function f() { a()()() }" PASS Valid: "function f() { a()()() }"
PASS Valid: "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 Valid: "function f() { 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: "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 Valid: "function f() { s: eval(a.apply(), b.call(c[5] - f[7])) }"
PASS Invalid: "a(" PASS Invalid: "a("
...@@ -143,8 +143,8 @@ PASS Invalid: "a(5" ...@@ -143,8 +143,8 @@ PASS Invalid: "a(5"
PASS Invalid: "function f() { a(5 }" PASS Invalid: "function f() { a(5 }"
PASS Invalid: "a(5," PASS Invalid: "a(5,"
PASS Invalid: "function f() { a(5, }" PASS Invalid: "function f() { a(5, }"
FAIL Invalid: "a(5,)" should throw undefined PASS Valid: "a(5,)"
FAIL Invalid: "function f() { a(5,) }" should throw undefined PASS Valid: "function f() { a(5,) }"
PASS Invalid: "a(5,6" PASS Invalid: "a(5,6"
PASS Invalid: "function f() { a(5,6 }" PASS Invalid: "function f() { a(5,6 }"
PASS Valid: "a(b[7], c <d> e.l, new a() > b)" PASS Valid: "a(b[7], c <d> e.l, new a() > b)"
...@@ -178,8 +178,8 @@ PASS Invalid: "function () {}" ...@@ -178,8 +178,8 @@ PASS Invalid: "function () {}"
PASS Invalid: "function f() { function () {} }" PASS Invalid: "function f() { function () {} }"
PASS Invalid: "function f(a b) {}" PASS Invalid: "function f(a b) {}"
PASS Invalid: "function f() { function f(a b) {} }" PASS Invalid: "function f() { function f(a b) {} }"
FAIL Invalid: "function f(a,) {}" should throw undefined PASS Valid: "function f(a,) {}"
FAIL Invalid: "function f() { function f(a,) {} }" should throw undefined PASS Valid: "function f() { function f(a,) {} }"
PASS Invalid: "function f(a," PASS Invalid: "function f(a,"
PASS Invalid: "function f() { function f(a, }" PASS Invalid: "function f() { function f(a, }"
PASS Invalid: "function f(a, 1) {}" PASS Invalid: "function f(a, 1) {}"
...@@ -341,8 +341,8 @@ PASS Invalid: "var a = if (b) { c }" ...@@ -341,8 +341,8 @@ PASS Invalid: "var a = if (b) { c }"
PASS Invalid: "function f() { var a = if (b) { c } }" PASS Invalid: "function f() { var a = if (b) { c } }"
PASS Invalid: "var a = var b" PASS Invalid: "var a = var b"
PASS Invalid: "function f() { 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 PASS Invalid: "const a = b += c, a, a, a = (b - f())"
FAIL Valid: "function f() { const a = b += c, a, a, a = (b - f()) }" should NOT throw PASS Invalid: "function f() { const a = b += c, a, a, a = (b - f()) }"
PASS Invalid: "var a %= b | 5" PASS Invalid: "var a %= b | 5"
PASS Invalid: "function f() { var a %= b | 5 }" PASS Invalid: "function f() { var a %= b | 5 }"
PASS Invalid: "var (a) = 5" PASS Invalid: "var (a) = 5"
...@@ -355,10 +355,10 @@ PASS Invalid: "var var = 3" ...@@ -355,10 +355,10 @@ PASS Invalid: "var var = 3"
PASS Invalid: "function f() { var var = 3 }" PASS Invalid: "function f() { var var = 3 }"
PASS Valid: "var varr = 3 in 1" PASS Valid: "var varr = 3 in 1"
PASS Valid: "function f() { 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 PASS Invalid: "const a, a, a = void 7 - typeof 8, a = 8"
FAIL Valid: "function f() { const a, a, a = void 7 - typeof 8, a = 8 }" should NOT throw PASS Invalid: "function f() { const a, a, a = void 7 - typeof 8, a = 8 }"
PASS Valid: "const x_x = 6 /= 7 ? e : f" PASS Invalid: "const x_x = 6 /= 7 ? e : f"
PASS Valid: "function f() { const x_x = 6 /= 7 ? e : f }" PASS Invalid: "function f() { const x_x = 6 /= 7 ? e : f }"
PASS Invalid: "var a = ?" PASS Invalid: "var a = ?"
PASS Invalid: "function f() { var a = ? }" PASS Invalid: "function f() { var a = ? }"
PASS Invalid: "const a = *7" PASS Invalid: "const a = *7"
...@@ -452,8 +452,8 @@ PASS Invalid: "for ((a ? b : c) in c) break" ...@@ -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 Invalid: "function f() { for ((a ? b : c) in c) break }"
PASS Valid: "for (var a in b 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: "function f() { for (var a in b in c) break }"
PASS Valid: "for (var a = 5 += 6 in b) break" PASS Invalid: "for (var a = 5 += 6 in b) break"
PASS Valid: "function f() { 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: "for (var a += 5 in b) break"
PASS Invalid: "function f() { 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" PASS Invalid: "for (var a = in b) break"
...@@ -470,8 +470,8 @@ PASS Invalid: "for (var a = (b in c in d) 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: "function f() { for (var a = (b in c in d) break }"
PASS Invalid: "for (var (a) in b) { }" PASS Invalid: "for (var (a) in b) { }"
PASS Invalid: "function f() { 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 Invalid: "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: "function f() { for (var a = 7, b = c < d >= d ; f()[6]++ ; --i()[1]++ ) {} }"
try statement try statement
PASS Valid: "try {} finally { c++ }" PASS Valid: "try {} finally { c++ }"
PASS Valid: "function f() { try {} finally { c++ } }" PASS Valid: "function f() { try {} finally { c++ } }"
...@@ -582,8 +582,8 @@ PASS Valid: "if (0) obj.foo\u03bb; " ...@@ -582,8 +582,8 @@ PASS Valid: "if (0) obj.foo\u03bb; "
PASS Valid: "function f() { 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: "if (0) new a(b+c).d = 5"
PASS Valid: "function f() { 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 Invalid: "if (0) new a(b+c) = 5"
PASS Valid: "function f() { 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: "([1 || 1].a = 1)"
PASS Valid: "function f() { ([1 || 1].a = 1) }" PASS Valid: "function f() { ([1 || 1].a = 1) }"
PASS Valid: "({a: 1 || 1}.a = 1)" PASS Valid: "({a: 1 || 1}.a = 1)"
......
...@@ -85,19 +85,19 @@ invalid("a.'l'"); ...@@ -85,19 +85,19 @@ invalid("a.'l'");
valid ("a: +~!new a"); valid ("a: +~!new a");
invalid("new -a"); invalid("new -a");
valid ("new (-1)") valid ("new (-1)")
valid ("a: b: c: new f(x++)++") invalid("a: b: c: new f(x++)++")
valid ("(a)++"); valid ("(a)++");
valid ("(1--).x"); invalid("(1--).x");
invalid("a-- ++"); invalid("a-- ++");
invalid("(a:) --b"); invalid("(a:) --b");
valid ("++ -- ++ a"); invalid("++ -- ++ a");
valid ("++ new new a ++"); invalid("++ new new a ++");
valid ("delete void 0"); valid ("delete void 0");
invalid("delete the void"); invalid("delete the void");
invalid("(a++"); invalid("(a++");
valid ("++a--"); invalid("++a--");
valid ("++((a))--"); invalid("++((a))--");
valid ("(a.x++)++"); invalid("(a.x++)++");
invalid("1: null"); invalid("1: null");
invalid("+-!~"); invalid("+-!~");
invalid("+-!~(("); invalid("+-!~((");
...@@ -122,23 +122,23 @@ valid ("a in b instanceof delete -c"); ...@@ -122,23 +122,23 @@ valid ("a in b instanceof delete -c");
invalid("a in instanceof b.l"); invalid("a in instanceof b.l");
valid ("- - true % 5"); valid ("- - true % 5");
invalid("- false = 3"); 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"); valid ("a[2] = b.l += c /= 4 * 7 ^ !6");
invalid("a + typeof b += c in d"); invalid("a + typeof b += c in d");
invalid("typeof a &= typeof b"); 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 ("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]"); valid ("-void+x['y'].l == x.l != 5 - f[7]");
debug ("Function calls (and new with arguments)"); debug ("Function calls (and new with arguments)");
valid ("a()()()"); 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]))"); valid ("s: eval(a.apply(), b.call(c[5] - f[7]))");
invalid("a("); invalid("a(");
invalid("a(5"); invalid("a(5");
invalid("a(5,"); invalid("a(5,");
invalid("a(5,)"); valid("a(5,)");
invalid("a(5,6"); invalid("a(5,6");
valid ("a(b[7], c <d> e.l, new a() > b)"); valid ("a(b[7], c <d> e.l, new a() > b)");
invalid("a(b[5)"); invalid("a(b[5)");
...@@ -158,7 +158,7 @@ valid ("function f() {}"); ...@@ -158,7 +158,7 @@ valid ("function f() {}");
valid ("function f(a,b) {}"); valid ("function f(a,b) {}");
invalid("function () {}"); invalid("function () {}");
invalid("function f(a b) {}"); invalid("function f(a b) {}");
invalid("function f(a,) {}"); valid("function f(a,) {}");
invalid("function f(a,"); invalid("function f(a,");
invalid("function f(a, 1) {}"); invalid("function f(a, 1) {}");
valid ("function g(arguments, eval) {}"); valid ("function g(arguments, eval) {}");
...@@ -248,15 +248,15 @@ invalid("var 5 = 6"); ...@@ -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"); 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 = if (b) { c }");
invalid("var a = var b"); 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 %= b | 5");
invalid("var (a) = 5"); invalid("var (a) = 5");
invalid("var a = (4, b = 6"); invalid("var a = (4, b = 6");
invalid("const 'l' = 3"); invalid("const 'l' = 3");
invalid("var var = 3"); invalid("var var = 3");
valid ("var varr = 3 in 1"); valid ("var varr = 3 in 1");
valid ("const a, a, a = void 7 - typeof 8, a = 8"); invalid("const a, a, a = void 7 - typeof 8, a = 8");
valid ("const x_x = 6 /= 7 ? e : f"); invalid("const x_x = 6 /= 7 ? e : f");
invalid("var a = ?"); invalid("var a = ?");
invalid("const a = *7"); invalid("const a = *7");
invalid("var a = :)"); invalid("var a = :)");
...@@ -306,7 +306,7 @@ invalid("for ((a, b) in c) break"); ...@@ -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");
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 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 += 5 in b) break");
invalid("for (var a = in b) break"); invalid("for (var a = in b) break");
invalid("for (var a, b in b) break"); invalid("for (var a, b in b) break");
...@@ -315,7 +315,7 @@ invalid("for (var a, b = 8 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"); valid ("for (var a = (b in c) in d) break");
invalid("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) { }"); 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"); debug ("try statement");
...@@ -379,7 +379,7 @@ valid("if (0) obj.foo$; ") ...@@ -379,7 +379,7 @@ valid("if (0) obj.foo$; ")
valid("if (0) obj.foo_; ") valid("if (0) obj.foo_; ")
valid("if (0) obj.foo\\u03bb; ") valid("if (0) obj.foo\\u03bb; ")
valid("if (0) new a(b+c).d = 5"); 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("([1 || 1].a = 1)");
valid("({a: 1 || 1}.a = 1)"); valid("({a: 1 || 1}.a = 1)");
......
...@@ -26,9 +26,9 @@ Test to ensure correct handling of --> as a single line comment when at the begi ...@@ -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". 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 'should be a syntax error' --> threw exception SyntaxError: 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 SyntaxError: 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 SyntaxError: Invalid left-hand side expression in postfix operation.
PASS 1/* PASS 1/*
*/--> is 1 */--> is 1
PASS --> is undefined. PASS --> is undefined.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment