Remove always-on --harmony-rest-parameters flag

It shipped in Chrome 47.

Review URL: https://codereview.chromium.org/1519073004

Cr-Commit-Position: refs/heads/master@{#32816}
This commit is contained in:
adamk 2015-12-11 16:00:13 -08:00 committed by Commit bot
parent ebdd90142b
commit 5ceb4feca3
36 changed files with 32 additions and 81 deletions

View File

@ -2102,7 +2102,6 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_array_includes)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy_function)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy_let)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_rest_parameters)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_default_parameters)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_destructuring_bind)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_destructuring_assignment)
@ -2633,7 +2632,6 @@ bool Genesis::InstallExperimentalNatives() {
static const char* harmony_sloppy_function_natives[] = {nullptr};
static const char* harmony_sloppy_let_natives[] = {nullptr};
static const char* harmony_unicode_regexps_natives[] = {nullptr};
static const char* harmony_rest_parameters_natives[] = {nullptr};
static const char* harmony_default_parameters_natives[] = {nullptr};
static const char* harmony_reflect_natives[] = {"native harmony-reflect.js",
nullptr};

View File

@ -222,7 +222,6 @@ DEFINE_IMPLICATION(es_staging, harmony_destructuring_assignment)
V(harmony_array_includes, "harmony Array.prototype.includes") \
V(harmony_default_parameters, "harmony default parameters") \
V(harmony_destructuring_bind, "harmony destructuring bind") \
V(harmony_rest_parameters, "harmony rest parameters") \
V(harmony_concat_spreadable, "harmony isConcatSpreadable") \
V(harmony_tolength, "harmony ToLength") \
V(harmony_tostring, "harmony toString") \

View File

@ -111,7 +111,6 @@ class ParserBase : public Traits {
allow_harmony_sloppy_(false),
allow_harmony_sloppy_function_(false),
allow_harmony_sloppy_let_(false),
allow_harmony_rest_parameters_(false),
allow_harmony_default_parameters_(false),
allow_harmony_destructuring_bind_(false),
allow_harmony_destructuring_assignment_(false),
@ -128,7 +127,6 @@ class ParserBase : public Traits {
ALLOW_ACCESSORS(harmony_sloppy);
ALLOW_ACCESSORS(harmony_sloppy_function);
ALLOW_ACCESSORS(harmony_sloppy_let);
ALLOW_ACCESSORS(harmony_rest_parameters);
ALLOW_ACCESSORS(harmony_default_parameters);
ALLOW_ACCESSORS(harmony_destructuring_bind);
ALLOW_ACCESSORS(harmony_destructuring_assignment);
@ -916,7 +914,6 @@ class ParserBase : public Traits {
bool allow_harmony_sloppy_;
bool allow_harmony_sloppy_function_;
bool allow_harmony_sloppy_let_;
bool allow_harmony_rest_parameters_;
bool allow_harmony_default_parameters_;
bool allow_harmony_destructuring_bind_;
bool allow_harmony_destructuring_assignment_;
@ -1329,7 +1326,7 @@ ParserBase<Traits>::ParsePrimaryExpression(ExpressionClassifier* classifier,
MessageTemplate::kUnexpectedToken,
Token::String(Token::RPAREN));
return factory()->NewEmptyParentheses(beg_pos);
} else if (allow_harmony_rest_parameters() && Check(Token::ELLIPSIS)) {
} else if (Check(Token::ELLIPSIS)) {
// (...x)=>x. The continuation that looks for the => is in
// ParseAssignmentExpression.
int ellipsis_pos = position();
@ -1464,7 +1461,7 @@ typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseExpression(
}
Consume(Token::COMMA);
bool is_rest = false;
if (allow_harmony_rest_parameters() && peek() == Token::ELLIPSIS) {
if (peek() == Token::ELLIPSIS) {
// 'x, y, ...z' in CoverParenthesizedExpressionAndArrowParameterList only
// as the formal parameters of'(x, y, ...z) => foo', and is not itself a
// valid expression or binding pattern.
@ -2930,8 +2927,7 @@ void ParserBase<Traits>::ParseFormalParameterList(
*ok = false;
return;
}
parameters->has_rest =
allow_harmony_rest_parameters() && Check(Token::ELLIPSIS);
parameters->has_rest = Check(Token::ELLIPSIS);
ParseFormalParameter(parameters, classifier, ok);
if (!*ok) return;
} while (!parameters->has_rest && Check(Token::COMMA));

View File

@ -926,7 +926,6 @@ Parser::Parser(ParseInfo* info)
set_allow_harmony_sloppy(FLAG_harmony_sloppy);
set_allow_harmony_sloppy_function(FLAG_harmony_sloppy_function);
set_allow_harmony_sloppy_let(FLAG_harmony_sloppy_let);
set_allow_harmony_rest_parameters(FLAG_harmony_rest_parameters);
set_allow_harmony_default_parameters(FLAG_harmony_default_parameters);
set_allow_harmony_destructuring_bind(FLAG_harmony_destructuring_bind);
set_allow_harmony_destructuring_assignment(
@ -4905,7 +4904,6 @@ PreParser::PreParseResult Parser::ParseLazyFunctionBodyWithPreParser(
SET_ALLOW(natives);
SET_ALLOW(harmony_sloppy);
SET_ALLOW(harmony_sloppy_let);
SET_ALLOW(harmony_rest_parameters);
SET_ALLOW(harmony_default_parameters);
SET_ALLOW(harmony_destructuring_bind);
SET_ALLOW(strong_mode);

View File

@ -1392,9 +1392,6 @@ void ParserTraits::AddFormalParameter(ParserFormalParameters* parameters,
bool is_rest) {
bool is_simple =
!is_rest && pattern->IsVariableProxy() && initializer == nullptr;
DCHECK(parser_->allow_harmony_destructuring_bind() ||
parser_->allow_harmony_rest_parameters() ||
parser_->allow_harmony_default_parameters() || is_simple);
const AstRawString* name = is_simple
? pattern->AsVariableProxy()->raw_name()
: parser_->ast_value_factory()->empty_string();

View File

@ -35,7 +35,6 @@ TEST(ArgumentsUnmapped) {
TEST(ArgumentsRest) {
FLAG_harmony_rest_parameters = true;
FunctionTester T("(function(a, ...args) { return args; })");
Handle<Object> arguments;

View File

@ -1504,7 +1504,6 @@ enum ParserFlag {
kAllowLazy,
kAllowNatives,
kAllowHarmonyDefaultParameters,
kAllowHarmonyRestParameters,
kAllowHarmonySloppy,
kAllowHarmonySloppyLet,
kAllowHarmonyDestructuring,
@ -1528,8 +1527,6 @@ void SetParserFlags(i::ParserBase<Traits>* parser,
parser->set_allow_natives(flags.Contains(kAllowNatives));
parser->set_allow_harmony_default_parameters(
flags.Contains(kAllowHarmonyDefaultParameters));
parser->set_allow_harmony_rest_parameters(
flags.Contains(kAllowHarmonyRestParameters));
parser->set_allow_harmony_sloppy(flags.Contains(kAllowHarmonySloppy));
parser->set_allow_harmony_sloppy_let(flags.Contains(kAllowHarmonySloppyLet));
parser->set_allow_harmony_destructuring_bind(
@ -3687,9 +3684,7 @@ TEST(ErrorsArrowFormalParameters) {
nullptr
};
static const ParserFlag always_flags[] = {kAllowHarmonyRestParameters};
RunParserSyncTest(context_data, assignment_expression_suffix_data, kError,
NULL, 0, always_flags, arraysize(always_flags));
RunParserSyncTest(context_data, assignment_expression_suffix_data, kError);
}
@ -3881,7 +3876,6 @@ TEST(NoErrorsArrowFunctions) {
};
static const ParserFlag always_flags[] = {kAllowHarmonyDefaultParameters,
kAllowHarmonyRestParameters,
kAllowHarmonyDestructuring};
RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
always_flags, arraysize(always_flags));
@ -3988,7 +3982,6 @@ TEST(ArrowFunctionsYieldParameterNameInGenerator) {
};
static const ParserFlag always_flags[] = { kAllowHarmonyDestructuring,
kAllowHarmonyRestParameters,
kAllowStrongMode};
RunParserSyncTest(sloppy_function_context_data, arrow_data, kSuccess, NULL, 0,
always_flags, arraysize(always_flags));
@ -5315,9 +5308,7 @@ TEST(ParseRestParameters) {
"...\t\n\t\t\n args",
"a, ... \n \n args",
NULL};
static const ParserFlag always_flags[] = {kAllowHarmonyRestParameters};
RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(context_data, data, kSuccess);
}
@ -5347,9 +5338,7 @@ TEST(ParseRestParametersErrors) {
"a,\ra, ...args",
"a,\na, ...args",
NULL};
static const ParserFlag always_flags[] = {kAllowHarmonyRestParameters};
RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(context_data, data, kError);
}
@ -5364,8 +5353,7 @@ TEST(RestParameterInSetterMethodError) {
{nullptr, nullptr}};
const char* data[] = {"...a", "...arguments", "...eval", nullptr};
static const ParserFlag always_flags[] = {kAllowHarmonyRestParameters,
kAllowHarmonySloppy};
static const ParserFlag always_flags[] = {kAllowHarmonySloppy};
RunParserSyncTest(context_data, data, kError, nullptr, 0, always_flags,
arraysize(always_flags));
}
@ -5388,15 +5376,11 @@ TEST(RestParametersEvalArguments) {
"arguments, ...args",
NULL};
static const ParserFlag always_flags[] = {kAllowHarmonyRestParameters};
// Fail in strict mode
RunParserSyncTest(strict_context_data, data, kError, NULL, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(strict_context_data, data, kError);
// OK in sloppy mode
RunParserSyncTest(sloppy_context_data, data, kSuccess, NULL, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(sloppy_context_data, data, kSuccess);
}
@ -5415,12 +5399,9 @@ TEST(RestParametersDuplicateEvalArguments) {
"arguments, arguments, ...args",
NULL};
static const ParserFlag always_flags[] = {kAllowHarmonyRestParameters};
// In strict mode, the error is using "eval" or "arguments" as parameter names
// In sloppy mode, the error is that eval / arguments are duplicated
RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(context_data, data, kError);
}
@ -6254,8 +6235,7 @@ TEST(StrongConstructorDirective) {
"foo() { \"use strong\" } constructor() {}", NULL};
static const ParserFlag always_flags[] = {
kAllowHarmonyRestParameters, kAllowHarmonySloppy, kAllowHarmonySloppyLet,
kAllowStrongMode};
kAllowHarmonySloppy, kAllowHarmonySloppyLet, kAllowStrongMode};
RunParserSyncTest(context_data, error_data, kError, NULL, 0, always_flags,
arraysize(always_flags));
@ -7187,9 +7167,7 @@ TEST(DestructuringDisallowPatternsInSingleParamArrows) {
TEST(DestructuringDisallowPatternsInRestParams) {
i::FLAG_harmony_destructuring_bind = true;
i::FLAG_harmony_rest_parameters = true;
static const ParserFlag always_flags[] = {kAllowHarmonyRestParameters,
kAllowHarmonyDestructuring};
static const ParserFlag always_flags[] = {kAllowHarmonyDestructuring};
const char* context_data[][2] = {{"'use strict';", ""},
{"function outer() { 'use strict';", "}"},
{"", ""},
@ -7551,7 +7529,7 @@ TEST(LanguageModeDirectivesNonSimpleParameterListErrors) {
static const ParserFlag always_flags[] = {
kAllowHarmonyDefaultParameters, kAllowHarmonyDestructuring,
kAllowHarmonyRestParameters, kAllowHarmonySloppy, kAllowStrongMode};
kAllowHarmonySloppy, kAllowStrongMode};
RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
arraysize(always_flags));
}

View File

@ -13,7 +13,6 @@
"path": ["RestParameters"],
"main": "run.js",
"resources": ["rest.js"],
"flags": ["--harmony-rest-parameters"],
"run_count": 5,
"units": "score",
"results_regexp": "^%s\\-RestParameters\\(Score\\): (.+)$",

View File

@ -2,6 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Flags: --harmony-rest-parameters
//
...x => 10

View File

@ -2,6 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Flags: --harmony-rest-parameters
//
function foo() { return(); }

View File

@ -2,6 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Flags: --harmony-rest-parameters
//
(w, ...x, y) => 10

View File

@ -2,6 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Flags: --harmony-rest-parameters
//
(...x, y) => 10

View File

@ -2,6 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Flags: --harmony-rest-parameters
//
(w, ...x, ...y) => 10

View File

@ -2,6 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Flags: --harmony-rest-parameters
//
function foo(...b, a) { return a }

View File

@ -2,6 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Flags: --harmony-rest-parameters
//
(x, ...y, z)

View File

@ -2,6 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Flags: --harmony-rest-parameters
//
(x, ...y)

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Flags: --harmony-rest-parameters
//
'use strict';
var _bad = "setting this should fail!";

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Flags: --harmony-rest-parameters
//
var _bad = "this should fail!";
({

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Flags: --harmony-rest-parameters
//
'use strict';
var _bad = "this should fail!";

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-rest-parameters
// Flags: --min-preparse-length=0
(function testRestIndex() {

View File

@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-rest-parameters
(function testRestIndex() {
assertEquals(5, ((...args) => args.length)(1,2,3,4,5));
assertEquals(4, ((a, ...args) => args.length)(1,2,3,4,5));

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-reflect --harmony-destructuring-bind --harmony-rest-parameters
// Flags: --harmony-reflect --harmony-destructuring-bind
(function TestClass() {

View File

@ -1,8 +1,6 @@
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Flags: --harmony-rest-parameters
assertThrows("()=>{}()", SyntaxError);
assertThrows("x=>{}()", SyntaxError);

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-rest-parameters
// Flags: --allow-natives-syntax
var f = (a, b, ...c) => {

View File

@ -2,6 +2,4 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-rest-parameters
(function(...a) { function f() { eval() } })();

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-rest-parameters
// Flags: --min-preparse-length=0
function variadic(co, ...values) {

View File

@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-rest-parameters
(function testRestIndex() {
assertEquals(5, (function(...args) { return args.length; })(1,2,3,4,5));
assertEquals(4, (function(a, ...args) { return args.length; })(1,2,3,4,5));

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-sloppy --harmony-rest-parameters
// Flags: --harmony-sloppy
(function testConstructClassStrict() {

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-sloppy --harmony-rest-parameters
// Flags: --harmony-sloppy
(function testCallSuperPropertyStrict() {
"use strict";

View File

@ -3,7 +3,7 @@
// found in the LICENSE file.
// Flags: --allow-natives-syntax
// Flags: --harmony-destructuring-bind --harmony-rest-parameters --harmony-sloppy
// Flags: --harmony-destructuring-bind --harmony-sloppy
(function TestSuperNamedLoads() {
function Base() { }

View File

@ -4,7 +4,6 @@
// Flags: --no-legacy-const --harmony-sloppy --harmony-sloppy-let
// Flags: --harmony-sloppy-function --harmony-destructuring-bind
// Flags: --harmony-rest-parameters
// Test Annex B 3.3 semantics for functions declared in blocks in sloppy mode.
// http://www.ecma-international.org/ecma-262/6.0/#sec-block-level-function-declarations-web-legacy-compatibility-semantics

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-default-parameters --harmony-rest-parameters
// Flags: --harmony-default-parameters
(function TestDefaults() {

View File

@ -3,7 +3,7 @@
// found in the LICENSE file.
//
// Flags: --harmony-destructuring-bind
// Flags: --harmony-default-parameters --harmony-rest-parameters
// Flags: --harmony-default-parameters
(function TestObjectLiteralPattern() {
var { x : x, y : y, get, set } = { x : 1, y : 2, get: 3, set: 4 };

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --strong-mode --harmony-rest-parameters
// Flags: --strong-mode
// Note that it's essential for these tests that the reference is inside dead
// code (because we already produce ReferenceErrors for run-time unresolved

View File

@ -3,7 +3,7 @@
// found in the LICENSE file.
// Flags: --strong-mode --harmony-reflect
// Flags: --harmony-rest-parameters --allow-natives-syntax
// Flags: --allow-natives-syntax
'use strict';

View File

@ -3,7 +3,6 @@
// found in the LICENSE file.
// Flags: --strong-mode --allow-natives-syntax
// Flags: --harmony-rest-parameters
// Flags: --harmony-destructuring-bind
'use strict';