Commit 56329019 authored by Oliver Dunk's avatar Oliver Dunk Committed by Commit Bot

Add quotes around unexpected token SyntaxError

Quotes have been added around the token to make the message clearer.

Bug: chromium:943636
Change-Id: Ic38f3e6d307157af2c0146e69fb611a2cfb46564
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1593307
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62074}
parent d1b6d722
......@@ -139,6 +139,7 @@ Nicolas Antonius Ernst Leopold Maria Kaiser <nikai@nikai.net>
Niklas Hambüchen <mail@nh2.me>
Noj Vek <nojvek@gmail.com>
Oleksandr Chekhovskyi <oleksandr.chekhovskyi@gmail.com>
Oliver Dunk <oliver@oliverdunk.com>
Paolo Giarrusso <p.giarrusso@gmail.com>
Patrick Gansterer <paroga@paroga.com>
Peng Fei <pfgenyun@gmail.com>
......
......@@ -495,7 +495,7 @@ namespace internal {
T(UnexpectedSuper, "'super' keyword unexpected here") \
T(UnexpectedNewTarget, "new.target expression is not allowed here") \
T(UnexpectedTemplateString, "Unexpected template string") \
T(UnexpectedToken, "Unexpected token %") \
T(UnexpectedToken, "Unexpected token '%'") \
T(UnexpectedTokenUnaryExponentiation, \
"Unary operator used immediately before exponentiation expression. " \
"Parenthesis must be used to disambiguate operator precedence") \
......
......@@ -505,7 +505,7 @@ TEST(LiveEditCompileError) {
CHECK_EQ(result.column_number, 51);
v8::String::Utf8Value result_message(env->GetIsolate(), result.message);
CHECK_NOT_NULL(
strstr(*result_message, "Uncaught SyntaxError: Unexpected token )"));
strstr(*result_message, "Uncaught SyntaxError: Unexpected token ')'"));
{
v8::Local<v8::String> result =
......
......@@ -4701,10 +4701,10 @@ TEST(ImportExpressionSuccess) {
// context.
// For example, a top level "import(" is parsed as an
// import declaration. The parser parses the import token correctly
// and then shows an "Unexpected token (" error message. The
// and then shows an "Unexpected token '('" error message. The
// preparser does not understand the import keyword (this test is
// run without kAllowHarmonyDynamicImport flag), so this results in
// an "Unexpected token import" error.
// an "Unexpected token 'import'" error.
RunParserSyncTest(context_data, data, kError);
RunModuleParserSyncTest(context_data, data, kError, nullptr, 0, nullptr, 0,
nullptr, 0, true, true);
......@@ -4772,7 +4772,7 @@ TEST(ImportExpressionErrors) {
// as an import declaration. The parser parses the import token
// correctly and then shows an "Unexpected end of input" error
// message because of the '{'. The preparser shows an "Unexpected
// token {" because it's not a valid token in a CallExpression.
// token '{'" because it's not a valid token in a CallExpression.
RunModuleParserSyncTest(context_data, data, kError, nullptr, 0, flags,
arraysize(flags), nullptr, 0, true, true);
}
......
......@@ -308,7 +308,7 @@ ReleaseObjectGroup with invalid params
Running test: testEvaluateSyntaxError
{
className : SyntaxError
description : SyntaxError: Unexpected token ] at <anonymous>:1:1
description : SyntaxError: Unexpected token ']' at <anonymous>:1:1
objectId : <objectId>
subtype : error
type : object
......@@ -351,4 +351,4 @@ Running test: testNullExpression
message : Invalid parameters
}
id : <messageId>
}
\ No newline at end of file
}
......@@ -43,7 +43,7 @@ Running test: testSyntaxErrorInFunction
columnNumber : 2
exception : {
className : SyntaxError
description : SyntaxError: Unexpected token }
description : SyntaxError: Unexpected token '}'
objectId : <objectId>
subtype : error
type : object
......@@ -55,7 +55,7 @@ Running test: testSyntaxErrorInFunction
}
result : {
className : SyntaxError
description : SyntaxError: Unexpected token }
description : SyntaxError: Unexpected token '}'
objectId : <objectId>
subtype : error
type : object
......
......@@ -206,21 +206,21 @@ console.log(239)
columnNumber : 0
exception : {
className : SyntaxError
description : SyntaxError: Unexpected token }
description : SyntaxError: Unexpected token '}'
objectId : <objectId>
preview : {
description : SyntaxError: Unexpected token }
description : SyntaxError: Unexpected token '}'
overflow : false
properties : [
[0] : {
name : stack
type : string
value : SyntaxError: Unexpected token }
value : SyntaxError: Unexpected token '}'
}
[1] : {
name : message
type : string
value : Unexpected token }
value : Unexpected token '}'
}
]
subtype : error
......@@ -233,7 +233,7 @@ console.log(239)
executionContextId : <executionContextId>
lineNumber : 0
scriptId : <scriptId>
text : Uncaught SyntaxError: Unexpected token }
text : Uncaught SyntaxError: Unexpected token '}'
url : module4
}
timestamp : <timestamp>
......
......@@ -89,7 +89,7 @@ Running test: testRejectedPromiseWithSyntaxError
columnNumber : 5
exception : {
className : SyntaxError
description : SyntaxError: Unexpected token } at foo (<anonymous>:21:5) at throwSyntaxError (<anonymous>:23:3)
description : SyntaxError: Unexpected token '}' at foo (<anonymous>:21:5) at throwSyntaxError (<anonymous>:23:3)
objectId : <objectId>
subtype : error
type : object
......@@ -115,11 +115,11 @@ Running test: testRejectedPromiseWithSyntaxError
}
]
}
text : Uncaught (in promise) SyntaxError: Unexpected token }
text : Uncaught (in promise) SyntaxError: Unexpected token '}'
}
result : {
className : SyntaxError
description : SyntaxError: Unexpected token } at foo (<anonymous>:21:5) at throwSyntaxError (<anonymous>:23:3)
description : SyntaxError: Unexpected token '}' at foo (<anonymous>:21:5) at throwSyntaxError (<anonymous>:23:3)
objectId : <objectId>
subtype : error
type : object
......
......@@ -50,21 +50,21 @@ Check that exceptionThrown is supported by test runner.
columnNumber : 1
exception : {
className : SyntaxError
description : SyntaxError: Unexpected token }
description : SyntaxError: Unexpected token '}'
objectId : <objectId>
preview : {
description : SyntaxError: Unexpected token }
description : SyntaxError: Unexpected token '}'
overflow : false
properties : [
[0] : {
name : stack
type : string
value : SyntaxError: Unexpected token }
value : SyntaxError: Unexpected token '}'
}
[1] : {
name : message
type : string
value : Unexpected token }
value : Unexpected token '}'
}
]
subtype : error
......@@ -77,7 +77,7 @@ Check that exceptionThrown is supported by test runner.
executionContextId : <executionContextId>
lineNumber : 0
scriptId : <scriptId>
text : Uncaught SyntaxError: Unexpected token }
text : Uncaught SyntaxError: Unexpected token '}'
}
timestamp : <timestamp>
}
......
......@@ -7,7 +7,7 @@ Enabling Runtime Domain.
columnNumber : 12
exception : {
className : SyntaxError
description : SyntaxError: Unexpected token ;
description : SyntaxError: Unexpected token ';'
objectId : <objectId>
subtype : error
type : object
......@@ -16,7 +16,7 @@ Enabling Runtime Domain.
executionContextId : <executionContextId>
lineNumber : 1
scriptId : <scriptId>
text : Uncaught SyntaxError: Unexpected token ;
text : Uncaught SyntaxError: Unexpected token ';'
url : syntaxError.js
}
timestamp : <timestamp>
......
......@@ -24,7 +24,7 @@ Running test: testSyntaxErrorInScript
columnNumber : 1
exception : {
className : SyntaxError
description : SyntaxError: Unexpected token }
description : SyntaxError: Unexpected token '}'
objectId : <objectId>
subtype : error
type : object
......@@ -45,7 +45,7 @@ Running test: testSyntaxErrorInEvalInScript
columnNumber : 0
exception : {
className : SyntaxError
description : SyntaxError: Unexpected token } at boo.js:2:2
description : SyntaxError: Unexpected token '}' at boo.js:2:2
objectId : <objectId>
subtype : error
type : object
......@@ -68,7 +68,7 @@ Running test: testSyntaxErrorInEvalInScript
}
result : {
className : SyntaxError
description : SyntaxError: Unexpected token } at boo.js:2:2
description : SyntaxError: Unexpected token '}' at boo.js:2:2
objectId : <objectId>
subtype : error
type : object
......
*%(basename)s:7: SyntaxError: Unexpected token ...
*%(basename)s:7: SyntaxError: Unexpected token '...'
...x => 10
^^^
SyntaxError: Unexpected token ...
SyntaxError: Unexpected token '...'
*%(basename)s:7: SyntaxError: Unexpected token )
*%(basename)s:7: SyntaxError: Unexpected token ')'
function foo() { return(); }
^
SyntaxError: Unexpected token )
SyntaxError: Unexpected token ')'
*%(basename)s:5: SyntaxError: Unexpected token ...
*%(basename)s:5: SyntaxError: Unexpected token '...'
class C { ...[] }
^^^
SyntaxError: Unexpected token ...
\ No newline at end of file
SyntaxError: Unexpected token '...'
*%(basename)s:5: SyntaxError: Unexpected token ,
*%(basename)s:5: SyntaxError: Unexpected token ','
function foo(b, a, a,,) { return a }
^
SyntaxError: Unexpected token ,
SyntaxError: Unexpected token ','
*%(basename)s:7: SyntaxError: Unexpected token ...
*%(basename)s:7: SyntaxError: Unexpected token '...'
(x, ...y)
^^^
SyntaxError: Unexpected token ...
SyntaxError: Unexpected token '...'
*%(basename)s:7: SyntaxError: Unexpected token ]
*%(basename)s:7: SyntaxError: Unexpected token ']'
export class foo {[]};
^
SyntaxError: Unexpected token ]
SyntaxError: Unexpected token ']'
*%(basename)s:5: SyntaxError: Unexpected token )
*%(basename)s:5: SyntaxError: Unexpected token ')'
[().x] = 1
^
SyntaxError: Unexpected token )
SyntaxError: Unexpected token ')'
......@@ -21,7 +21,7 @@ function TryToLoadModule(filename, expect_error, token) {
if (expect_error) {
assertTrue(caught_error instanceof SyntaxError);
assertEquals("Unexpected token " + token, caught_error.message);
assertEquals("Unexpected token '" + token + "'", caught_error.message);
} else {
assertEquals(undefined, caught_error);
}
......
......@@ -16,10 +16,10 @@ PASS setterValue = undefined; (new A).someSetter = 789; setterValue is 789
PASS (new A).__proto__ is A.prototype
PASS A.prototype.constructor is A
PASS class threw exception SyntaxError: Unexpected end of input.
PASS class [ threw exception SyntaxError: Unexpected token [.
PASS class { threw exception SyntaxError: Unexpected token {.
PASS class [ threw exception SyntaxError: Unexpected token '['.
PASS class { threw exception SyntaxError: Unexpected token '{'.
PASS class X { threw exception SyntaxError: Unexpected end of input.
PASS class X { ( } threw exception SyntaxError: Unexpected token (.
PASS class X { ( } threw exception SyntaxError: Unexpected token '('.
PASS class X {} did not throw exception.
PASS class X { constructor() {} constructor() {} } threw exception SyntaxError: A class may only have one constructor.
PASS class X { get constructor() {} } threw exception SyntaxError: Class constructor may not be an accessor.
......
......@@ -52,10 +52,10 @@ shouldBe("(new A).__proto__", "A.prototype");
shouldBe("A.prototype.constructor", "A");
shouldThrow("class", "'SyntaxError: Unexpected end of input'");
shouldThrow("class [", "'SyntaxError: Unexpected token ['");
shouldThrow("class {", "'SyntaxError: Unexpected token {'");
shouldThrow("class [", '"SyntaxError: Unexpected token \'[\'"');
shouldThrow("class {", '"SyntaxError: Unexpected token \'{\'"');
shouldThrow("class X {", "'SyntaxError: Unexpected end of input'");
shouldThrow("class X { ( }", "'SyntaxError: Unexpected token ('");
shouldThrow("class X { ( }", '"SyntaxError: Unexpected token \'(\'"');
shouldNotThrow("class X {}");
shouldThrow("class X { constructor() {} constructor() {} }", "'SyntaxError: A class may only have one constructor'");
......
......@@ -17,7 +17,7 @@ PASS (new A).__proto__ is A.prototype
PASS A.prototype.constructor is A
PASS x = class threw exception SyntaxError: Unexpected end of input.
PASS x = class { threw exception SyntaxError: Unexpected end of input.
PASS x = class { ( } threw exception SyntaxError: Unexpected token (.
PASS x = class { ( } threw exception SyntaxError: Unexpected token '('.
PASS x = class {} did not throw exception.
PASS x = class { constructor() {} constructor() {} } threw exception SyntaxError: A class may only have one constructor.
PASS x = class { get constructor() {} } threw exception SyntaxError: Class constructor may not be an accessor.
......
......@@ -53,7 +53,7 @@ shouldBe("A.prototype.constructor", "A");
shouldThrow("x = class", "'SyntaxError: Unexpected end of input'");
shouldThrow("x = class {", "'SyntaxError: Unexpected end of input'");
shouldThrow("x = class { ( }", "'SyntaxError: Unexpected token ('");
shouldThrow("x = class { ( }", '"SyntaxError: Unexpected token \'(\'"');
shouldNotThrow("x = class {}");
shouldThrow("x = class { constructor() {} constructor() {} }", "'SyntaxError: A class may only have one constructor'");
......
......@@ -30,8 +30,8 @@ PASS x = class extends baseWithBadPrototype { constructor() { } } threw exceptio
PASS baseWithBadPrototype.prototype = "abc" did not throw exception.
PASS x = class extends baseWithBadPrototype { constructor() { } } threw exception TypeError: Class extends value does not have valid prototype property abc.
PASS baseWithBadPrototype.prototype = null; x = class extends baseWithBadPrototype { constructor() { } } did not throw exception.
PASS x = 1; c = class extends ++x { constructor() { } }; threw exception SyntaxError: Unexpected token ++.
PASS x = 1; c = class extends x++ { constructor() { } }; threw exception SyntaxError: Unexpected token ++.
PASS x = 1; c = class extends ++x { constructor() { } }; threw exception SyntaxError: Unexpected token '++'.
PASS x = 1; c = class extends x++ { constructor() { } }; threw exception SyntaxError: Unexpected token '++'.
PASS x = 1; c = class extends (++x) { constructor() { } }; threw exception TypeError: Class extends value 2 is not a constructor or null.
PASS x = 1; c = class extends (x++) { constructor() { } }; threw exception TypeError: Class extends value 1 is not a constructor or null.
PASS x = 1; try { c = class extends (++x) { constructor() { } } } catch (e) { }; x is 2
......@@ -45,7 +45,7 @@ PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = cl
PASS namespace = {}; namespace.A = class { constructor() { } }; function getClassA() { return namespace.A }; namespace.B = class extends getClassA() { constructor() { } } did not throw exception.
PASS namespace = {}; namespace.A = class { constructor() { } }; function getClass(prop) { return namespace[prop] }; namespace.B = class extends getClass("A") { constructor() { } } did not throw exception.
PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = class extends (false||null||namespace.A) { constructor() { } } did not throw exception.
PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = class extends false||null||namespace.A { constructor() { } } threw exception SyntaxError: Unexpected token ||.
PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = class extends false||null||namespace.A { constructor() { } } threw exception SyntaxError: Unexpected token '||'.
PASS x = 1; namespace = {}; namespace.A = class { constructor() { } }; namespace.B = class extends (x++, namespace.A) { constructor() { } }; did not throw exception.
PASS x = 1; namespace = {}; namespace.A = class { constructor() { } }; namespace.B = class extends (namespace.A, x++) { constructor() { } }; threw exception TypeError: Class extends value 1 is not a constructor or null.
PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = class extends new namespace.A { constructor() { } } threw exception TypeError: Class extends value [object Object] is not a constructor or null.
......
......@@ -6,10 +6,10 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
Class statement
PASS A threw exception ReferenceError: A is not defined.
PASS 'use strict'; A threw exception ReferenceError: A is not defined.
PASS class {} threw exception SyntaxError: Unexpected token {.
PASS 'use strict'; class {} threw exception SyntaxError: Unexpected token {.
PASS class { constructor() {} } threw exception SyntaxError: Unexpected token {.
PASS 'use strict'; class { constructor() {} } threw exception SyntaxError: Unexpected token {.
PASS class {} threw exception SyntaxError: Unexpected token '{'.
PASS 'use strict'; class {} threw exception SyntaxError: Unexpected token '{'.
PASS class { constructor() {} } threw exception SyntaxError: Unexpected token '{'.
PASS 'use strict'; class { constructor() {} } threw exception SyntaxError: Unexpected token '{'.
PASS class A { constructor() {} } did not throw exception.
PASS 'use strict'; class A { constructor() {} } did not throw exception.
PASS class A { constructor() {} }; A.toString() is 'class A { constructor() {} }'
......
......@@ -3,11 +3,11 @@ Tests for ES6 class syntax containing semicolon in the class body
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS class A { foo() ; { } } threw exception SyntaxError: Unexpected token ;.
PASS class A { get foo;() { } } threw exception SyntaxError: Unexpected token ;.
PASS class A { get foo() ; { } } threw exception SyntaxError: Unexpected token ;.
PASS class A { set foo;(x) { } } threw exception SyntaxError: Unexpected token ;.
PASS class A { set foo(x) ; { } } threw exception SyntaxError: Unexpected token ;.
PASS class A { foo() ; { } } threw exception SyntaxError: Unexpected token ';'.
PASS class A { get foo;() { } } threw exception SyntaxError: Unexpected token ';'.
PASS class A { get foo() ; { } } threw exception SyntaxError: Unexpected token ';'.
PASS class A { set foo;(x) { } } threw exception SyntaxError: Unexpected token ';'.
PASS class A { set foo(x) ; { } } threw exception SyntaxError: Unexpected token ';'.
PASS class A { ; } did not throw exception.
PASS class A { foo() { } ; } did not throw exception.
PASS class A { get foo() { } ; } did not throw exception.
......
......@@ -23,11 +23,11 @@
description('Tests for ES6 class syntax containing semicolon in the class body');
shouldThrow("class A { foo() ; { } }", "'SyntaxError: Unexpected token ;'");
shouldThrow("class A { get foo;() { } }", "'SyntaxError: Unexpected token ;'");
shouldThrow("class A { get foo() ; { } }", "'SyntaxError: Unexpected token ;'");
shouldThrow("class A { set foo;(x) { } }", "'SyntaxError: Unexpected token ;'");
shouldThrow("class A { set foo(x) ; { } }", "'SyntaxError: Unexpected token ;'");
shouldThrow("class A { foo() ; { } }", '"SyntaxError: Unexpected token \';\'"');
shouldThrow("class A { get foo;() { } }", '"SyntaxError: Unexpected token \';\'"');
shouldThrow("class A { get foo() ; { } }", '"SyntaxError: Unexpected token \';\'"');
shouldThrow("class A { set foo;(x) { } }", '"SyntaxError: Unexpected token \';\'"');
shouldThrow("class A { set foo(x) ; { } }", '"SyntaxError: Unexpected token \';\'"');
shouldNotThrow("class A { ; }");
shouldNotThrow("class A { foo() { } ; }");
......
......@@ -26,8 +26,8 @@ This test checks that the Function constructor detects some syntax errors correc
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
FAIL Function('(i + (j)') should throw SyntaxError: Expected token ')'. Threw exception SyntaxError: Unexpected token }.
FAIL Function('return (i + (j)') should throw SyntaxError: Expected token ')'. Threw exception SyntaxError: Unexpected token }.
FAIL Function('(i + (j)') should throw SyntaxError: Expected token ')'. Threw exception SyntaxError: Unexpected token '}'.
FAIL Function('return (i + (j)') should throw SyntaxError: Expected token ')'. Threw exception SyntaxError: Unexpected token '}'.
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -29,8 +29,8 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
PASS var foo = { 'bar' : 'YES' }; foo.bar is 'YES'
PASS var foo = { 'bar' : 'YES', }; foo.bar is 'YES'
PASS var foo = { 'bar' : 'YES' , }; foo.bar is 'YES'
PASS var foo = { , 'bar' : 'YES' }; foo.bar threw exception SyntaxError: Unexpected token ,.
PASS var foo = { 'bar' : 'YES',, }; foo.bar threw exception SyntaxError: Unexpected token ,.
PASS var foo = { , 'bar' : 'YES' }; foo.bar threw exception SyntaxError: Unexpected token ','.
PASS var foo = { 'bar' : 'YES',, }; foo.bar threw exception SyntaxError: Unexpected token ','.
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -42,11 +42,11 @@ PASS compileAndSerialize('a = { "\'": null }') is 'a = { "\'": null }'
PASS compileAndSerialize('a = { "\\"": null }') is 'a = { "\\"": null }'
PASS compileAndSerialize('a = { get x() { } }') is 'a = { get x() { } }'
PASS compileAndSerialize('a = { set x(y) { } }') is 'a = { set x(y) { } }'
PASS compileAndSerialize('a = { --1: null }') threw exception SyntaxError: Unexpected token --.
PASS compileAndSerialize('a = { -NaN: null }') threw exception SyntaxError: Unexpected token -.
PASS compileAndSerialize('a = { -0: null }') threw exception SyntaxError: Unexpected token -.
PASS compileAndSerialize('a = { -0.0: null }') threw exception SyntaxError: Unexpected token -.
PASS compileAndSerialize('a = { -Infinity: null }') threw exception SyntaxError: Unexpected token -.
PASS compileAndSerialize('a = { --1: null }') threw exception SyntaxError: Unexpected token '--'.
PASS compileAndSerialize('a = { -NaN: null }') threw exception SyntaxError: Unexpected token '-'.
PASS compileAndSerialize('a = { -0: null }') threw exception SyntaxError: Unexpected token '-'.
PASS compileAndSerialize('a = { -0.0: null }') threw exception SyntaxError: Unexpected token '-'.
PASS compileAndSerialize('a = { -Infinity: null }') threw exception SyntaxError: Unexpected token '-'.
PASS successfullyParsed is true
TEST COMPLETE
......
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