Enable --harmony-trailing-commas
Also updated some tests due to the change. The general pattern is when a trailing comma is expected to cause a SyntaxError, an additional comma was added. BUG=v8:5051 CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel Review-Url: https://codereview.chromium.org/2638513002 Cr-Commit-Position: refs/heads/master@{#42826}
This commit is contained in:
parent
639bf4aa9c
commit
ea96fdec68
@ -212,12 +212,12 @@ DEFINE_IMPLICATION(es_staging, move_object_start)
|
||||
V(harmony_restrictive_generators, \
|
||||
"harmony restrictions on generator declarations") \
|
||||
V(harmony_tailcalls, "harmony tail calls") \
|
||||
V(harmony_trailing_commas, \
|
||||
"harmony trailing commas in function parameter lists") \
|
||||
V(harmony_object_rest_spread, "harmony object rest spread properties")
|
||||
|
||||
// Features that are shipping (turned on by default, but internal flag remains).
|
||||
#define HARMONY_SHIPPING_BASE(V)
|
||||
#define HARMONY_SHIPPING_BASE(V) \
|
||||
V(harmony_trailing_commas, \
|
||||
"harmony trailing commas in function parameter lists")
|
||||
|
||||
#ifdef V8_I18N_SUPPORT
|
||||
#define HARMONY_SHIPPING(V) \
|
||||
|
@ -2,4 +2,4 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
function foo(b, a, a,) { return a }
|
||||
function foo(b, a, a,,) { return a }
|
||||
|
@ -1,4 +1,4 @@
|
||||
*%(basename)s:5: SyntaxError: Unexpected token )
|
||||
function foo(b, a, a,) { return a }
|
||||
*%(basename)s:5: SyntaxError: Unexpected token ,
|
||||
function foo(b, a, a,,) { return a }
|
||||
^
|
||||
SyntaxError: Unexpected token )
|
||||
SyntaxError: Unexpected token ,
|
||||
|
@ -38,9 +38,9 @@ function assertSyntaxError(x) {
|
||||
|
||||
|
||||
assertSyntaxError("f(,)");
|
||||
assertSyntaxError("f(1,)");
|
||||
assertSyntaxError("f(1,2,)");
|
||||
assertSyntaxError("f(1,,)");
|
||||
assertSyntaxError("f(1,2,,)");
|
||||
|
||||
assertSyntaxError("function f(,) {}");
|
||||
assertSyntaxError("function f(1,) {}");
|
||||
assertSyntaxError("function f(1,2,) {}");
|
||||
assertSyntaxError("function f(1,,) {}");
|
||||
assertSyntaxError("function f(1,2,,) {}");
|
||||
|
@ -34,12 +34,14 @@ assertThrows('Function("});(function(){");', SyntaxError);
|
||||
// Test whether block comments are handled correctly.
|
||||
assertDoesNotThrow('Function("/*", "*/", "/**/");');
|
||||
assertDoesNotThrow('Function("/*", "a", "*/", "/**/");');
|
||||
assertThrows('Function("a", "/*", "*/", "/**/");', SyntaxError);
|
||||
assertDoesNotThrow('Function("a", "/*", "*/", "/**/");');
|
||||
assertThrows('Function("a", "/*", "*/", "b", "/*", "*/", "/**/");', SyntaxError);
|
||||
|
||||
// Test whether line comments are handled correctly.
|
||||
assertDoesNotThrow('Function("//", "//")');
|
||||
assertDoesNotThrow('Function("//", "//", "//")');
|
||||
assertThrows('Function("a", "//", "//")', SyntaxError);
|
||||
assertDoesNotThrow('Function("a", "//", "//")');
|
||||
assertThrows('Function("a", "", "//", "//")', SyntaxError);
|
||||
|
||||
// Some embedders rely on the string representation of the resulting
|
||||
// function in cases where no formal parameters are specified.
|
||||
|
@ -341,28 +341,6 @@
|
||||
'built-ins/Number/S9.3.1_A3_T1_U180E': [FAIL],
|
||||
'built-ins/Number/S9.3.1_A2_U180E': [FAIL],
|
||||
|
||||
# https://bugs.chromium.org/p/v8/issues/detail?id=5051
|
||||
'language/expressions/arrow-function/params-trailing-comma': ['--harmony-trailing-commas'],
|
||||
'language/expressions/arrow-function/params-trailing-comma-length': ['--harmony-trailing-commas'],
|
||||
'language/expressions/call/trailing-comma': ['--harmony-trailing-commas'],
|
||||
'language/expressions/function/params-trailing-comma': ['--harmony-trailing-commas'],
|
||||
'language/expressions/function/params-trailing-comma-arguments': ['--harmony-trailing-commas'],
|
||||
'language/expressions/function/params-trailing-comma-length': ['--harmony-trailing-commas'],
|
||||
'language/expressions/generators/params-trailing-comma': ['--harmony-trailing-commas'],
|
||||
'language/expressions/generators/params-trailing-comma-arguments': ['--harmony-trailing-commas'],
|
||||
'language/expressions/generators/params-trailing-comma-length': ['--harmony-trailing-commas'],
|
||||
'language/expressions/object/method-definition/params-trailing-comma': ['--harmony-trailing-commas'],
|
||||
'language/expressions/object/method-definition/params-trailing-comma-arguments': ['--harmony-trailing-commas'],
|
||||
'language/expressions/object/method-definition/params-trailing-comma-length': ['--harmony-trailing-commas'],
|
||||
'language/statements/class/definition/params-trailing-comma': ['--harmony-trailing-commas'],
|
||||
'language/statements/class/definition/params-trailing-comma-arguments': ['--harmony-trailing-commas'],
|
||||
'language/statements/class/definition/params-trailing-comma-length': ['--harmony-trailing-commas'],
|
||||
'language/statements/function/params-trailing-comma': ['--harmony-trailing-commas'],
|
||||
'language/statements/function/params-trailing-comma-arguments': ['--harmony-trailing-commas'],
|
||||
'language/statements/function/params-trailing-comma-length': ['--harmony-trailing-commas'],
|
||||
'language/statements/generators/params-trailing-comma': ['--harmony-trailing-commas'],
|
||||
'language/statements/generators/params-trailing-comma-length': ['--harmony-trailing-commas'],
|
||||
|
||||
# https://bugs.chromium.org/p/v8/issues/detail?id=4698
|
||||
'language/expressions/call/tco-call-args': ['--harmony-tailcalls'],
|
||||
'language/expressions/call/tco-member-args': ['--harmony-tailcalls'],
|
||||
|
@ -143,8 +143,8 @@ PASS Invalid: "a(5"
|
||||
PASS Invalid: "function f() { a(5 }"
|
||||
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 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) {} }"
|
||||
PASS Invalid: "function f(a,) {}"
|
||||
PASS Invalid: "function f() { function f(a,) {} }"
|
||||
FAIL Invalid: "function f(a,) {}" should throw undefined
|
||||
FAIL Invalid: "function f() { function f(a,) {} }" should throw undefined
|
||||
PASS Invalid: "function f(a,"
|
||||
PASS Invalid: "function f() { function f(a, }"
|
||||
PASS Invalid: "function f(a, 1) {}"
|
||||
|
Loading…
Reference in New Issue
Block a user