Commit 1c7e4639 authored by Adam Klein's avatar Adam Klein Committed by Commit Bot

[cleanup] Remove on-by-default --harmony-trailing-commas flag

This feature has been on by default without incident
since V8 5.8.

Bug: v8:5051
Change-Id: I1baf81922efd87e07448955147c50a5ba5a0aa42
Reviewed-on: https://chromium-review.googlesource.com/532214Reviewed-by: 's avatarDaniel Ehrenberg <littledan@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45881}
parent b29bfffd
...@@ -3922,7 +3922,6 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property) ...@@ -3922,7 +3922,6 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrictive_generators) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrictive_generators)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_trailing_commas)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_tostring) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_tostring)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_class_fields) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_class_fields)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_rest_spread) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_rest_spread)
......
...@@ -219,8 +219,6 @@ DEFINE_IMPLICATION(es_staging, harmony) ...@@ -219,8 +219,6 @@ DEFINE_IMPLICATION(es_staging, harmony)
#define HARMONY_SHIPPING_BASE(V) \ #define HARMONY_SHIPPING_BASE(V) \
V(harmony_restrictive_generators, \ V(harmony_restrictive_generators, \
"harmony restrictions on generator declarations") \ "harmony restrictions on generator declarations") \
V(harmony_trailing_commas, \
"harmony trailing commas in function parameter lists") \
V(harmony_object_rest_spread, "harmony object rest spread properties") V(harmony_object_rest_spread, "harmony object rest spread properties")
#ifdef V8_INTL_SUPPORT #ifdef V8_INTL_SUPPORT
......
...@@ -265,7 +265,6 @@ class ParserBase { ...@@ -265,7 +265,6 @@ class ParserBase {
allow_harmony_do_expressions_(false), allow_harmony_do_expressions_(false),
allow_harmony_function_sent_(false), allow_harmony_function_sent_(false),
allow_harmony_restrictive_generators_(false), allow_harmony_restrictive_generators_(false),
allow_harmony_trailing_commas_(false),
allow_harmony_class_fields_(false), allow_harmony_class_fields_(false),
allow_harmony_object_rest_spread_(false), allow_harmony_object_rest_spread_(false),
allow_harmony_dynamic_import_(false), allow_harmony_dynamic_import_(false),
...@@ -281,7 +280,6 @@ class ParserBase { ...@@ -281,7 +280,6 @@ class ParserBase {
ALLOW_ACCESSORS(harmony_do_expressions); ALLOW_ACCESSORS(harmony_do_expressions);
ALLOW_ACCESSORS(harmony_function_sent); ALLOW_ACCESSORS(harmony_function_sent);
ALLOW_ACCESSORS(harmony_restrictive_generators); ALLOW_ACCESSORS(harmony_restrictive_generators);
ALLOW_ACCESSORS(harmony_trailing_commas);
ALLOW_ACCESSORS(harmony_class_fields); ALLOW_ACCESSORS(harmony_class_fields);
ALLOW_ACCESSORS(harmony_object_rest_spread); ALLOW_ACCESSORS(harmony_object_rest_spread);
ALLOW_ACCESSORS(harmony_dynamic_import); ALLOW_ACCESSORS(harmony_dynamic_import);
...@@ -1570,7 +1568,6 @@ class ParserBase { ...@@ -1570,7 +1568,6 @@ class ParserBase {
bool allow_harmony_do_expressions_; bool allow_harmony_do_expressions_;
bool allow_harmony_function_sent_; bool allow_harmony_function_sent_;
bool allow_harmony_restrictive_generators_; bool allow_harmony_restrictive_generators_;
bool allow_harmony_trailing_commas_;
bool allow_harmony_class_fields_; bool allow_harmony_class_fields_;
bool allow_harmony_object_rest_spread_; bool allow_harmony_object_rest_spread_;
bool allow_harmony_dynamic_import_; bool allow_harmony_dynamic_import_;
...@@ -2028,8 +2025,7 @@ ParserBase<Impl>::ParseExpressionCoverGrammar(bool accept_IN, bool* ok) { ...@@ -2028,8 +2025,7 @@ ParserBase<Impl>::ParseExpressionCoverGrammar(bool accept_IN, bool* ok) {
scanner()->location(), MessageTemplate::kParamAfterRest); scanner()->location(), MessageTemplate::kParamAfterRest);
} }
if (allow_harmony_trailing_commas() && peek() == Token::RPAREN && if (peek() == Token::RPAREN && PeekAhead() == Token::ARROW) {
PeekAhead() == Token::ARROW) {
// a trailing comma is allowed at the end of an arrow parameter list // a trailing comma is allowed at the end of an arrow parameter list
break; break;
} }
...@@ -2768,7 +2764,7 @@ typename ParserBase<Impl>::ExpressionListT ParserBase<Impl>::ParseArguments( ...@@ -2768,7 +2764,7 @@ typename ParserBase<Impl>::ExpressionListT ParserBase<Impl>::ParseArguments(
classifier()->RecordAsyncArrowFormalParametersError( classifier()->RecordAsyncArrowFormalParametersError(
scanner()->location(), MessageTemplate::kParamAfterRest); scanner()->location(), MessageTemplate::kParamAfterRest);
} }
if (allow_harmony_trailing_commas() && peek() == Token::RPAREN) { if (peek() == Token::RPAREN) {
// allow trailing comma // allow trailing comma
done = true; done = true;
} }
...@@ -3748,7 +3744,7 @@ void ParserBase<Impl>::ParseFormalParameterList(FormalParametersT* parameters, ...@@ -3748,7 +3744,7 @@ void ParserBase<Impl>::ParseFormalParameterList(FormalParametersT* parameters,
break; break;
} }
if (!Check(Token::COMMA)) break; if (!Check(Token::COMMA)) break;
if (allow_harmony_trailing_commas() && peek() == Token::RPAREN) { if (peek() == Token::RPAREN) {
// allow the trailing comma // allow the trailing comma
break; break;
} }
......
...@@ -525,7 +525,6 @@ Parser::Parser(ParseInfo* info) ...@@ -525,7 +525,6 @@ Parser::Parser(ParseInfo* info)
set_allow_harmony_do_expressions(FLAG_harmony_do_expressions); set_allow_harmony_do_expressions(FLAG_harmony_do_expressions);
set_allow_harmony_function_sent(FLAG_harmony_function_sent); set_allow_harmony_function_sent(FLAG_harmony_function_sent);
set_allow_harmony_restrictive_generators(FLAG_harmony_restrictive_generators); set_allow_harmony_restrictive_generators(FLAG_harmony_restrictive_generators);
set_allow_harmony_trailing_commas(FLAG_harmony_trailing_commas);
set_allow_harmony_class_fields(FLAG_harmony_class_fields); set_allow_harmony_class_fields(FLAG_harmony_class_fields);
set_allow_harmony_object_rest_spread(FLAG_harmony_object_rest_spread); set_allow_harmony_object_rest_spread(FLAG_harmony_object_rest_spread);
set_allow_harmony_dynamic_import(FLAG_harmony_dynamic_import); set_allow_harmony_dynamic_import(FLAG_harmony_dynamic_import);
......
...@@ -294,7 +294,6 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { ...@@ -294,7 +294,6 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
SET_ALLOW(tailcalls); SET_ALLOW(tailcalls);
SET_ALLOW(harmony_do_expressions); SET_ALLOW(harmony_do_expressions);
SET_ALLOW(harmony_function_sent); SET_ALLOW(harmony_function_sent);
SET_ALLOW(harmony_trailing_commas);
SET_ALLOW(harmony_class_fields); SET_ALLOW(harmony_class_fields);
SET_ALLOW(harmony_object_rest_spread); SET_ALLOW(harmony_object_rest_spread);
SET_ALLOW(harmony_dynamic_import); SET_ALLOW(harmony_dynamic_import);
......
...@@ -1269,7 +1269,6 @@ enum ParserFlag { ...@@ -1269,7 +1269,6 @@ enum ParserFlag {
kAllowNatives, kAllowNatives,
kAllowHarmonyFunctionSent, kAllowHarmonyFunctionSent,
kAllowHarmonyRestrictiveGenerators, kAllowHarmonyRestrictiveGenerators,
kAllowHarmonyTrailingCommas,
kAllowHarmonyClassFields, kAllowHarmonyClassFields,
kAllowHarmonyObjectRestSpread, kAllowHarmonyObjectRestSpread,
kAllowHarmonyDynamicImport, kAllowHarmonyDynamicImport,
...@@ -1288,7 +1287,6 @@ void SetGlobalFlags(i::EnumSet<ParserFlag> flags) { ...@@ -1288,7 +1287,6 @@ void SetGlobalFlags(i::EnumSet<ParserFlag> flags) {
i::FLAG_harmony_function_sent = flags.Contains(kAllowHarmonyFunctionSent); i::FLAG_harmony_function_sent = flags.Contains(kAllowHarmonyFunctionSent);
i::FLAG_harmony_restrictive_generators = i::FLAG_harmony_restrictive_generators =
flags.Contains(kAllowHarmonyRestrictiveGenerators); flags.Contains(kAllowHarmonyRestrictiveGenerators);
i::FLAG_harmony_trailing_commas = flags.Contains(kAllowHarmonyTrailingCommas);
i::FLAG_harmony_class_fields = flags.Contains(kAllowHarmonyClassFields); i::FLAG_harmony_class_fields = flags.Contains(kAllowHarmonyClassFields);
i::FLAG_harmony_object_rest_spread = i::FLAG_harmony_object_rest_spread =
flags.Contains(kAllowHarmonyObjectRestSpread); flags.Contains(kAllowHarmonyObjectRestSpread);
...@@ -1304,8 +1302,6 @@ void SetParserFlags(i::PreParser* parser, i::EnumSet<ParserFlag> flags) { ...@@ -1304,8 +1302,6 @@ void SetParserFlags(i::PreParser* parser, i::EnumSet<ParserFlag> flags) {
flags.Contains(kAllowHarmonyFunctionSent)); flags.Contains(kAllowHarmonyFunctionSent));
parser->set_allow_harmony_restrictive_generators( parser->set_allow_harmony_restrictive_generators(
flags.Contains(kAllowHarmonyRestrictiveGenerators)); flags.Contains(kAllowHarmonyRestrictiveGenerators));
parser->set_allow_harmony_trailing_commas(
flags.Contains(kAllowHarmonyTrailingCommas));
parser->set_allow_harmony_class_fields( parser->set_allow_harmony_class_fields(
flags.Contains(kAllowHarmonyClassFields)); flags.Contains(kAllowHarmonyClassFields));
parser->set_allow_harmony_object_rest_spread( parser->set_allow_harmony_object_rest_spread(
...@@ -9230,9 +9226,7 @@ TEST(TrailingCommasInParameters) { ...@@ -9230,9 +9226,7 @@ TEST(TrailingCommasInParameters) {
}; };
// clang-format on // clang-format on
static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; RunParserSyncTest(context_data, data, kSuccess);
RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags,
arraysize(always_flags));
} }
TEST(TrailingCommasInParametersErrors) { TEST(TrailingCommasInParametersErrors) {
...@@ -9295,9 +9289,7 @@ TEST(TrailingCommasInParametersErrors) { ...@@ -9295,9 +9289,7 @@ TEST(TrailingCommasInParametersErrors) {
}; };
// clang-format on // clang-format on
static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; RunParserSyncTest(context_data, data, kError);
RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
arraysize(always_flags));
} }
TEST(ArgumentsRedeclaration) { TEST(ArgumentsRedeclaration) {
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// 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.
// Flags: --harmony-trailing-commas
function f1(a,) {} function f1(a,) {}
function f2(a,b,) {} function f2(a,b,) {}
function f3(a,b,c,) {} function f3(a,b,c,) {}
......
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