Commit dea95594 authored by adamk's avatar adamk Committed by Commit bot

Remove destructuring and default arguments runtime flags

These flags have been on by default since version 4.9, which has been
in stable Chrome for over a week now, demonstrating that they're
here to stay.

Also moved the tests out of harmony/ and into es6/.

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

Cr-Commit-Position: refs/heads/master@{#34692}
parent cd6a5a45
...@@ -2265,9 +2265,6 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_modules) ...@@ -2265,9 +2265,6 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_modules)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy_function) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy_function)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy_let) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy_let)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_default_parameters)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_destructuring_bind)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_destructuring_assignment)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_observe) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_observe)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexps) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexps)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_unicode_regexps) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_unicode_regexps)
...@@ -2970,11 +2967,8 @@ bool Genesis::InstallExperimentalNatives() { ...@@ -2970,11 +2967,8 @@ bool Genesis::InstallExperimentalNatives() {
static const char* harmony_tailcalls_natives[] = {nullptr}; static const char* harmony_tailcalls_natives[] = {nullptr};
static const char* harmony_unicode_regexps_natives[] = { static const char* harmony_unicode_regexps_natives[] = {
"native harmony-unicode-regexps.js", nullptr}; "native harmony-unicode-regexps.js", nullptr};
static const char* harmony_default_parameters_natives[] = {nullptr};
static const char* harmony_reflect_natives[] = {"native harmony-reflect.js", static const char* harmony_reflect_natives[] = {"native harmony-reflect.js",
nullptr}; nullptr};
static const char* harmony_destructuring_bind_natives[] = {nullptr};
static const char* harmony_destructuring_assignment_natives[] = {nullptr};
static const char* harmony_object_observe_natives[] = { static const char* harmony_object_observe_natives[] = {
"native harmony-object-observe.js", nullptr}; "native harmony-object-observe.js", nullptr};
static const char* harmony_sharedarraybuffer_natives[] = { static const char* harmony_sharedarraybuffer_natives[] = {
......
...@@ -221,9 +221,6 @@ DEFINE_IMPLICATION(es_staging, harmony_tailcalls) ...@@ -221,9 +221,6 @@ DEFINE_IMPLICATION(es_staging, harmony_tailcalls)
// Features that are shipping (turned on by default, but internal flag remains). // Features that are shipping (turned on by default, but internal flag remains).
#define HARMONY_SHIPPING(V) \ #define HARMONY_SHIPPING(V) \
V(harmony_default_parameters, "harmony default parameters") \
V(harmony_destructuring_assignment, "harmony destructuring assignment") \
V(harmony_destructuring_bind, "harmony destructuring bind") \
V(harmony_function_name, "harmony Function name inference") \ V(harmony_function_name, "harmony Function name inference") \
V(harmony_iterator_close, "harmony iterator finalization") \ V(harmony_iterator_close, "harmony iterator finalization") \
V(harmony_tostring, "harmony toString") \ V(harmony_tostring, "harmony toString") \
...@@ -265,10 +262,6 @@ HARMONY_SHIPPING(FLAG_SHIPPING_FEATURES) ...@@ -265,10 +262,6 @@ HARMONY_SHIPPING(FLAG_SHIPPING_FEATURES)
DEFINE_IMPLICATION(harmony_sloppy_let, harmony_sloppy) DEFINE_IMPLICATION(harmony_sloppy_let, harmony_sloppy)
DEFINE_IMPLICATION(harmony_sloppy_function, harmony_sloppy) DEFINE_IMPLICATION(harmony_sloppy_function, harmony_sloppy)
// Destructuring shares too much parsing architecture with default parameters
// to be enabled on its own.
DEFINE_IMPLICATION(harmony_destructuring_bind, harmony_default_parameters)
// Flags for experimental implementation features. // Flags for experimental implementation features.
DEFINE_BOOL(compiled_keyed_generic_loads, false, DEFINE_BOOL(compiled_keyed_generic_loads, false,
"use optimizing compiler to generate keyed generic load stubs") "use optimizing compiler to generate keyed generic load stubs")
......
...@@ -111,9 +111,6 @@ class ParserBase : public Traits { ...@@ -111,9 +111,6 @@ class ParserBase : public Traits {
allow_harmony_sloppy_(false), allow_harmony_sloppy_(false),
allow_harmony_sloppy_function_(false), allow_harmony_sloppy_function_(false),
allow_harmony_sloppy_let_(false), allow_harmony_sloppy_let_(false),
allow_harmony_default_parameters_(false),
allow_harmony_destructuring_bind_(false),
allow_harmony_destructuring_assignment_(false),
allow_harmony_restrictive_declarations_(false), allow_harmony_restrictive_declarations_(false),
allow_legacy_const_(true), allow_legacy_const_(true),
allow_harmony_do_expressions_(false), allow_harmony_do_expressions_(false),
...@@ -129,9 +126,6 @@ class ParserBase : public Traits { ...@@ -129,9 +126,6 @@ class ParserBase : public Traits {
ALLOW_ACCESSORS(harmony_sloppy); ALLOW_ACCESSORS(harmony_sloppy);
ALLOW_ACCESSORS(harmony_sloppy_function); ALLOW_ACCESSORS(harmony_sloppy_function);
ALLOW_ACCESSORS(harmony_sloppy_let); ALLOW_ACCESSORS(harmony_sloppy_let);
ALLOW_ACCESSORS(harmony_default_parameters);
ALLOW_ACCESSORS(harmony_destructuring_bind);
ALLOW_ACCESSORS(harmony_destructuring_assignment);
ALLOW_ACCESSORS(harmony_restrictive_declarations); ALLOW_ACCESSORS(harmony_restrictive_declarations);
ALLOW_ACCESSORS(legacy_const); ALLOW_ACCESSORS(legacy_const);
ALLOW_ACCESSORS(harmony_do_expressions); ALLOW_ACCESSORS(harmony_do_expressions);
...@@ -925,9 +919,6 @@ class ParserBase : public Traits { ...@@ -925,9 +919,6 @@ class ParserBase : public Traits {
bool allow_harmony_sloppy_; bool allow_harmony_sloppy_;
bool allow_harmony_sloppy_function_; bool allow_harmony_sloppy_function_;
bool allow_harmony_sloppy_let_; bool allow_harmony_sloppy_let_;
bool allow_harmony_default_parameters_;
bool allow_harmony_destructuring_bind_;
bool allow_harmony_destructuring_assignment_;
bool allow_harmony_restrictive_declarations_; bool allow_harmony_restrictive_declarations_;
bool allow_legacy_const_; bool allow_legacy_const_;
bool allow_harmony_do_expressions_; bool allow_harmony_do_expressions_;
...@@ -1263,15 +1254,9 @@ ParserBase<Traits>::ParsePrimaryExpression(ExpressionClassifier* classifier, ...@@ -1263,15 +1254,9 @@ ParserBase<Traits>::ParsePrimaryExpression(ExpressionClassifier* classifier,
return this->ParseRegExpLiteral(false, classifier, ok); return this->ParseRegExpLiteral(false, classifier, ok);
case Token::LBRACK: case Token::LBRACK:
if (!allow_harmony_destructuring_bind()) {
BindingPatternUnexpectedToken(classifier);
}
return this->ParseArrayLiteral(classifier, ok); return this->ParseArrayLiteral(classifier, ok);
case Token::LBRACE: case Token::LBRACE:
if (!allow_harmony_destructuring_bind()) {
BindingPatternUnexpectedToken(classifier);
}
return this->ParseObjectLiteral(classifier, ok); return this->ParseObjectLiteral(classifier, ok);
case Token::LPAREN: { case Token::LPAREN: {
...@@ -1973,23 +1958,10 @@ ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN, ...@@ -1973,23 +1958,10 @@ ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN,
// Now pending non-pattern expressions must be discarded. // Now pending non-pattern expressions must be discarded.
arrow_formals_classifier.Discard(); arrow_formals_classifier.Discard();
if (!(allow_harmony_destructuring_bind() || if (IsValidPattern(expression) && peek() == Token::ASSIGN) {
allow_harmony_default_parameters())) {
BindingPatternUnexpectedToken(classifier);
}
if (allow_harmony_destructuring_assignment() && IsValidPattern(expression) &&
peek() == Token::ASSIGN) {
classifier->ForgiveCoverInitializedNameError(); classifier->ForgiveCoverInitializedNameError();
ValidateAssignmentPattern(classifier, CHECK_OK); ValidateAssignmentPattern(classifier, CHECK_OK);
is_destructuring_assignment = true; is_destructuring_assignment = true;
} else if (allow_harmony_default_parameters() &&
!allow_harmony_destructuring_assignment()) {
// TODO(adamk): This branch should be removed once the destructuring
// assignment and default parameter flags are removed.
expression = this->ClassifyAndRewriteReferenceExpression(
classifier, expression, lhs_beg_pos, scanner()->location().end_pos,
MessageTemplate::kInvalidLhsInAssignment);
} else { } else {
expression = this->CheckAndRewriteReferenceExpression( expression = this->CheckAndRewriteReferenceExpression(
expression, lhs_beg_pos, scanner()->location().end_pos, expression, lhs_beg_pos, scanner()->location().end_pos,
...@@ -2665,7 +2637,6 @@ void ParserBase<Traits>::ParseFormalParameter( ...@@ -2665,7 +2637,6 @@ void ParserBase<Traits>::ParseFormalParameter(
// BindingElement[?Yield, ?GeneratorParameter] // BindingElement[?Yield, ?GeneratorParameter]
bool is_rest = parameters->has_rest; bool is_rest = parameters->has_rest;
Token::Value next = peek();
ExpressionT pattern = ParsePrimaryExpression(classifier, ok); ExpressionT pattern = ParsePrimaryExpression(classifier, ok);
if (!*ok) return; if (!*ok) return;
...@@ -2673,11 +2644,6 @@ void ParserBase<Traits>::ParseFormalParameter( ...@@ -2673,11 +2644,6 @@ void ParserBase<Traits>::ParseFormalParameter(
if (!*ok) return; if (!*ok) return;
if (!Traits::IsIdentifier(pattern)) { if (!Traits::IsIdentifier(pattern)) {
if (!allow_harmony_destructuring_bind()) {
ReportUnexpectedToken(next);
*ok = false;
return;
}
parameters->is_simple = false; parameters->is_simple = false;
ValidateFormalParameterInitializer(classifier, ok); ValidateFormalParameterInitializer(classifier, ok);
if (!*ok) return; if (!*ok) return;
...@@ -2685,7 +2651,7 @@ void ParserBase<Traits>::ParseFormalParameter( ...@@ -2685,7 +2651,7 @@ void ParserBase<Traits>::ParseFormalParameter(
} }
ExpressionT initializer = Traits::EmptyExpression(); ExpressionT initializer = Traits::EmptyExpression();
if (!is_rest && allow_harmony_default_parameters() && Check(Token::ASSIGN)) { if (!is_rest && Check(Token::ASSIGN)) {
ExpressionClassifier init_classifier(this); ExpressionClassifier init_classifier(this);
initializer = ParseAssignmentExpression(true, &init_classifier, ok); initializer = ParseAssignmentExpression(true, &init_classifier, ok);
if (!*ok) return; if (!*ok) return;
......
...@@ -779,10 +779,6 @@ Parser::Parser(ParseInfo* info) ...@@ -779,10 +779,6 @@ Parser::Parser(ParseInfo* info)
set_allow_harmony_sloppy(FLAG_harmony_sloppy); set_allow_harmony_sloppy(FLAG_harmony_sloppy);
set_allow_harmony_sloppy_function(FLAG_harmony_sloppy_function); set_allow_harmony_sloppy_function(FLAG_harmony_sloppy_function);
set_allow_harmony_sloppy_let(FLAG_harmony_sloppy_let); set_allow_harmony_sloppy_let(FLAG_harmony_sloppy_let);
set_allow_harmony_default_parameters(FLAG_harmony_default_parameters);
set_allow_harmony_destructuring_bind(FLAG_harmony_destructuring_bind);
set_allow_harmony_destructuring_assignment(
FLAG_harmony_destructuring_assignment);
set_allow_legacy_const(FLAG_legacy_const); set_allow_legacy_const(FLAG_legacy_const);
set_allow_harmony_do_expressions(FLAG_harmony_do_expressions); set_allow_harmony_do_expressions(FLAG_harmony_do_expressions);
set_allow_harmony_function_name(FLAG_harmony_function_name); set_allow_harmony_function_name(FLAG_harmony_function_name);
...@@ -941,8 +937,7 @@ FunctionLiteral* Parser::DoParseProgram(ParseInfo* info) { ...@@ -941,8 +937,7 @@ FunctionLiteral* Parser::DoParseProgram(ParseInfo* info) {
// unchanged if the property already exists. // unchanged if the property already exists.
InsertSloppyBlockFunctionVarBindings(scope, &ok); InsertSloppyBlockFunctionVarBindings(scope, &ok);
} }
if (ok && (is_strict(language_mode()) || allow_harmony_sloppy() || if (ok) {
allow_harmony_destructuring_bind())) {
CheckConflictingVarDeclarations(scope_, &ok); CheckConflictingVarDeclarations(scope_, &ok);
} }
...@@ -2323,17 +2318,11 @@ Block* Parser::ParseVariableDeclarations( ...@@ -2323,17 +2318,11 @@ Block* Parser::ParseVariableDeclarations(
int decl_pos = peek_position(); int decl_pos = peek_position();
{ {
ExpressionClassifier pattern_classifier(this); ExpressionClassifier pattern_classifier(this);
Token::Value next = peek();
pattern = ParsePrimaryExpression(&pattern_classifier, CHECK_OK); pattern = ParsePrimaryExpression(&pattern_classifier, CHECK_OK);
ValidateBindingPattern(&pattern_classifier, CHECK_OK); ValidateBindingPattern(&pattern_classifier, CHECK_OK);
if (IsLexicalVariableMode(parsing_result->descriptor.mode)) { if (IsLexicalVariableMode(parsing_result->descriptor.mode)) {
ValidateLetPattern(&pattern_classifier, CHECK_OK); ValidateLetPattern(&pattern_classifier, CHECK_OK);
} }
if (!allow_harmony_destructuring_bind() && !pattern->IsVariableProxy()) {
ReportUnexpectedToken(next);
*ok = false;
return nullptr;
}
} }
Scanner::Location variable_loc = scanner()->location(); Scanner::Location variable_loc = scanner()->location();
...@@ -3147,7 +3136,6 @@ void Parser::InitializeForEachStatement(ForEachStatement* stmt, ...@@ -3147,7 +3136,6 @@ void Parser::InitializeForEachStatement(ForEachStatement* stmt,
RelocInfo::kNoPosition); RelocInfo::kNoPosition);
} else { } else {
if (each->IsArrayLiteral() || each->IsObjectLiteral()) { if (each->IsArrayLiteral() || each->IsObjectLiteral()) {
DCHECK(allow_harmony_destructuring_assignment());
Variable* temp = Variable* temp =
scope_->NewTemporary(ast_value_factory()->empty_string()); scope_->NewTemporary(ast_value_factory()->empty_string());
VariableProxy* temp_proxy = factory()->NewVariableProxy(temp); VariableProxy* temp_proxy = factory()->NewVariableProxy(temp);
...@@ -3223,7 +3211,6 @@ void Parser::InitializeForOfStatement(ForOfStatement* for_of, Expression* each, ...@@ -3223,7 +3211,6 @@ void Parser::InitializeForOfStatement(ForOfStatement* for_of, Expression* each,
assign_each = factory()->NewAssignment(Token::ASSIGN, each, result_value, assign_each = factory()->NewAssignment(Token::ASSIGN, each, result_value,
RelocInfo::kNoPosition); RelocInfo::kNoPosition);
if (each->IsArrayLiteral() || each->IsObjectLiteral()) { if (each->IsArrayLiteral() || each->IsObjectLiteral()) {
DCHECK(allow_harmony_destructuring_assignment());
assign_each = PatternRewriter::RewriteDestructuringAssignment( assign_each = PatternRewriter::RewriteDestructuringAssignment(
this, assign_each->AsAssignment(), scope_); this, assign_each->AsAssignment(), scope_);
} }
...@@ -3700,9 +3687,8 @@ Statement* Parser::ParseForStatement(ZoneList<const AstRawString*>* labels, ...@@ -3700,9 +3687,8 @@ Statement* Parser::ParseForStatement(ZoneList<const AstRawString*>* labels,
bool is_for_each = CheckInOrOf(&mode, ok); bool is_for_each = CheckInOrOf(&mode, ok);
if (!*ok) return nullptr; if (!*ok) return nullptr;
bool is_destructuring = bool is_destructuring = is_for_each && (expression->IsArrayLiteral() ||
is_for_each && allow_harmony_destructuring_assignment() && expression->IsObjectLiteral());
(expression->IsArrayLiteral() || expression->IsObjectLiteral());
if (is_destructuring) { if (is_destructuring) {
ValidateAssignmentPattern(&classifier, CHECK_OK); ValidateAssignmentPattern(&classifier, CHECK_OK);
...@@ -3956,7 +3942,6 @@ void ParserTraits::ParseArrowFunctionFormalParameters( ...@@ -3956,7 +3942,6 @@ void ParserTraits::ParseArrowFunctionFormalParameters(
parser_->scope_->RemoveUnresolved(expr->AsVariableProxy()); parser_->scope_->RemoveUnresolved(expr->AsVariableProxy());
} else if (expr->IsAssignment()) { } else if (expr->IsAssignment()) {
Assignment* assignment = expr->AsAssignment(); Assignment* assignment = expr->AsAssignment();
DCHECK(parser_->allow_harmony_default_parameters());
DCHECK(!assignment->is_compound()); DCHECK(!assignment->is_compound());
initializer = assignment->value(); initializer = assignment->value();
expr = assignment->target(); expr = assignment->target();
...@@ -4273,10 +4258,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral( ...@@ -4273,10 +4258,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
if (is_sloppy(language_mode) && allow_harmony_sloppy_function()) { if (is_sloppy(language_mode) && allow_harmony_sloppy_function()) {
InsertSloppyBlockFunctionVarBindings(scope, CHECK_OK); InsertSloppyBlockFunctionVarBindings(scope, CHECK_OK);
} }
if (is_strict(language_mode) || allow_harmony_sloppy() || CheckConflictingVarDeclarations(scope, CHECK_OK);
allow_harmony_destructuring_bind()) {
CheckConflictingVarDeclarations(scope, CHECK_OK);
}
if (body) { if (body) {
// If body can be inspected, rewrite queued destructuring assignments // If body can be inspected, rewrite queued destructuring assignments
...@@ -4695,9 +4677,6 @@ PreParser::PreParseResult Parser::ParseLazyFunctionBodyWithPreParser( ...@@ -4695,9 +4677,6 @@ PreParser::PreParseResult Parser::ParseLazyFunctionBodyWithPreParser(
SET_ALLOW(natives); SET_ALLOW(natives);
SET_ALLOW(harmony_sloppy); SET_ALLOW(harmony_sloppy);
SET_ALLOW(harmony_sloppy_let); SET_ALLOW(harmony_sloppy_let);
SET_ALLOW(harmony_default_parameters);
SET_ALLOW(harmony_destructuring_bind);
SET_ALLOW(harmony_destructuring_assignment);
SET_ALLOW(harmony_do_expressions); SET_ALLOW(harmony_do_expressions);
SET_ALLOW(harmony_function_name); SET_ALLOW(harmony_function_name);
SET_ALLOW(harmony_function_sent); SET_ALLOW(harmony_function_sent);
...@@ -5464,7 +5443,6 @@ void Parser::RewriteNonPattern(ExpressionClassifier* classifier, bool* ok) { ...@@ -5464,7 +5443,6 @@ void Parser::RewriteNonPattern(ExpressionClassifier* classifier, bool* ok) {
void Parser::RewriteDestructuringAssignments() { void Parser::RewriteDestructuringAssignments() {
if (!allow_harmony_destructuring_assignment()) return;
const auto& assignments = const auto& assignments =
function_state_->destructuring_assignments_to_rewrite(); function_state_->destructuring_assignments_to_rewrite();
for (int i = assignments.length() - 1; i >= 0; --i) { for (int i = assignments.length() - 1; i >= 0; --i) {
......
...@@ -521,19 +521,12 @@ PreParser::Statement PreParser::ParseVariableDeclarations( ...@@ -521,19 +521,12 @@ PreParser::Statement PreParser::ParseVariableDeclarations(
PreParserExpression pattern = PreParserExpression::Default(); PreParserExpression pattern = PreParserExpression::Default();
{ {
ExpressionClassifier pattern_classifier(this); ExpressionClassifier pattern_classifier(this);
Token::Value next = peek();
pattern = ParsePrimaryExpression(&pattern_classifier, CHECK_OK); pattern = ParsePrimaryExpression(&pattern_classifier, CHECK_OK);
ValidateBindingPattern(&pattern_classifier, CHECK_OK); ValidateBindingPattern(&pattern_classifier, CHECK_OK);
if (lexical) { if (lexical) {
ValidateLetPattern(&pattern_classifier, CHECK_OK); ValidateLetPattern(&pattern_classifier, CHECK_OK);
} }
if (!allow_harmony_destructuring_bind() && !pattern.IsIdentifier()) {
ReportUnexpectedToken(next);
*ok = false;
return Statement::Default();
}
} }
is_pattern = pattern.IsObjectLiteral() || pattern.IsArrayLiteral(); is_pattern = pattern.IsObjectLiteral() || pattern.IsArrayLiteral();
...@@ -855,7 +848,6 @@ PreParser::Statement PreParser::ParseForStatement(bool* ok) { ...@@ -855,7 +848,6 @@ PreParser::Statement PreParser::ParseForStatement(bool* ok) {
bool is_for_each = CheckInOrOf(&mode, ok); bool is_for_each = CheckInOrOf(&mode, ok);
if (!*ok) return Statement::Default(); if (!*ok) return Statement::Default();
bool is_destructuring = is_for_each && bool is_destructuring = is_for_each &&
allow_harmony_destructuring_assignment() &&
(lhs->IsArrayLiteral() || lhs->IsObjectLiteral()); (lhs->IsArrayLiteral() || lhs->IsObjectLiteral());
if (is_destructuring) { if (is_destructuring) {
......
...@@ -1503,11 +1503,8 @@ i::Handle<i::String> FormatMessage(i::Vector<unsigned> data) { ...@@ -1503,11 +1503,8 @@ i::Handle<i::String> FormatMessage(i::Vector<unsigned> data) {
enum ParserFlag { enum ParserFlag {
kAllowLazy, kAllowLazy,
kAllowNatives, kAllowNatives,
kAllowHarmonyDefaultParameters,
kAllowHarmonySloppy, kAllowHarmonySloppy,
kAllowHarmonySloppyLet, kAllowHarmonySloppyLet,
kAllowHarmonyDestructuring,
kAllowHarmonyDestructuringAssignment,
kAllowHarmonyNewTarget, kAllowHarmonyNewTarget,
kNoLegacyConst, kNoLegacyConst,
kAllowHarmonyFunctionSent, kAllowHarmonyFunctionSent,
...@@ -1525,14 +1522,8 @@ void SetParserFlags(i::ParserBase<Traits>* parser, ...@@ -1525,14 +1522,8 @@ void SetParserFlags(i::ParserBase<Traits>* parser,
i::EnumSet<ParserFlag> flags) { i::EnumSet<ParserFlag> flags) {
parser->set_allow_lazy(flags.Contains(kAllowLazy)); parser->set_allow_lazy(flags.Contains(kAllowLazy));
parser->set_allow_natives(flags.Contains(kAllowNatives)); parser->set_allow_natives(flags.Contains(kAllowNatives));
parser->set_allow_harmony_default_parameters(
flags.Contains(kAllowHarmonyDefaultParameters));
parser->set_allow_harmony_sloppy(flags.Contains(kAllowHarmonySloppy)); parser->set_allow_harmony_sloppy(flags.Contains(kAllowHarmonySloppy));
parser->set_allow_harmony_sloppy_let(flags.Contains(kAllowHarmonySloppyLet)); parser->set_allow_harmony_sloppy_let(flags.Contains(kAllowHarmonySloppyLet));
parser->set_allow_harmony_destructuring_bind(
flags.Contains(kAllowHarmonyDestructuring));
parser->set_allow_harmony_destructuring_assignment(
flags.Contains(kAllowHarmonyDestructuringAssignment));
parser->set_allow_legacy_const(!flags.Contains(kNoLegacyConst)); parser->set_allow_legacy_const(!flags.Contains(kNoLegacyConst));
parser->set_allow_harmony_function_sent( parser->set_allow_harmony_function_sent(
flags.Contains(kAllowHarmonyFunctionSent)); flags.Contains(kAllowHarmonyFunctionSent));
...@@ -2350,10 +2341,7 @@ TEST(NoErrorsGenerator) { ...@@ -2350,10 +2341,7 @@ TEST(NoErrorsGenerator) {
}; };
// clang-format on // clang-format on
static const ParserFlag always_flags[] = { RunParserSyncTest(context_data, statement_data, kSuccess);
kAllowHarmonyDestructuringAssignment};
RunParserSyncTest(context_data, statement_data, kSuccess, nullptr, 0,
always_flags, arraysize(always_flags));
} }
...@@ -3742,20 +3730,11 @@ TEST(ErrorsArrowFunctions) { ...@@ -3742,20 +3730,11 @@ TEST(ErrorsArrowFunctions) {
"(-a, b) => {}", "(-a, b) => {}",
"(a, -b) => {}", "(a, -b) => {}",
"{} => {}", "{} => {}",
"({}) => {}",
"(a, {}) => {}",
"({}, a) => {}",
"a++ => {}", "a++ => {}",
"(a++) => {}", "(a++) => {}",
"(a++, b) => {}", "(a++, b) => {}",
"(a, b++) => {}", "(a, b++) => {}",
"[] => {}", "[] => {}",
"([]) => {}",
"(a, []) => {}",
"([], a) => {}",
"(a = b) => {}",
"(a = b, c) => {}",
"(a, b = c) => {}",
"(foo ? bar : baz) => {}", "(foo ? bar : baz) => {}",
"(a, foo ? bar : baz) => {}", "(a, foo ? bar : baz) => {}",
"(foo ? bar : baz, a) => {}", "(foo ? bar : baz, a) => {}",
...@@ -3789,6 +3768,7 @@ TEST(ErrorsArrowFunctions) { ...@@ -3789,6 +3768,7 @@ TEST(ErrorsArrowFunctions) {
TEST(NoErrorsArrowFunctions) { TEST(NoErrorsArrowFunctions) {
// Tests that parser and preparser accept valid arrow functions syntax. // Tests that parser and preparser accept valid arrow functions syntax.
// clang-format off
const char* context_data[][2] = { const char* context_data[][2] = {
{"", ";"}, {"", ";"},
{"bar ? (", ") : baz;"}, {"bar ? (", ") : baz;"},
...@@ -3834,6 +3814,15 @@ TEST(NoErrorsArrowFunctions) { ...@@ -3834,6 +3814,15 @@ TEST(NoErrorsArrowFunctions) {
"foo ? bar : baz => {}", "foo ? bar : baz => {}",
// Arrows with non-simple parameters. // Arrows with non-simple parameters.
"({}) => {}",
"(a, {}) => {}",
"({}, a) => {}",
"([]) => {}",
"(a, []) => {}",
"([], a) => {}",
"(a = b) => {}",
"(a = b, c) => {}",
"(a, b = c) => {}",
"({a}) => {}", "({a}) => {}",
"(x = 9) => {}", "(x = 9) => {}",
"(x, y = 9) => {}", "(x, y = 9) => {}",
...@@ -3845,18 +3834,15 @@ TEST(NoErrorsArrowFunctions) { ...@@ -3845,18 +3834,15 @@ TEST(NoErrorsArrowFunctions) {
"(x = 9, ...a) => {}", "(x = 9, ...a) => {}",
"(x, y = 9, ...a) => {}", "(x, y = 9, ...a) => {}",
"(x, y = 9, {b}, z = 8, ...a) => {}", "(x, y = 9, {b}, z = 8, ...a) => {}",
// TODO(wingo, rossberg): This is not accepted right now. "({a} = {}) => {}",
// "({a} = {}) => {}", "([x] = []) => {}",
// "([x] = []) => {}",
"({a = 42}) => {}", "({a = 42}) => {}",
"([x = 0]) => {}", "([x = 0]) => {}",
NULL NULL
}; };
// clang-format on
static const ParserFlag always_flags[] = {kAllowHarmonyDefaultParameters, RunParserSyncTest(context_data, statement_data, kSuccess);
kAllowHarmonyDestructuring};
RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
always_flags, arraysize(always_flags));
static const ParserFlag flags[] = {kAllowLazy}; static const ParserFlag flags[] = {kAllowLazy};
// In a context where a concise arrow body is parsed with [~In] variant, // In a context where a concise arrow body is parsed with [~In] variant,
...@@ -3943,13 +3929,9 @@ TEST(ArrowFunctionsYieldParameterNameInGenerator) { ...@@ -3943,13 +3929,9 @@ TEST(ArrowFunctionsYieldParameterNameInGenerator) {
NULL NULL
}; };
static const ParserFlag always_flags[] = { kAllowHarmonyDestructuring }; RunParserSyncTest(sloppy_function_context_data, arrow_data, kSuccess);
RunParserSyncTest(sloppy_function_context_data, arrow_data, kSuccess, NULL, 0, RunParserSyncTest(strict_function_context_data, arrow_data, kError);
always_flags, arraysize(always_flags)); RunParserSyncTest(generator_context_data, arrow_data, kError);
RunParserSyncTest(strict_function_context_data, arrow_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(generator_context_data, arrow_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
} }
...@@ -5376,9 +5358,7 @@ TEST(ParseRestParameters) { ...@@ -5376,9 +5358,7 @@ TEST(ParseRestParameters) {
"...[]", "...[]",
"...[...[a, b, ...c]]", "...[...[a, b, ...c]]",
NULL}; NULL};
static const ParserFlag always_flags[] = {kAllowHarmonyDestructuring}; RunParserSyncTest(context_data, data, kSuccess);
RunParserSyncTest(context_data, data, kSuccess, nullptr, 0, always_flags,
arraysize(always_flags));
} }
...@@ -6027,13 +6007,7 @@ TEST(ArrowFunctionASIErrors) { ...@@ -6027,13 +6007,7 @@ TEST(ArrowFunctionASIErrors) {
} }
static const ParserFlag kAllDestructuringFlags[] = {
kAllowHarmonyDestructuring, kAllowHarmonyDestructuringAssignment,
kAllowHarmonyDefaultParameters};
TEST(DestructuringPositiveTests) { TEST(DestructuringPositiveTests) {
i::FLAG_harmony_destructuring_bind = true;
const char* context_data[][2] = {{"'use strict'; let ", " = {};"}, const char* context_data[][2] = {{"'use strict'; let ", " = {};"},
{"var ", " = {};"}, {"var ", " = {};"},
{"'use strict'; const ", " = {};"}, {"'use strict'; const ", " = {};"},
...@@ -6084,18 +6058,11 @@ TEST(DestructuringPositiveTests) { ...@@ -6084,18 +6058,11 @@ TEST(DestructuringPositiveTests) {
"[a,,...rest]", "[a,,...rest]",
NULL}; NULL};
// clang-format on // clang-format on
static const ParserFlag always_flags[] = {kAllowHarmonyDestructuring}; RunParserSyncTest(context_data, data, kSuccess);
RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(context_data, data, kSuccess, NULL, 0,
kAllDestructuringFlags, arraysize(kAllDestructuringFlags));
} }
TEST(DestructuringNegativeTests) { TEST(DestructuringNegativeTests) {
i::FLAG_harmony_destructuring_bind = true;
static const ParserFlag always_flags[] = {kAllowHarmonyDestructuring};
{ // All modes. { // All modes.
const char* context_data[][2] = {{"'use strict'; let ", " = {};"}, const char* context_data[][2] = {{"'use strict'; let ", " = {};"},
{"var ", " = {};"}, {"var ", " = {};"},
...@@ -6180,11 +6147,7 @@ TEST(DestructuringNegativeTests) { ...@@ -6180,11 +6147,7 @@ TEST(DestructuringNegativeTests) {
"{ *method() {} }", "{ *method() {} }",
NULL}; NULL};
// clang-format on // clang-format on
RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, RunParserSyncTest(context_data, data, kError);
arraysize(always_flags));
RunParserSyncTest(context_data, data, kError, NULL, 0,
kAllDestructuringFlags,
arraysize(kAllDestructuringFlags));
} }
{ // All modes. { // All modes.
...@@ -6203,11 +6166,7 @@ TEST(DestructuringNegativeTests) { ...@@ -6203,11 +6166,7 @@ TEST(DestructuringNegativeTests) {
"() => x", "() => x",
NULL}; NULL};
// clang-format on // clang-format on
RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, RunParserSyncTest(context_data, data, kError);
arraysize(always_flags));
RunParserSyncTest(context_data, data, kError, NULL, 0,
kAllDestructuringFlags,
arraysize(kAllDestructuringFlags));
} }
{ // Strict mode. { // Strict mode.
...@@ -6226,11 +6185,7 @@ TEST(DestructuringNegativeTests) { ...@@ -6226,11 +6185,7 @@ TEST(DestructuringNegativeTests) {
"{ x : private }", "{ x : private }",
NULL}; NULL};
// clang-format on // clang-format on
RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, RunParserSyncTest(context_data, data, kError);
arraysize(always_flags));
RunParserSyncTest(context_data, data, kError, NULL, 0,
kAllDestructuringFlags,
arraysize(kAllDestructuringFlags));
} }
{ // 'yield' in generators. { // 'yield' in generators.
...@@ -6247,11 +6202,7 @@ TEST(DestructuringNegativeTests) { ...@@ -6247,11 +6202,7 @@ TEST(DestructuringNegativeTests) {
"{ x : yield }", "{ x : yield }",
NULL}; NULL};
// clang-format on // clang-format on
RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, RunParserSyncTest(context_data, data, kError);
arraysize(always_flags));
RunParserSyncTest(context_data, data, kError, NULL, 0,
kAllDestructuringFlags,
arraysize(kAllDestructuringFlags));
} }
{ // Declaration-specific errors { // Declaration-specific errors
...@@ -6275,8 +6226,7 @@ TEST(DestructuringNegativeTests) { ...@@ -6275,8 +6226,7 @@ TEST(DestructuringNegativeTests) {
"[ a ]", "[ a ]",
NULL}; NULL};
// clang-format on // clang-format on
static const ParserFlag always_flags[] = {kAllowHarmonyDestructuring, static const ParserFlag always_flags[] = {kAllowHarmonySloppyLet};
kAllowHarmonySloppyLet};
RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
arraysize(always_flags)); arraysize(always_flags));
} }
...@@ -6449,14 +6399,9 @@ TEST(DestructuringAssignmentPositiveTests) { ...@@ -6449,14 +6399,9 @@ TEST(DestructuringAssignmentPositiveTests) {
NULL}; NULL};
// clang-format on // clang-format on
static const ParserFlag always_flags[] = { RunParserSyncTest(context_data, data, kSuccess);
kAllowHarmonyDestructuringAssignment, kAllowHarmonyDestructuring,
kAllowHarmonyDefaultParameters};
RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(mixed_assignments_context_data, data, kSuccess, NULL, 0, RunParserSyncTest(mixed_assignments_context_data, data, kSuccess);
always_flags, arraysize(always_flags));
const char* empty_context_data[][2] = { const char* empty_context_data[][2] = {
{"'use strict';", ""}, {"", ""}, {NULL, NULL}}; {"'use strict';", ""}, {"", ""}, {NULL, NULL}};
...@@ -6477,8 +6422,7 @@ TEST(DestructuringAssignmentPositiveTests) { ...@@ -6477,8 +6422,7 @@ TEST(DestructuringAssignmentPositiveTests) {
"var x; (({ x = 10 } = { x = 20 } = {}) => x)({})", "var x; (({ x = 10 } = { x = 20 } = {}) => x)({})",
NULL, NULL,
}; };
RunParserSyncTest(empty_context_data, ambiguity_data, kSuccess, NULL, 0, RunParserSyncTest(empty_context_data, ambiguity_data, kSuccess);
always_flags, arraysize(always_flags));
} }
...@@ -6577,11 +6521,7 @@ TEST(DestructuringAssignmentNegativeTests) { ...@@ -6577,11 +6521,7 @@ TEST(DestructuringAssignmentNegativeTests) {
NULL}; NULL};
// clang-format on // clang-format on
static const ParserFlag always_flags[] = { RunParserSyncTest(context_data, data, kError);
kAllowHarmonyDestructuringAssignment, kAllowHarmonyDestructuring,
kAllowHarmonyDefaultParameters};
RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
arraysize(always_flags));
const char* empty_context_data[][2] = { const char* empty_context_data[][2] = {
{"'use strict';", ""}, {"", ""}, {NULL, NULL}}; {"'use strict';", ""}, {"", ""}, {NULL, NULL}};
...@@ -6606,8 +6546,7 @@ TEST(DestructuringAssignmentNegativeTests) { ...@@ -6606,8 +6546,7 @@ TEST(DestructuringAssignmentNegativeTests) {
NULL, NULL,
}; };
RunParserSyncTest(empty_context_data, ambiguity_data, kError, NULL, 0, RunParserSyncTest(empty_context_data, ambiguity_data, kError);
always_flags, arraysize(always_flags));
// Strict mode errors // Strict mode errors
const char* strict_context_data[][2] = {{"'use strict'; (", " = {})"}, const char* strict_context_data[][2] = {{"'use strict'; (", " = {})"},
...@@ -6648,14 +6587,11 @@ TEST(DestructuringAssignmentNegativeTests) { ...@@ -6648,14 +6587,11 @@ TEST(DestructuringAssignmentNegativeTests) {
"[ ...(arguments) = 0 ]", "[ ...(arguments) = 0 ]",
NULL}; NULL};
RunParserSyncTest(strict_context_data, strict_data, kError, NULL, 0, RunParserSyncTest(strict_context_data, strict_data, kError);
always_flags, arraysize(always_flags));
} }
TEST(DestructuringDisallowPatternsInForVarIn) { TEST(DestructuringDisallowPatternsInForVarIn) {
i::FLAG_harmony_destructuring_bind = true;
static const ParserFlag always_flags[] = {kAllowHarmonyDestructuring};
const char* context_data[][2] = { const char* context_data[][2] = {
{"", ""}, {"function f() {", "}"}, {NULL, NULL}}; {"", ""}, {"function f() {", "}"}, {NULL, NULL}};
// clang-format off // clang-format off
...@@ -6664,22 +6600,18 @@ TEST(DestructuringDisallowPatternsInForVarIn) { ...@@ -6664,22 +6600,18 @@ TEST(DestructuringDisallowPatternsInForVarIn) {
"for (let x = {} of null);", "for (let x = {} of null);",
NULL}; NULL};
// clang-format on // clang-format on
RunParserSyncTest(context_data, error_data, kError, NULL, 0, always_flags, RunParserSyncTest(context_data, error_data, kError);
arraysize(always_flags));
// clang-format off // clang-format off
const char* success_data[] = { const char* success_data[] = {
"for (var x = {} in null);", "for (var x = {} in null);",
NULL}; NULL};
// clang-format on // clang-format on
RunParserSyncTest(context_data, success_data, kSuccess, NULL, 0, always_flags, RunParserSyncTest(context_data, success_data, kSuccess);
arraysize(always_flags));
} }
TEST(DestructuringDuplicateParams) { TEST(DestructuringDuplicateParams) {
i::FLAG_harmony_destructuring_bind = true;
static const ParserFlag always_flags[] = {kAllowHarmonyDestructuring};
const char* context_data[][2] = {{"'use strict';", ""}, const char* context_data[][2] = {{"'use strict';", ""},
{"function outer() { 'use strict';", "}"}, {"function outer() { 'use strict';", "}"},
{nullptr, nullptr}}; {nullptr, nullptr}};
...@@ -6698,14 +6630,11 @@ TEST(DestructuringDuplicateParams) { ...@@ -6698,14 +6630,11 @@ TEST(DestructuringDuplicateParams) {
"function f(x, x, {a}) {}", "function f(x, x, {a}) {}",
nullptr}; nullptr};
// clang-format on // clang-format on
RunParserSyncTest(context_data, error_data, kError, NULL, 0, always_flags, RunParserSyncTest(context_data, error_data, kError);
arraysize(always_flags));
} }
TEST(DestructuringDuplicateParamsSloppy) { TEST(DestructuringDuplicateParamsSloppy) {
i::FLAG_harmony_destructuring_bind = true;
static const ParserFlag always_flags[] = {kAllowHarmonyDestructuring};
const char* context_data[][2] = { const char* context_data[][2] = {
{"", ""}, {"function outer() {", "}"}, {nullptr, nullptr}}; {"", ""}, {"function outer() {", "}"}, {nullptr, nullptr}};
...@@ -6719,14 +6648,11 @@ TEST(DestructuringDuplicateParamsSloppy) { ...@@ -6719,14 +6648,11 @@ TEST(DestructuringDuplicateParamsSloppy) {
"function f(x, x, {a}) {}", "function f(x, x, {a}) {}",
nullptr}; nullptr};
// clang-format on // clang-format on
RunParserSyncTest(context_data, error_data, kError, NULL, 0, always_flags, RunParserSyncTest(context_data, error_data, kError);
arraysize(always_flags));
} }
TEST(DestructuringDisallowPatternsInSingleParamArrows) { TEST(DestructuringDisallowPatternsInSingleParamArrows) {
i::FLAG_harmony_destructuring_bind = true;
static const ParserFlag always_flags[] = {kAllowHarmonyDestructuring};
const char* context_data[][2] = {{"'use strict';", ""}, const char* context_data[][2] = {{"'use strict';", ""},
{"function outer() { 'use strict';", "}"}, {"function outer() { 'use strict';", "}"},
{"", ""}, {"", ""},
...@@ -6739,8 +6665,7 @@ TEST(DestructuringDisallowPatternsInSingleParamArrows) { ...@@ -6739,8 +6665,7 @@ TEST(DestructuringDisallowPatternsInSingleParamArrows) {
"var f = {x,y} => {};", "var f = {x,y} => {};",
nullptr}; nullptr};
// clang-format on // clang-format on
RunParserSyncTest(context_data, error_data, kError, NULL, 0, always_flags, RunParserSyncTest(context_data, error_data, kError);
arraysize(always_flags));
} }
...@@ -6800,21 +6725,14 @@ TEST(DefaultParametersYieldInInitializers) { ...@@ -6800,21 +6725,14 @@ TEST(DefaultParametersYieldInInitializers) {
}; };
// clang-format on // clang-format on
static const ParserFlag always_flags[] = {kAllowHarmonyDestructuring,
kAllowHarmonyDefaultParameters};
RunParserSyncTest(sloppy_function_context_data, parameter_data, kSuccess, RunParserSyncTest(sloppy_function_context_data, parameter_data, kSuccess);
NULL, 0, always_flags, arraysize(always_flags)); RunParserSyncTest(sloppy_arrow_context_data, parameter_data, kSuccess);
RunParserSyncTest(sloppy_arrow_context_data, parameter_data, kSuccess, NULL,
0, always_flags, arraysize(always_flags));
RunParserSyncTest(strict_function_context_data, parameter_data, kError, NULL, RunParserSyncTest(strict_function_context_data, parameter_data, kError);
0, always_flags, arraysize(always_flags)); RunParserSyncTest(strict_arrow_context_data, parameter_data, kError);
RunParserSyncTest(strict_arrow_context_data, parameter_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(generator_context_data, parameter_data, kError, NULL, 0, RunParserSyncTest(generator_context_data, parameter_data, kError);
always_flags, arraysize(always_flags));
} }
...@@ -7026,9 +6944,7 @@ TEST(LanguageModeDirectivesNonSimpleParameterListErrors) { ...@@ -7026,9 +6944,7 @@ TEST(LanguageModeDirectivesNonSimpleParameterListErrors) {
"{ initializedBindingPattern } = { initializedBindingPattern: true }", "{ initializedBindingPattern } = { initializedBindingPattern: true }",
NULL}; NULL};
static const ParserFlag always_flags[] = { static const ParserFlag always_flags[] = {kAllowHarmonySloppy};
kAllowHarmonyDefaultParameters, kAllowHarmonyDestructuring,
kAllowHarmonySloppy};
RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
arraysize(always_flags)); arraysize(always_flags));
} }
...@@ -7064,8 +6980,8 @@ TEST(LetSloppyOnly) { ...@@ -7064,8 +6980,8 @@ TEST(LetSloppyOnly) {
}; };
// clang-format on // clang-format on
static const ParserFlag always_flags[] = { static const ParserFlag always_flags[] = {kAllowHarmonySloppy,
kAllowHarmonySloppy, kAllowHarmonySloppyLet, kAllowHarmonyDestructuring}; kAllowHarmonySloppyLet};
RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags,
arraysize(always_flags)); arraysize(always_flags));
...@@ -7102,8 +7018,7 @@ TEST(LetSloppyOnly) { ...@@ -7102,8 +7018,7 @@ TEST(LetSloppyOnly) {
// clang-format on // clang-format on
static const ParserFlag fail_flags[] = { static const ParserFlag fail_flags[] = {
kAllowHarmonySloppy, kAllowHarmonySloppyLet, kNoLegacyConst, kAllowHarmonySloppy, kAllowHarmonySloppyLet, kNoLegacyConst};
kAllowHarmonyDestructuring};
RunParserSyncTest(context_data, fail_data, kError, NULL, 0, fail_flags, RunParserSyncTest(context_data, fail_data, kError, NULL, 0, fail_flags,
arraysize(fail_flags)); arraysize(fail_flags));
} }
...@@ -7205,8 +7120,7 @@ TEST(EscapedKeywords) { ...@@ -7205,8 +7120,7 @@ TEST(EscapedKeywords) {
}; };
// clang-format on // clang-format on
static const ParserFlag always_flags[] = {kAllowHarmonySloppy, static const ParserFlag always_flags[] = {kAllowHarmonySloppy};
kAllowHarmonyDestructuring};
RunParserSyncTest(sloppy_context_data, fail_data, kError, NULL, 0, RunParserSyncTest(sloppy_context_data, fail_data, kError, NULL, 0,
always_flags, arraysize(always_flags)); always_flags, arraysize(always_flags));
RunParserSyncTest(strict_context_data, fail_data, kError, NULL, 0, RunParserSyncTest(strict_context_data, fail_data, kError, NULL, 0,
...@@ -7228,8 +7142,8 @@ TEST(EscapedKeywords) { ...@@ -7228,8 +7142,8 @@ TEST(EscapedKeywords) {
RunParserSyncTest(strict_context_data, let_data, kError, NULL, 0, RunParserSyncTest(strict_context_data, let_data, kError, NULL, 0,
always_flags, arraysize(always_flags)); always_flags, arraysize(always_flags));
static const ParserFlag sloppy_let_flags[] = { static const ParserFlag sloppy_let_flags[] = {kAllowHarmonySloppy,
kAllowHarmonySloppy, kAllowHarmonySloppyLet, kAllowHarmonyDestructuring}; kAllowHarmonySloppyLet};
RunParserSyncTest(sloppy_context_data, let_data, kSuccess, NULL, 0, RunParserSyncTest(sloppy_context_data, let_data, kSuccess, NULL, 0,
sloppy_let_flags, arraysize(sloppy_let_flags)); sloppy_let_flags, arraysize(sloppy_let_flags));
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +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-default-parameters //
((a=-a) => { })(); ((a=-a) => { })();
...@@ -2,6 +2,6 @@ ...@@ -2,6 +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-default-parameters //
(function(a=+a) { })(); (function(a=+a) { })();
...@@ -2,6 +2,6 @@ ...@@ -2,6 +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-destructuring-bind //
var [ a, b, c ]; var [ a, b, c ];
...@@ -2,6 +2,6 @@ ...@@ -2,6 +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-destructuring-bind //
for (var [ a ]; a; ) {} for (var [ a ]; a; ) {}
...@@ -2,6 +2,6 @@ ...@@ -2,6 +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-destructuring-bind //
var { a, b, c }; var { a, b, c };
...@@ -2,6 +2,6 @@ ...@@ -2,6 +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-destructuring-bind //
for (var { a, b, c }; a && b && c; ) {} for (var { a, b, c }; a && b && c; ) {}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// 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-destructuring-bind //
'use strict'; 'use strict';
const { x : x, y : y } = { x : 1, y : 2 }; const { x : x, y : y } = { x : 1, y : 2 };
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// 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-destructuring-bind //
function f() { function f() {
for (var [x, y] = {} in {}); for (var [x, y] = {} in {});
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +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-sloppy --harmony-sloppy-let --harmony-destructuring-bind // Flags: --harmony-sloppy --harmony-sloppy-let
let [let]; let [let];
...@@ -2,6 +2,6 @@ ...@@ -2,6 +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-sloppy --harmony-sloppy-let --harmony-destructuring-bind // Flags: --harmony-sloppy --harmony-sloppy-let
let {let}; let {let};
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// 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-destructuring-bind //
"use strict"; "use strict";
try { try {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// 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-destructuring-bind //
try { try {
} catch ({x}) { } catch ({x}) {
......
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
// 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-sloppy --harmony-sloppy-let --harmony-destructuring-bind // Flags: --harmony-sloppy --harmony-sloppy-let --legacy-const
// Flags: --legacy-const
// let is usable as a variable with var or legacy const, not let or ES6 const // let is usable as a variable with var or legacy const, not let or ES6 const
......
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
// 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: --expose-debug-as debug --harmony-destructuring-assignment // Flags: --expose-debug-as debug
// Flags: --harmony-destructuring-bind
var exception = null; var exception = null;
var Debug = debug.Debug; var Debug = debug.Debug;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// 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: --expose-debug-as debug --harmony-destructuring-bind // Flags: --expose-debug-as debug
var exception = null; var exception = null;
var Debug = debug.Debug; var Debug = debug.Debug;
......
...@@ -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-default-parameters --harmony-destructuring-bind
(function TestSloppyEvalScoping() { (function TestSloppyEvalScoping() {
var x = 1; var x = 1;
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +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-destructuring-assignment --harmony-destructuring-bind
// Flags: --min-preparse-length=0 // Flags: --min-preparse-length=0
function f() { function f() {
......
...@@ -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-destructuring-assignment --harmony-destructuring-bind
// script-level tests // script-level tests
var ox, oy = {}, oz; var ox, oy = {}, oz;
({ ({
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +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-destructuring-bind
// Flags: --no-lazy --allow-natives-syntax // Flags: --no-lazy --allow-natives-syntax
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +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-destructuring-bind
// Flags: --allow-natives-syntax // Flags: --allow-natives-syntax
......
// Copyright 2015 the V8 project authors. All rights reserved. // Copyright 2015 the V8 project authors. All rights reserved.
// 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-destructuring-bind
// Flags: --harmony-default-parameters
(function TestObjectLiteralPattern() { (function TestObjectLiteralPattern() {
var { x : x, y : y, get, set } = { x : 1, y : 2, get: 3, set: 4 }; var { x : x, y : y, get, set } = { x : 1, y : 2, get: 3, set: 4 };
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// 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-reflect --harmony-destructuring-bind // Flags: --harmony-reflect
(function TestClass() { (function TestClass() {
......
// Copyright 2015 the V8 project authors. All rights reserved. // Copyright 2015 the V8 project authors. All rights reserved.
// 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-default-parameters --harmony-destructuring-bind
((x, y = eval('x')) => assertEquals(42, y))(42); ((x, y = eval('x')) => assertEquals(42, y))(42);
((x, {y = eval('x')}) => assertEquals(42, y))(42, {}); ((x, {y = eval('x')}) => assertEquals(42, y))(42, {});
// Copyright 2015 the V8 project authors. All rights reserved. // Copyright 2015 the V8 project authors. All rights reserved.
// 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-destructuring-bind --harmony-default-parameters
(function testExpressionTypes() { (function testExpressionTypes() {
"use strict"; "use strict";
......
...@@ -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-destructuring-bind
assertThrows(`for(const { method() {} } = this) {}`, SyntaxError); assertThrows(`for(const { method() {} } = this) {}`, SyntaxError);
assertThrows(`var { method() {} } = this;`, SyntaxError); assertThrows(`var { method() {} } = this;`, SyntaxError);
assertThrows(`for(const { *method() {} } = this) {}`, SyntaxError); assertThrows(`for(const { *method() {} } = this) {}`, SyntaxError);
......
// Copyright 2015 the V8 project authors. All rights reserved. // Copyright 2015 the V8 project authors. All rights reserved.
// 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-destructuring-bind
function f({x = ""}) { eval(x) } function f({x = ""}) { eval(x) }
f({}) f({})
...@@ -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-destructuring-bind
function f({}) { function f({}) {
for (var v in []); for (var v in []);
}; };
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --allow-natives-syntax // Flags: --allow-natives-syntax
// Flags: --harmony-destructuring-bind --harmony-sloppy // Flags: --harmony-sloppy
(function TestSuperNamedLoads() { (function TestSuperNamedLoads() {
function Base() { } function Base() { }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --no-legacy-const --harmony-sloppy --harmony-sloppy-let // Flags: --no-legacy-const --harmony-sloppy --harmony-sloppy-let
// Flags: --harmony-sloppy-function --harmony-destructuring-bind // Flags: --harmony-sloppy-function
// Test Annex B 3.3 semantics for functions declared in blocks in sloppy mode. // 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 // http://www.ecma-international.org/ecma-262/6.0/#sec-block-level-function-declarations-web-legacy-compatibility-semantics
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-do-expressions --harmony-sloppy-let --allow-natives-syntax // Flags: --harmony-do-expressions --harmony-sloppy-let --allow-natives-syntax
// Flags: --harmony-default-parameters --harmony-destructuring-bind
function returnValue(v) { return v; } function returnValue(v) { return v; }
function MyError() {} function MyError() {}
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
// found in the LICENSE file. // found in the LICENSE file.
// //
// Flags: --harmony-function-name // Flags: --harmony-function-name
// Flags: --harmony-destructuring-bind --harmony-destructuring-assignment
(function testVariableDeclarationsFunction() { (function testVariableDeclarationsFunction() {
'use strict'; 'use strict';
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +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-destructuring-bind --allow-natives-syntax // Flags: --allow-natives-syntax
assertThrows('var %OptimizeFunctionOnNextCall()', SyntaxError); assertThrows('var %OptimizeFunctionOnNextCall()', SyntaxError);
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
// found in the LICENSE file. // found in the LICENSE file.
// //
// Flags: --allow-natives-syntax --no-lazy // Flags: --allow-natives-syntax --no-lazy
// Flags: --harmony-destructuring-bind
"use strict"; "use strict";
eval(); eval();
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-sloppy --harmony-destructuring-bind // Flags: --harmony-sloppy
description('Tests for ES6 class syntax declarations'); description('Tests for ES6 class syntax declarations');
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-sloppy --harmony-destructuring-bind // Flags: --harmony-sloppy
description('Tests for ES6 class syntax expressions'); description('Tests for ES6 class syntax expressions');
......
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