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

Remove runtime flags for sloppy mode block scoping features

These were all on by default in M49 without complaint.

R=littledan@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#35342}
parent 920370d1
......@@ -2379,9 +2379,6 @@ void Bootstrapper::ExportExperimentalFromRuntime(Isolate* isolate,
#define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \
void Genesis::InitializeGlobal_##id() {}
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_object_observe)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_unicode_regexps)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions)
......@@ -2918,9 +2915,6 @@ bool Genesis::InstallNatives(GlobalContextType context_type) {
bool Genesis::InstallExperimentalNatives() {
static const char* harmony_iterator_close_natives[] = {nullptr};
static const char* harmony_sloppy_natives[] = {nullptr};
static const char* harmony_sloppy_function_natives[] = {nullptr};
static const char* harmony_sloppy_let_natives[] = {nullptr};
static const char* harmony_species_natives[] = {"native harmony-species.js",
nullptr};
static const char* harmony_tailcalls_natives[] = {nullptr};
......
......@@ -219,9 +219,6 @@ DEFINE_IMPLICATION(es_staging, move_object_start)
V(harmony_iterator_close, "harmony iterator finalization") \
V(harmony_unicode_regexps, "harmony unicode regexps") \
V(harmony_regexp_exec, "harmony RegExp exec override behavior") \
V(harmony_sloppy, "harmony features in sloppy mode") \
V(harmony_sloppy_let, "harmony let in sloppy mode") \
V(harmony_sloppy_function, "harmony sloppy function block scoping") \
V(harmony_regexp_subclass, "harmony regexp subclassing") \
V(harmony_restrictive_declarations, \
"harmony limitations on sloppy mode function declarations") \
......@@ -250,11 +247,6 @@ HARMONY_STAGED(FLAG_STAGED_FEATURES)
HARMONY_SHIPPING(FLAG_SHIPPING_FEATURES)
#undef FLAG_SHIPPING_FEATURES
// Feature dependencies.
DEFINE_IMPLICATION(harmony_sloppy_let, harmony_sloppy)
DEFINE_IMPLICATION(harmony_sloppy_function, harmony_sloppy)
// Flags for experimental implementation features.
DEFINE_BOOL(compiled_keyed_generic_loads, false,
"use optimizing compiler to generate keyed generic load stubs")
......
......@@ -430,9 +430,6 @@ class CallSite {
T(SloppyFunction, \
"In non-strict mode code, functions can only be declared at top level, " \
"inside a block, or as the body of an if statement.") \
T(SloppyLexical, \
"Block-scoped declarations (let, const, function, class) not yet " \
"supported outside strict mode") \
T(SpeciesNotConstructor, \
"object.constructor[Symbol.species] is not a constructor") \
T(StrictDelete, "Delete of an unqualified identifier in strict mode.") \
......
......@@ -113,9 +113,6 @@ class ParserBase : public Traits {
allow_lazy_(false),
allow_natives_(false),
allow_tailcalls_(false),
allow_harmony_sloppy_(false),
allow_harmony_sloppy_function_(false),
allow_harmony_sloppy_let_(false),
allow_harmony_restrictive_declarations_(false),
allow_harmony_do_expressions_(false),
allow_harmony_function_name_(false),
......@@ -134,9 +131,6 @@ class ParserBase : public Traits {
ALLOW_ACCESSORS(lazy);
ALLOW_ACCESSORS(natives);
ALLOW_ACCESSORS(tailcalls);
ALLOW_ACCESSORS(harmony_sloppy);
ALLOW_ACCESSORS(harmony_sloppy_function);
ALLOW_ACCESSORS(harmony_sloppy_let);
ALLOW_ACCESSORS(harmony_restrictive_declarations);
ALLOW_ACCESSORS(harmony_do_expressions);
ALLOW_ACCESSORS(harmony_function_name);
......@@ -564,14 +558,6 @@ class ParserBase : public Traits {
LanguageMode language_mode() { return scope_->language_mode(); }
bool is_generator() const { return function_state_->is_generator(); }
bool allow_const() {
return is_strict(language_mode()) || allow_harmony_sloppy();
}
bool allow_let() {
return is_strict(language_mode()) || allow_harmony_sloppy_let();
}
// Report syntax errors.
void ReportMessage(MessageTemplate::Template message, const char* arg = NULL,
ParseErrorType error_type = kSyntaxError) {
......@@ -926,9 +912,6 @@ class ParserBase : public Traits {
bool allow_lazy_;
bool allow_natives_;
bool allow_tailcalls_;
bool allow_harmony_sloppy_;
bool allow_harmony_sloppy_function_;
bool allow_harmony_sloppy_let_;
bool allow_harmony_restrictive_declarations_;
bool allow_harmony_do_expressions_;
bool allow_harmony_function_name_;
......@@ -1329,11 +1312,6 @@ ParserBase<Traits>::ParsePrimaryExpression(ExpressionClassifier* classifier,
case Token::CLASS: {
BindingPatternUnexpectedToken(classifier);
Consume(Token::CLASS);
if (!allow_harmony_sloppy() && is_sloppy(language_mode())) {
ReportMessage(MessageTemplate::kSloppyLexical);
*ok = false;
return this->EmptyExpression();
}
int class_token_position = position();
IdentifierT name = this->EmptyIdentifier();
bool is_strict_reserved_name = false;
......@@ -2787,9 +2765,6 @@ void ParserBase<Traits>::CheckArityRestrictions(int param_count,
template <class Traits>
bool ParserBase<Traits>::IsNextLetKeyword() {
DCHECK(peek() == Token::LET);
if (!allow_let()) {
return false;
}
Token::Value next_next = PeekAhead();
switch (next_next) {
case Token::LBRACE:
......@@ -2890,9 +2865,7 @@ ParserBase<Traits>::ParseArrowFunctionLiteral(
CheckStrictOctalLiteral(formal_parameters.scope->start_position(),
scanner()->location().end_pos, CHECK_OK);
}
if (is_strict(language_mode()) || allow_harmony_sloppy()) {
this->CheckConflictingVarDeclarations(formal_parameters.scope, CHECK_OK);
}
this->CheckConflictingVarDeclarations(formal_parameters.scope, CHECK_OK);
Traits::RewriteDestructuringAssignments();
}
......
......@@ -786,9 +786,6 @@ Parser::Parser(ParseInfo* info)
set_allow_natives(FLAG_allow_natives_syntax || info->is_native());
set_allow_tailcalls(FLAG_harmony_tailcalls && !info->is_native() &&
info->isolate()->is_tail_call_elimination_enabled());
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_do_expressions(FLAG_harmony_do_expressions);
set_allow_harmony_function_name(FLAG_harmony_function_name);
set_allow_harmony_function_sent(FLAG_harmony_function_sent);
......@@ -941,7 +938,7 @@ FunctionLiteral* Parser::DoParseProgram(ParseInfo* info) {
if (ok && is_strict(language_mode())) {
CheckStrictOctalLiteral(beg_pos, scanner()->location().end_pos, &ok);
}
if (ok && is_sloppy(language_mode()) && allow_harmony_sloppy_function()) {
if (ok && is_sloppy(language_mode())) {
// TODO(littledan): Function bindings on the global object that modify
// pre-existing bindings should be made writable, enumerable and
// nonconfigurable if possible, whereas this code will leave attributes
......@@ -1258,10 +1255,7 @@ Statement* Parser::ParseStatementListItem(bool* ok) {
Consume(Token::CLASS);
return ParseClassDeclaration(NULL, ok);
case Token::CONST:
if (allow_const()) {
return ParseVariableStatement(kStatementListItem, NULL, ok);
}
break;
return ParseVariableStatement(kStatementListItem, NULL, ok);
case Token::VAR:
return ParseVariableStatement(kStatementListItem, NULL, ok);
case Token::LET:
......@@ -1909,11 +1903,8 @@ Variable* Parser::Declare(Declaration* declaration,
}
var = declaration_scope->DeclareLocal(
name, mode, declaration->initialization(), kind, kNotAssigned);
} else if ((IsLexicalVariableMode(mode) ||
IsLexicalVariableMode(var->mode())) &&
// Lexical bindings may appear for some parameters in sloppy
// mode even with --harmony-sloppy off.
(is_strict(language_mode()) || allow_harmony_sloppy())) {
} else if (IsLexicalVariableMode(mode) ||
IsLexicalVariableMode(var->mode())) {
// Allow duplicate function decls for web compat, see bug 4693.
if (is_sloppy(language_mode()) && is_function_declaration &&
var->is_function()) {
......@@ -2103,19 +2094,14 @@ Statement* Parser::ParseFunctionDeclaration(
// initial value upon entering the corresponding scope.
// In ES6, a function behaves as a lexical binding, except in
// a script scope, or the initial scope of eval or another function.
VariableMode mode =
(is_strict(language_mode()) || allow_harmony_sloppy_function()) &&
!scope_->is_declaration_scope()
? LET
: VAR;
VariableMode mode = !scope_->is_declaration_scope() ? LET : VAR;
VariableProxy* proxy = NewUnresolved(name, mode);
Declaration* declaration =
factory()->NewFunctionDeclaration(proxy, mode, fun, scope_, pos);
Declare(declaration, DeclarationDescriptor::NORMAL, true, CHECK_OK);
if (names) names->Add(name, zone());
EmptyStatement* empty = factory()->NewEmptyStatement(RelocInfo::kNoPosition);
if (is_sloppy(language_mode()) && allow_harmony_sloppy_function() &&
!scope_->is_declaration_scope()) {
if (is_sloppy(language_mode()) && !scope_->is_declaration_scope()) {
SloppyBlockFunctionStatement* delegate =
factory()->NewSloppyBlockFunctionStatement(empty, scope_);
scope_->DeclarationScope()->sloppy_block_function_map()->Declare(name,
......@@ -2143,12 +2129,6 @@ Statement* Parser::ParseClassDeclaration(ZoneList<const AstRawString*>* names,
//
// so rewrite it as such.
if (!allow_harmony_sloppy() && is_sloppy(language_mode())) {
ReportMessage(MessageTemplate::kSloppyLexical);
*ok = false;
return NULL;
}
int pos = position();
bool is_strict_reserved = false;
const AstRawString* name =
......@@ -2279,12 +2259,11 @@ Block* Parser::ParseVariableDeclarations(
if (peek() == Token::VAR) {
Consume(Token::VAR);
} else if (peek() == Token::CONST && allow_const()) {
} else if (peek() == Token::CONST) {
Consume(Token::CONST);
DCHECK(is_strict(language_mode()) || allow_harmony_sloppy());
DCHECK(var_context != kStatement);
parsing_result->descriptor.mode = CONST;
} else if (peek() == Token::LET && allow_let()) {
} else if (peek() == Token::LET) {
Consume(Token::LET);
DCHECK(var_context != kStatement);
parsing_result->descriptor.mode = LET;
......@@ -2493,15 +2472,6 @@ Statement* Parser::ParseExpressionOrLabelledStatement(
}
// Parsed expression statement, followed by semicolon.
// Detect attempts at 'let' declarations in sloppy mode.
if (!allow_harmony_sloppy_let() && peek() == Token::IDENTIFIER &&
expr->AsVariableProxy() != NULL &&
expr->AsVariableProxy()->raw_name() ==
ast_value_factory()->let_string()) {
ReportMessage(MessageTemplate::kSloppyLexical, NULL);
*ok = false;
return NULL;
}
ExpectSemicolon(CHECK_OK);
return factory()->NewExpressionStatement(expr, pos);
}
......@@ -3497,10 +3467,9 @@ Statement* Parser::ParseForStatement(ZoneList<const AstRawString*>* labels,
Expect(Token::FOR, CHECK_OK);
Expect(Token::LPAREN, CHECK_OK);
for_scope->set_start_position(scanner()->location().beg_pos);
bool is_let_identifier_expression = false;
DeclarationParsingResult parsing_result;
if (peek() != Token::SEMICOLON) {
if (peek() == Token::VAR || (peek() == Token::CONST && allow_const()) ||
if (peek() == Token::VAR || peek() == Token::CONST ||
(peek() == Token::LET && IsNextLetKeyword())) {
ParseVariableDeclarations(kForStatement, &parsing_result, nullptr,
CHECK_OK);
......@@ -3673,10 +3642,6 @@ Statement* Parser::ParseForStatement(ZoneList<const AstRawString*>* labels,
Expression* expression = ParseExpression(false, &classifier, CHECK_OK);
int lhs_end_pos = scanner()->location().end_pos;
ForEachStatement::VisitMode mode = ForEachStatement::ENUMERATE;
is_let_identifier_expression =
expression->IsVariableProxy() &&
expression->AsVariableProxy()->raw_name() ==
ast_value_factory()->let_string();
bool is_for_each = CheckInOrOf(&mode, ok);
if (!*ok) return nullptr;
......@@ -3737,13 +3702,6 @@ Statement* Parser::ParseForStatement(ZoneList<const AstRawString*>* labels,
Target target(&this->target_stack_, loop);
// Parsed initializer at this point.
// Detect attempts at 'let' declarations in sloppy mode.
if (!allow_harmony_sloppy_let() && peek() == Token::IDENTIFIER &&
is_sloppy(language_mode()) && is_let_identifier_expression) {
ReportMessage(MessageTemplate::kSloppyLexical, NULL);
*ok = false;
return NULL;
}
Expect(Token::SEMICOLON, CHECK_OK);
Expression* cond = NULL;
......@@ -4039,42 +3997,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
function_name = ast_value_factory()->empty_string();
}
// Function declarations are function scoped in normal mode, so they are
// hoisted. In harmony block scoping mode they are block scoped, so they
// are not hoisted.
//
// One tricky case are function declarations in a local sloppy-mode eval:
// their declaration is hoisted, but they still see the local scope. E.g.,
//
// function() {
// var x = 0
// try { throw 1 } catch (x) { eval("function g() { return x }") }
// return g()
// }
//
// needs to return 1. To distinguish such cases, we need to detect
// (1) whether a function stems from a sloppy eval, and
// (2) whether it actually hoists across the eval.
// Unfortunately, we do not represent sloppy eval scopes, so we do not have
// either information available directly, especially not when lazily compiling
// a function like 'g'. We hence rely on the following invariants:
// - (1) is the case iff the innermost scope of the deserialized scope chain
// under which we compile is _not_ a declaration scope. This holds because
// in all normal cases, function declarations are fully hoisted to a
// declaration scope and compiled relative to that.
// - (2) is the case iff the current declaration scope is still the original
// one relative to the deserialized scope chain. Otherwise we must be
// compiling a function in an inner declaration scope in the eval, e.g. a
// nested function, and hoisting works normally relative to that.
Scope* declaration_scope = scope_->DeclarationScope();
Scope* original_declaration_scope = original_scope_->DeclarationScope();
Scope* scope = function_type == FunctionLiteral::kDeclaration &&
is_sloppy(language_mode) &&
!allow_harmony_sloppy_function() &&
(original_scope_ == original_declaration_scope ||
declaration_scope != original_declaration_scope)
? NewScope(declaration_scope, FUNCTION_SCOPE, kind)
: NewScope(scope_, FUNCTION_SCOPE, kind);
Scope* scope = NewScope(scope_, FUNCTION_SCOPE, kind);
SetLanguageMode(scope, language_mode);
ZoneList<Statement*>* body = NULL;
int arity = -1;
......@@ -4249,7 +4172,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
CheckStrictOctalLiteral(scope->start_position(), scope->end_position(),
CHECK_OK);
}
if (is_sloppy(language_mode) && allow_harmony_sloppy_function()) {
if (is_sloppy(language_mode)) {
InsertSloppyBlockFunctionVarBindings(scope, CHECK_OK);
}
CheckConflictingVarDeclarations(scope, CHECK_OK);
......@@ -4673,9 +4596,6 @@ PreParser::PreParseResult Parser::ParseLazyFunctionBodyWithPreParser(
reusable_preparser_->set_allow_lazy(true);
#define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name());
SET_ALLOW(natives);
SET_ALLOW(harmony_sloppy);
SET_ALLOW(harmony_sloppy_function);
SET_ALLOW(harmony_sloppy_let);
SET_ALLOW(harmony_do_expressions);
SET_ALLOW(harmony_function_name);
SET_ALLOW(harmony_function_sent);
......
......@@ -182,10 +182,7 @@ PreParser::Statement PreParser::ParseStatementListItem(bool* ok) {
case Token::CLASS:
return ParseClassDeclaration(ok);
case Token::CONST:
if (allow_const()) {
return ParseVariableStatement(kStatementListItem, ok);
}
break;
return ParseVariableStatement(kStatementListItem, ok);
case Token::LET:
if (IsNextLetKeyword()) {
return ParseVariableStatement(kStatementListItem, ok);
......@@ -403,11 +400,6 @@ PreParser::Statement PreParser::ParseFunctionDeclaration(bool* ok) {
PreParser::Statement PreParser::ParseClassDeclaration(bool* ok) {
Expect(Token::CLASS, CHECK_OK);
if (!allow_harmony_sloppy() && is_sloppy(language_mode())) {
ReportMessage(MessageTemplate::kSloppyLexical);
*ok = false;
return Statement::Default();
}
int pos = position();
bool is_strict_reserved = false;
......@@ -473,7 +465,7 @@ PreParser::Statement PreParser::ParseVariableDeclarations(
bool is_pattern = false;
if (peek() == Token::VAR) {
Consume(Token::VAR);
} else if (peek() == Token::CONST && allow_const()) {
} else if (peek() == Token::CONST) {
// TODO(ES6): The ES6 Draft Rev4 section 12.2.2 reads:
//
// ConstDeclaration : const ConstBinding (',' ConstBinding)* ';'
......@@ -485,12 +477,10 @@ PreParser::Statement PreParser::ParseVariableDeclarations(
// existing pages. Therefore we keep allowing const with the old
// non-harmony semantics in sloppy mode.
Consume(Token::CONST);
if (is_strict(language_mode()) || allow_harmony_sloppy()) {
DCHECK(var_context != kStatement);
require_initializer = true;
lexical = true;
}
} else if (peek() == Token::LET && allow_let()) {
DCHECK(var_context != kStatement);
require_initializer = true;
lexical = true;
} else if (peek() == Token::LET) {
Consume(Token::LET);
DCHECK(var_context != kStatement);
lexical = true;
......@@ -606,14 +596,6 @@ PreParser::Statement PreParser::ParseExpressionOrLabelledStatement(
// accept "native function" in the preparser.
}
// Parsed expression statement.
// Detect attempts at 'let' declarations in sloppy mode.
if (!allow_harmony_sloppy_let() && peek() == Token::IDENTIFIER &&
is_sloppy(language_mode()) && expr.IsIdentifier() &&
expr.AsIdentifier().IsLet()) {
ReportMessage(MessageTemplate::kSloppyLexical, NULL);
*ok = false;
return Statement::Default();
}
ExpectSemicolon(CHECK_OK);
return Statement::ExpressionStatement(expr);
}
......@@ -790,10 +772,9 @@ PreParser::Statement PreParser::ParseForStatement(bool* ok) {
Expect(Token::FOR, CHECK_OK);
Expect(Token::LPAREN, CHECK_OK);
bool is_let_identifier_expression = false;
if (peek() != Token::SEMICOLON) {
ForEachStatement::VisitMode mode;
if (peek() == Token::VAR || (peek() == Token::CONST && allow_const()) ||
if (peek() == Token::VAR || peek() == Token::CONST ||
(peek() == Token::LET && IsNextLetKeyword())) {
int decl_count;
bool is_lexical;
......@@ -839,8 +820,6 @@ PreParser::Statement PreParser::ParseForStatement(bool* ok) {
ExpressionClassifier classifier(this);
Expression lhs = ParseExpression(false, &classifier, CHECK_OK);
int lhs_end_pos = scanner()->location().end_pos;
is_let_identifier_expression =
lhs.IsIdentifier() && lhs.AsIdentifier().IsLet();
bool is_for_each = CheckInOrOf(&mode, ok);
if (!*ok) return Statement::Default();
bool is_destructuring = is_for_each &&
......@@ -875,13 +854,6 @@ PreParser::Statement PreParser::ParseForStatement(bool* ok) {
}
// Parsed initializer at this point.
// Detect attempts at 'let' declarations in sloppy mode.
if (!allow_harmony_sloppy_let() && peek() == Token::IDENTIFIER &&
is_sloppy(language_mode()) && is_let_identifier_expression) {
ReportMessage(MessageTemplate::kSloppyLexical, NULL);
*ok = false;
return Statement::Default();
}
Expect(Token::SEMICOLON, CHECK_OK);
if (peek() != Token::SEMICOLON) {
......
......@@ -512,7 +512,6 @@ TEST(RegExpLiteral) {
TEST(ClassLiteral) {
FLAG_harmony_sloppy = true;
const char* src =
"(function(a,b) {"
" class C {"
......
......@@ -61,7 +61,6 @@ std::string Validate(Zone* zone, const char* source,
i::ParseInfo info(zone, script);
i::Parser parser(&info);
parser.set_allow_harmony_sloppy(true);
info.set_global();
info.set_lazy(false);
info.set_allow_lazy_parsing(false);
......
......@@ -31,7 +31,6 @@ static void CollectTypes(HandleAndZoneScope* handles, const char* source,
i::ParseInfo info(handles->main_zone(), script);
i::Parser parser(&info);
parser.set_allow_harmony_sloppy(true);
info.set_global();
info.set_lazy(false);
info.set_allow_lazy_parsing(false);
......
......@@ -1070,7 +1070,6 @@ TEST(ScopeUsesArgumentsSuperThis) {
i::Zone zone(CcTest::i_isolate()->allocator());
i::ParseInfo info(&zone, script);
i::Parser parser(&info);
parser.set_allow_harmony_sloppy(true);
info.set_global();
CHECK(parser.Parse(&info));
CHECK(i::Rewriter::Rewrite(&info));
......@@ -1122,7 +1121,6 @@ static void CheckParsesToNumber(const char* source, bool with_dot) {
i::ParseInfo info(handles.main_zone(), script);
i::Parser parser(&info);
parser.set_allow_harmony_sloppy(true);
info.set_global();
info.set_lazy(false);
info.set_allow_lazy_parsing(false);
......@@ -1438,7 +1436,6 @@ TEST(DiscardFunctionBody) {
i::ParseInfo info(&zone, script);
info.set_allow_lazy_parsing();
i::Parser parser(&info);
parser.set_allow_harmony_sloppy(true);
parser.Parse(&info);
function = info.literal();
CHECK_NOT_NULL(function);
......@@ -1509,8 +1506,6 @@ i::Handle<i::String> FormatMessage(i::Vector<unsigned> data) {
enum ParserFlag {
kAllowLazy,
kAllowNatives,
kAllowHarmonySloppy,
kAllowHarmonySloppyLet,
kAllowHarmonyNewTarget,
kAllowHarmonyFunctionSent,
kAllowHarmonyRestrictiveDeclarations,
......@@ -1528,8 +1523,6 @@ void SetParserFlags(i::ParserBase<Traits>* parser,
i::EnumSet<ParserFlag> flags) {
parser->set_allow_lazy(flags.Contains(kAllowLazy));
parser->set_allow_natives(flags.Contains(kAllowNatives));
parser->set_allow_harmony_sloppy(flags.Contains(kAllowHarmonySloppy));
parser->set_allow_harmony_sloppy_let(flags.Contains(kAllowHarmonySloppyLet));
parser->set_allow_harmony_function_sent(
flags.Contains(kAllowHarmonyFunctionSent));
parser->set_allow_harmony_restrictive_declarations(
......@@ -3942,11 +3935,7 @@ TEST(SuperNoErrors) {
NULL
};
static const ParserFlag always_flags[] = {
kAllowHarmonySloppy
};
RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(context_data, statement_data, kSuccess);
}
......@@ -3973,9 +3962,7 @@ TEST(SuperErrors) {
NULL
};
static const ParserFlag always_flags[] = {kAllowHarmonySloppy};
RunParserSyncTest(context_data, expression_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(context_data, expression_data, kError);
}
......@@ -3989,9 +3976,7 @@ TEST(SuperCall) {
NULL
};
static const ParserFlag always_flags[] = {kAllowHarmonySloppy};
RunParserSyncTest(context_data, success_data, kSuccess, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(context_data, success_data, kSuccess);
const char* error_data[] = {
"class C { constructor() { super(); } }",
......@@ -4013,8 +3998,7 @@ TEST(SuperCall) {
NULL
};
RunParserSyncTest(context_data, error_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(context_data, error_data, kError);
}
......@@ -4039,9 +4023,7 @@ TEST(SuperNewNoErrors) {
NULL
};
static const ParserFlag always_flags[] = {kAllowHarmonySloppy};
RunParserSyncTest(context_data, expression_data, kSuccess, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(context_data, expression_data, kSuccess);
}
......@@ -4072,9 +4054,7 @@ TEST(SuperNewErrors) {
NULL
};
static const ParserFlag always_flags[] = {kAllowHarmonySloppy};
RunParserSyncTest(context_data, statement_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(context_data, statement_data, kError);
}
......@@ -4112,11 +4092,7 @@ TEST(SuperErrorsNonMethods) {
NULL
};
static const ParserFlag always_flags[] = {
kAllowHarmonySloppy
};
RunParserSyncTest(context_data, statement_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(context_data, statement_data, kError);
}
......@@ -4329,9 +4305,7 @@ TEST(ClassExpressionNoErrors) {
"class name extends class base {} {}",
NULL};
static const ParserFlag always_flags[] = {kAllowHarmonySloppy};
RunParserSyncTest(context_data, class_data, kSuccess, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(context_data, class_data, kSuccess);
}
......@@ -4405,11 +4379,7 @@ TEST(ClassBodyNoErrors) {
NULL};
// clang-format on
static const ParserFlag always_flags[] = {
kAllowHarmonySloppy
};
RunParserSyncTest(context_data, class_body_data, kSuccess, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(context_data, class_body_data, kSuccess);
}
......@@ -4462,11 +4432,7 @@ TEST(ClassPropertyNameNoErrors) {
"finally",
NULL};
static const ParserFlag always_flags[] = {
kAllowHarmonySloppy
};
RunParserSyncTest(context_data, name_data, kSuccess, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(context_data, name_data, kSuccess);
}
......@@ -4492,11 +4458,7 @@ TEST(ClassExpressionErrors) {
"class { m() {}, n() {} }", // No commas allowed.
NULL};
static const ParserFlag always_flags[] = {
kAllowHarmonySloppy
};
RunParserSyncTest(context_data, class_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(context_data, class_data, kError);
}
......@@ -4528,11 +4490,7 @@ TEST(ClassDeclarationErrors) {
"class name { *static m() {} }",
NULL};
static const ParserFlag always_flags[] = {
kAllowHarmonySloppy
};
RunParserSyncTest(context_data, class_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(context_data, class_data, kError);
}
......@@ -4557,11 +4515,7 @@ TEST(ClassNameErrors) {
"yield",
NULL};
static const ParserFlag always_flags[] = {
kAllowHarmonySloppy
};
RunParserSyncTest(context_data, class_name, kError, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(context_data, class_name, kError);
}
......@@ -4589,11 +4543,7 @@ TEST(ClassGetterParamNameErrors) {
"yield",
NULL};
static const ParserFlag always_flags[] = {
kAllowHarmonySloppy
};
RunParserSyncTest(context_data, class_name, kError, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(context_data, class_name, kError);
}
......@@ -4616,11 +4566,7 @@ TEST(ClassStaticPrototypeErrors) {
"static *'prot\\u006ftype'() {}",
NULL};
static const ParserFlag always_flags[] = {
kAllowHarmonySloppy
};
RunParserSyncTest(context_data, class_body_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(context_data, class_body_data, kError);
}
......@@ -4642,11 +4588,7 @@ TEST(ClassSpecialConstructorErrors) {
"*'c\\u006fnstructor'() {}",
NULL};
static const ParserFlag always_flags[] = {
kAllowHarmonySloppy
};
RunParserSyncTest(context_data, class_body_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(context_data, class_body_data, kError);
}
......@@ -4663,11 +4605,7 @@ TEST(ClassConstructorNoErrors) {
"static *constructor() {}",
NULL};
static const ParserFlag always_flags[] = {
kAllowHarmonySloppy
};
RunParserSyncTest(context_data, class_body_data, kSuccess, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(context_data, class_body_data, kSuccess);
}
......@@ -4680,11 +4618,7 @@ TEST(ClassMultipleConstructorErrors) {
"constructor() {}; constructor() {}",
NULL};
static const ParserFlag always_flags[] = {
kAllowHarmonySloppy
};
RunParserSyncTest(context_data, class_body_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(context_data, class_body_data, kError);
}
......@@ -4701,11 +4635,7 @@ TEST(ClassMultiplePropertyNamesNoErrors) {
"get m() {}; set m(_) {}; get m() {}; set m(_) {};",
NULL};
static const ParserFlag always_flags[] = {
kAllowHarmonySloppy
};
RunParserSyncTest(context_data, class_body_data, kSuccess, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(context_data, class_body_data, kSuccess);
}
......@@ -4720,11 +4650,7 @@ TEST(ClassesAreStrictErrors) {
"class C { *method() { with ({}) {} } }",
NULL};
static const ParserFlag always_flags[] = {
kAllowHarmonySloppy
};
RunParserSyncTest(context_data, class_body_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(context_data, class_body_data, kError);
}
......@@ -4862,10 +4788,7 @@ TEST(StatementParsingInForIn) {
"for(let x in {}, {}) {}", "for(const x in {}, {}) {}",
NULL};
static const ParserFlag always_flags[] = {kAllowHarmonySloppy,
kAllowHarmonySloppyLet};
RunParserSyncTest(context_data, data, kSuccess, nullptr, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(context_data, data, kSuccess);
}
......@@ -4973,9 +4896,7 @@ TEST(ForInMultipleDeclarationsError) {
"for (const i, j = 1 in {}) {}",
"for (const i, j = void 0 in [1, 2, 3]) {}",
NULL};
static const ParserFlag always_flags[] = {kAllowHarmonySloppy};
RunParserSyncTest(context_data, data, kError, nullptr, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(context_data, data, kError);
}
......@@ -5002,9 +4923,7 @@ TEST(ForOfMultipleDeclarationsError) {
"for (const i, j = 1 of {}) {}",
"for (const i, j = void 0 of [1, 2, 3]) {}",
NULL};
static const ParserFlag always_flags[] = {kAllowHarmonySloppy};
RunParserSyncTest(context_data, data, kError, nullptr, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(context_data, data, kError);
}
......@@ -5019,9 +4938,7 @@ TEST(ForInNoDeclarationsError) {
"for (var in {}) {}",
"for (const in {}) {}",
NULL};
static const ParserFlag always_flags[] = {kAllowHarmonySloppy};
RunParserSyncTest(context_data, data, kError, nullptr, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(context_data, data, kError);
}
......@@ -5036,9 +4953,7 @@ TEST(ForOfNoDeclarationsError) {
"for (var of [1, 2, 3]) {}",
"for (const of [1, 2, 3]) {}",
NULL};
static const ParserFlag always_flags[] = {kAllowHarmonySloppy};
RunParserSyncTest(context_data, data, kError, nullptr, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(context_data, data, kError);
}
......@@ -5052,10 +4967,7 @@ TEST(ForOfInOperator) {
"for(x of 'foo' in {}) {}", "for(var x of 'foo' in {}) {}",
"for(let x of 'foo' in {}) {}", "for(const x of 'foo' in {}) {}", NULL};
static const ParserFlag always_flags[] = {kAllowHarmonySloppy,
kAllowHarmonySloppyLet};
RunParserSyncTest(context_data, data, kSuccess, nullptr, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(context_data, data, kSuccess);
}
......@@ -5066,10 +4978,7 @@ TEST(ForOfYieldIdentifier) {
"for(let x of yield) {}", "for(const x of yield) {}",
NULL};
static const ParserFlag always_flags[] = {kAllowHarmonySloppy,
kAllowHarmonySloppyLet};
RunParserSyncTest(context_data, data, kSuccess, nullptr, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(context_data, data, kSuccess);
}
......@@ -5084,10 +4993,7 @@ TEST(ForOfYieldExpression) {
"function* g() { for(let x of yield) {} }",
"function* g() { for(const x of yield) {} }", NULL};
static const ParserFlag always_flags[] = {kAllowHarmonySloppy,
kAllowHarmonySloppyLet};
RunParserSyncTest(context_data, data, kSuccess, nullptr, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(context_data, data, kSuccess);
}
......@@ -5105,10 +5011,7 @@ TEST(ForOfExpressionError) {
"for(x of { y = 23 }) {}", "for(var x of { y = 23 }) {}",
"for(let x of { y = 23 }) {}", "for(const x of { y = 23 }) {}", NULL};
static const ParserFlag always_flags[] = {kAllowHarmonySloppy,
kAllowHarmonySloppyLet};
RunParserSyncTest(context_data, data, kError, nullptr, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(context_data, data, kError);
}
......@@ -5389,13 +5292,12 @@ TEST(RestParameterInSetterMethodError) {
{nullptr, nullptr}};
const char* data[] = {"...a", "...arguments", "...eval", nullptr};
static const ParserFlag always_flags[] = {kAllowHarmonySloppy};
RunParserSyncTest(context_data, data, kError, nullptr, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(context_data, data, kError);
}
TEST(RestParametersEvalArguments) {
// clang-format off
const char* strict_context_data[][2] =
{{"'use strict';(function(",
"){ return;})(1, [], /regexp/, 'str',function(){});"},
......@@ -5409,8 +5311,10 @@ TEST(RestParametersEvalArguments) {
"...eval",
"eval, ...args",
"...arguments",
"arguments, ...args",
// See https://bugs.chromium.org/p/v8/issues/detail?id=4577
// "arguments, ...args",
NULL};
// clang-format on
// Fail in strict mode
RunParserSyncTest(strict_context_data, data, kError);
......@@ -5477,7 +5381,7 @@ TEST(BadRestSpread) {
"var [...x,] = [1,2,3];", "var [...x, y] = [1,2,3];",
"var {...x} = [1,2,3];", "var { x } = {x: ...[1,2,3]}",
NULL};
RunParserSyncTest(context_data, data, kError, NULL, 0, NULL, 0);
RunParserSyncTest(context_data, data, kError);
}
......@@ -5487,28 +5391,12 @@ TEST(LexicalScopingSloppyMode) {
{"function f() {", "}"},
{"{", "}"},
{NULL, NULL}};
const char* bad_data[] = {
"let x = 1;",
"for(let x = 1;;){}",
"for(let x of []){}",
"for(let x in []){}",
"class C {}",
"class C extends D {}",
"(class {})",
"(class extends D {})",
"(class C {})",
"(class C extends D {})",
NULL};
static const ParserFlag always_false_flags[] = {kAllowHarmonySloppy};
RunParserSyncTest(context_data, bad_data, kError, NULL, 0, NULL, 0,
always_false_flags, arraysize(always_false_flags));
const char* good_data[] = {
"let = 1;",
"for(let = 1;;){}",
NULL};
RunParserSyncTest(context_data, good_data, kSuccess, NULL, 0, NULL, 0,
always_false_flags, arraysize(always_false_flags));
RunParserSyncTest(context_data, good_data, kSuccess);
}
......@@ -5528,11 +5416,7 @@ TEST(ComputedPropertyName) {
"var name",
NULL};
static const ParserFlag always_flags[] = {
kAllowHarmonySloppy,
};
RunParserSyncTest(context_data, error_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(context_data, error_data, kError);
const char* name_data[] = {
"1",
......@@ -5543,8 +5427,7 @@ TEST(ComputedPropertyName) {
"{}",
NULL};
RunParserSyncTest(context_data, name_data, kSuccess, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(context_data, name_data, kSuccess);
}
......@@ -5556,11 +5439,7 @@ TEST(ComputedPropertyNameShorthandError) {
"[1], a: 1",
NULL};
static const ParserFlag always_flags[] = {
kAllowHarmonySloppy,
};
RunParserSyncTest(context_data, error_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(context_data, error_data, kError);
}
......@@ -6206,9 +6085,7 @@ TEST(DestructuringNegativeTests) {
"[ a ]",
NULL};
// clang-format on
static const ParserFlag always_flags[] = {kAllowHarmonySloppyLet};
RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(context_data, data, kError);
}
}
......@@ -6794,16 +6671,10 @@ TEST(NewTarget) {
NULL
};
static const ParserFlag always_flags[] = {
kAllowHarmonyNewTarget,
kAllowHarmonySloppy,
};
// clang-format on
RunParserSyncTest(good_context_data, data, kSuccess, NULL, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(bad_context_data, data, kError, NULL, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(good_context_data, data, kSuccess);
RunParserSyncTest(bad_context_data, data, kError);
}
......@@ -6823,9 +6694,7 @@ TEST(ConstSloppy) {
NULL
};
// clang-format on
static const ParserFlag always_flags[] = {kAllowHarmonySloppy};
RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(context_data, data, kSuccess);
}
......@@ -6848,10 +6717,7 @@ TEST(LetSloppy) {
};
// clang-format on
static const ParserFlag always_flags[] = {kAllowHarmonySloppy,
kAllowHarmonySloppyLet};
RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(context_data, data, kSuccess);
}
......@@ -6897,9 +6763,7 @@ TEST(LanguageModeDirectivesNonSimpleParameterListErrors) {
"{ initializedBindingPattern } = { initializedBindingPattern: true }",
NULL};
static const ParserFlag always_flags[] = {kAllowHarmonySloppy};
RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(context_data, data, kError);
}
......@@ -6927,10 +6791,7 @@ TEST(LetSloppyOnly) {
};
// clang-format on
static const ParserFlag always_flags[] = {kAllowHarmonySloppy,
kAllowHarmonySloppyLet};
RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(context_data, data, kSuccess);
// Some things should be rejected even in sloppy mode
// This addresses BUG(v8:4403).
......@@ -6964,10 +6825,7 @@ TEST(LetSloppyOnly) {
};
// clang-format on
static const ParserFlag fail_flags[] = {kAllowHarmonySloppy,
kAllowHarmonySloppyLet};
RunParserSyncTest(context_data, fail_data, kError, NULL, 0, fail_flags,
arraysize(fail_flags));
RunParserSyncTest(context_data, fail_data, kError);
}
......@@ -7067,13 +6925,9 @@ TEST(EscapedKeywords) {
};
// clang-format on
static const ParserFlag always_flags[] = {kAllowHarmonySloppy};
RunParserSyncTest(sloppy_context_data, fail_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(strict_context_data, fail_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
RunModuleParserSyncTest(sloppy_context_data, fail_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(sloppy_context_data, fail_data, kError);
RunParserSyncTest(strict_context_data, fail_data, kError);
RunModuleParserSyncTest(sloppy_context_data, fail_data, kError);
// clang-format off
const char* let_data[] = {
......@@ -7084,15 +6938,8 @@ TEST(EscapedKeywords) {
};
// clang-format on
RunParserSyncTest(sloppy_context_data, let_data, kSuccess, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(strict_context_data, let_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
static const ParserFlag sloppy_let_flags[] = {kAllowHarmonySloppy,
kAllowHarmonySloppyLet};
RunParserSyncTest(sloppy_context_data, let_data, kSuccess, NULL, 0,
sloppy_let_flags, arraysize(sloppy_let_flags));
RunParserSyncTest(sloppy_context_data, let_data, kSuccess);
RunParserSyncTest(strict_context_data, let_data, kError);
// Non-errors in sloppy mode
const char* valid_data[] = {"(\\u0069mplements = 1);",
......@@ -7117,12 +6964,9 @@ TEST(EscapedKeywords) {
"var st\\u0061tic = 1;",
"var { st\\u0061tic } = {};",
NULL};
RunParserSyncTest(sloppy_context_data, valid_data, kSuccess, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(strict_context_data, valid_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
RunModuleParserSyncTest(strict_context_data, valid_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
RunParserSyncTest(sloppy_context_data, valid_data, kSuccess);
RunParserSyncTest(strict_context_data, valid_data, kError);
RunModuleParserSyncTest(strict_context_data, valid_data, kError);
}
......
......@@ -271,7 +271,6 @@ TEST(ResetTypingInfo) {
i::ParseInfo info(handles.main_zone(), script);
i::Parser parser(&info);
parser.set_allow_harmony_sloppy(true);
info.set_global();
info.set_lazy(false);
info.set_allow_lazy_parsing(false);
......
// 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-sloppy
function f() {
const a;
}
......@@ -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-sloppy --harmony-sloppy-let
//
let [let];
......@@ -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-sloppy --harmony-sloppy-let
//
let {let};
......@@ -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-sloppy --harmony-sloppy-let
//
let let;
// 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: --no-harmony-sloppy --no-harmony-sloppy-let
// Flags: --no-harmony-sloppy-function
const = 42;
*%(basename)s:8: SyntaxError: Unexpected token const
const = 42;
^^^^^
SyntaxError: Unexpected token const
// 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: --no-harmony-sloppy --no-harmony-sloppy-let
// Flags: --no-harmony-sloppy-function
const
*%(basename)s:8: SyntaxError: Unexpected token const
const
^^^^^
SyntaxError: Unexpected token const
// 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: --no-harmony-sloppy --no-harmony-sloppy-let
// Flags: --no-harmony-sloppy-function
const x = 42;
*%(basename)s:8: SyntaxError: Unexpected token const
const x = 42;
^^^^^
SyntaxError: Unexpected token const
......@@ -4,8 +4,6 @@
// Test for conflicting variable bindings.
// Flags: --harmony-sloppy --harmony-sloppy-let --harmony-sloppy-function
function CheckException(e) {
var string = e.toString();
assertTrue(string.indexOf("has already been declared") >= 0 ||
......
......@@ -25,8 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-sloppy --harmony-sloppy-let
// Test that we throw early syntax errors in harmony mode
// when using an immutable binding in an assigment or with
// prefix/postfix decrement/increment operators.
......
// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --no-harmony-sloppy-let
function CheckException(e) {
var string = e.toString();
assertInstanceof(e, SyntaxError);
}
function Check(str) {
try {
eval("(function () { " + str + " })");
assertUnreachable();
} catch (e) {
CheckException(e);
}
try {
eval("(function () { { " + str + " } })");
assertUnreachable();
} catch (e) {
CheckException(e);
}
}
// Check for early syntax errors when using let
// declarations outside of strict mode.
Check("let x;");
Check("let x = 1;");
Check("let x, y;");
......@@ -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-sloppy --harmony-sloppy-let --harmony-sloppy-function
// Var-let conflict in a function throws, even if the var is in an eval
// Throws at the top level of a function
......
......@@ -25,8 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-sloppy --harmony-sloppy-let
function props(x) {
var array = [];
for (let p in x) array.push(p);
......
......@@ -25,8 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-sloppy --harmony-sloppy-let
// We want to test the context chain shape. In each of the tests cases
// below, the outer with is to force a runtime lookup of the identifier 'x'
// to actually verify that the inner context has been discarded. A static
......
......@@ -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-sloppy --harmony-sloppy-let
// let is usable as a variable with var, but not let or ES6 const
(function (){
......
......@@ -26,7 +26,6 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax
// Flags: --harmony-sloppy --harmony-sloppy-let
// Check that the following functions are optimizable.
var functions = [ f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14,
......
......@@ -27,8 +27,6 @@
// Test let declarations in various settings.
// Flags: --harmony-sloppy --harmony-sloppy-let
// Global
let x;
let y = 2;
......
......@@ -25,8 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-sloppy --harmony-sloppy-let --harmony-sloppy-function
// Test temporal dead zone semantics of let bound variables in
// function and block scopes.
......
// Copyright 2014 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: --no-harmony-sloppy-let --no-harmony-sloppy-function
// Flags: --no-harmony-sloppy
function CheckError(source) {
var exception = null;
try {
eval(source);
} catch (e) {
exception = e;
}
assertNotNull(exception);
assertEquals(
"Block-scoped declarations (let, const, function, class) not yet supported outside strict mode",
exception.message);
}
function CheckOk(source) {
eval(source);
}
CheckError("let x = 1;");
CheckError("{ let x = 1; }");
CheckError("function f() { let x = 1; }");
CheckError("for (let x = 1; x < 1; x++) {}");
CheckError("for (let x of []) {}");
CheckError("for (let x in []) {}");
CheckError("class C {}");
CheckError("class C extends Array {}");
CheckError("(class {});");
CheckError("(class extends Array {});");
CheckError("(class C {});");
CheckError("(class C exends Array {});");
CheckOk("let = 1;");
CheckOk("{ let = 1; }");
CheckOk("function f() { let = 1; }");
CheckOk("for (let = 1; let < 1; let++) {}");
......@@ -4,8 +4,6 @@
// Test for conflicting variable bindings.
// Flags: --harmony-sloppy --harmony-sloppy-function
function AssertEqualsStrictAndSloppy(value, code) {
assertEquals(value, eval("(function() {" + code + "})()"));
assertEquals(value, eval("(function() { 'use strict'; " + code + "})()"));
......
......@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax --harmony-sloppy --harmony-sloppy-let --harmony-sloppy-function
// Flags: --allow-natives-syntax
// Test functionality of block scopes.
// Hoisting of var declarations.
......
......@@ -3,7 +3,6 @@
// found in the LICENSE file.
// Flags: --min-preparse-length=0
// Flags: --harmony-sloppy --harmony-sloppy-let
let xxx = 1;
let f = undefined;
......
......@@ -2,9 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-sloppy --harmony-sloppy-let
// Flags: --harmony-sloppy-function
// 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
......
......@@ -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-sloppy
// Flags: --allow-natives-syntax
......
......@@ -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-sloppy
(function Method() {
class C {
......
......@@ -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-sloppy
class Base {}
......
......@@ -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-function-name --allow-natives-syntax
// Flags: --allow-natives-syntax
(function TestBasics() {
var C = class C {}
......
......@@ -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-sloppy-let
function assertUndef(x) {
assertEquals(undefined, x);
......
// 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-sloppy
assertEquals("function", (function f() { f = 42; return typeof f })());
assertEquals("function",
......
......@@ -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-sloppy
(function testConstructClassStrict() {
"use strict";
......
......@@ -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-sloppy
(function testCallSuperPropertyStrict() {
"use strict";
class BaseClass {
......
......@@ -3,7 +3,6 @@
// found in the LICENSE file.
// Flags: --allow-natives-syntax
// Flags: --harmony-sloppy
(function TestSuperNamedLoads() {
function Base() { }
......
......@@ -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-do-expressions --harmony-sloppy-let --allow-natives-syntax
// Flags: --harmony-do-expressions --allow-natives-syntax
function returnValue(v) { return v; }
function MyError() {}
......
......@@ -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-sloppy --harmony-sloppy-let
// See: http://code.google.com/p/v8/issues/detail?id=3926
// Switch statements should disable hole check elimination
......
......@@ -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-sloppy-function
// In sloppy mode we allow function redeclarations within blocks for webcompat.
(function() {
......
......@@ -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-sloppy-let --harmony-sloppy
// Test that hoisting a function out of a lexical scope does not
// lead to a parsing error
......
......@@ -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-sloppy --harmony-sloppy-function --harmony-sloppy-let
// Flags: --no-harmony-restrictive-declarations
// At some point, this code led to DCHECK errors in debug mode
......
......@@ -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-sloppy --harmony-sloppy-function
// Flags: --no-harmony-restrictive-declarations
// Previously, this caused a CHECK fail in debug mode
......
......@@ -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-sloppy --harmony-sloppy-function
// Flags: --no-harmony-restrictive-declarations
(function() {
......
......@@ -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-sloppy
assertThrows(function f() {
var t = { toString: function() { throw new Error(); } };
var o = { [t]: 23 };
......
......@@ -21,8 +21,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-sloppy
description('Tests for ES6 class constructor return values');
// ES6
......
......@@ -21,8 +21,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-sloppy
description('Tests for calling the constructors of ES6 classes');
class A { constructor() {} };
......
......@@ -21,8 +21,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-sloppy
description('Tests for ES6 class syntax declarations');
var constructorCallCount = 0;
......
......@@ -21,8 +21,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-sloppy
description('Tests for ES6 class syntax default constructor');
class A { };
......
......@@ -21,8 +21,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-sloppy
description('Tests for ES6 class syntax expressions');
var constructorCallCount = 0;
......
......@@ -21,8 +21,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-sloppy
description('Tests for ES6 class syntax "extends"');
class Base {
......
......@@ -21,8 +21,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-sloppy
description('Tests for ES6 class name semantics in class statements and expressions');
function runTestShouldBe(statement, result) {
......
......@@ -21,8 +21,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-sloppy
description('Tests for the descriptors of the properties implicitly defined by ES6 class syntax');
function descriptor(object, propertyName) {
......
......@@ -21,8 +21,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-sloppy
description('Tests for scoping of variables in ES6 class syntax');
var local = "FAIL";
......
......@@ -21,8 +21,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-sloppy
description('Tests for ES6 class syntax containing semicolon in the class body');
shouldThrow("class A { foo;() { } }", "'SyntaxError: Unexpected token ;'");
......
......@@ -21,8 +21,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-sloppy
description('Tests for ES6 class syntax "super"');
var baseMethodValue = {};
......
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