Remove --harmony-scoping flag.
We have been shipping harmony scoping for 2 Chrome releases now (M41 and M42). Time to remove the flag. R=rossberg@chromium.org LOG=Y Review URL: https://codereview.chromium.org/1007783002 Cr-Commit-Position: refs/heads/master@{#27187}
This commit is contained in:
parent
ec73e08860
commit
92138c73a7
@ -195,7 +195,7 @@ void FullCodeGenerator::Generate() {
|
||||
// Argument to NewContext is the function, which is still in r1.
|
||||
Comment cmnt(masm_, "[ Allocate context");
|
||||
bool need_write_barrier = true;
|
||||
if (FLAG_harmony_scoping && info->scope()->is_script_scope()) {
|
||||
if (info->scope()->is_script_scope()) {
|
||||
__ push(r1);
|
||||
__ Push(info->scope()->GetScopeInfo(info->isolate()));
|
||||
__ CallRuntime(Runtime::kNewScriptContext, 2);
|
||||
|
@ -196,7 +196,7 @@ void FullCodeGenerator::Generate() {
|
||||
// Argument to NewContext is the function, which is still in x1.
|
||||
Comment cmnt(masm_, "[ Allocate context");
|
||||
bool need_write_barrier = true;
|
||||
if (FLAG_harmony_scoping && info->scope()->is_script_scope()) {
|
||||
if (info->scope()->is_script_scope()) {
|
||||
__ Mov(x10, Operand(info->scope()->GetScopeInfo(info->isolate())));
|
||||
__ Push(x1, x10);
|
||||
__ CallRuntime(Runtime::kNewScriptContext, 2);
|
||||
|
@ -1651,7 +1651,6 @@ void Genesis::InitializeBuiltinTypedArrays() {
|
||||
#define EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(id) \
|
||||
void Genesis::InstallNativeFunctions_##id() {}
|
||||
|
||||
EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_scoping)
|
||||
EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_modules)
|
||||
EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_strings)
|
||||
EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_arrays)
|
||||
@ -1684,7 +1683,6 @@ void Genesis::InstallNativeFunctions_harmony_proxies() {
|
||||
#define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \
|
||||
void Genesis::InitializeGlobal_##id() {}
|
||||
|
||||
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_scoping)
|
||||
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_modules)
|
||||
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_strings)
|
||||
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_arrays)
|
||||
@ -2272,7 +2270,6 @@ bool Genesis::InstallExperimentalNatives() {
|
||||
NULL};
|
||||
static const char* harmony_classes_natives[] = {NULL};
|
||||
static const char* harmony_modules_natives[] = {NULL};
|
||||
static const char* harmony_scoping_natives[] = {NULL};
|
||||
static const char* harmony_object_literals_natives[] = {NULL};
|
||||
static const char* harmony_regexps_natives[] = {
|
||||
"native harmony-regexp.js", NULL};
|
||||
|
@ -279,7 +279,7 @@ Handle<Object> Context::Lookup(Handle<String> name,
|
||||
|
||||
// 2. Check the context proper if it has slots.
|
||||
if (context->IsFunctionContext() || context->IsBlockContext() ||
|
||||
(FLAG_harmony_scoping && context->IsScriptContext())) {
|
||||
context->IsScriptContext()) {
|
||||
// Use serialized scope information of functions and blocks to search
|
||||
// for the context index.
|
||||
Handle<ScopeInfo> scope_info;
|
||||
|
@ -182,17 +182,17 @@ DEFINE_IMPLICATION(harmony, es_staging)
|
||||
DEFINE_IMPLICATION(es_staging, harmony)
|
||||
|
||||
// Features that are still work in progress (behind individual flags).
|
||||
#define HARMONY_INPROGRESS(V) \
|
||||
V(harmony_modules, "harmony modules (implies block scoping)") \
|
||||
V(harmony_arrays, "harmony array methods") \
|
||||
V(harmony_array_includes, "harmony Array.prototype.includes") \
|
||||
V(harmony_regexps, "harmony regular expression extensions") \
|
||||
V(harmony_arrow_functions, "harmony arrow functions") \
|
||||
V(harmony_proxies, "harmony proxies") \
|
||||
V(harmony_sloppy, "harmony features in sloppy mode") \
|
||||
V(harmony_unicode, "harmony unicode escapes") \
|
||||
V(harmony_unicode_regexps, "harmony unicode regexps") \
|
||||
V(harmony_rest_parameters, "harmony rest parameters") \
|
||||
#define HARMONY_INPROGRESS(V) \
|
||||
V(harmony_modules, "harmony modules") \
|
||||
V(harmony_arrays, "harmony array methods") \
|
||||
V(harmony_array_includes, "harmony Array.prototype.includes") \
|
||||
V(harmony_regexps, "harmony regular expression extensions") \
|
||||
V(harmony_arrow_functions, "harmony arrow functions") \
|
||||
V(harmony_proxies, "harmony proxies") \
|
||||
V(harmony_sloppy, "harmony features in sloppy mode") \
|
||||
V(harmony_unicode, "harmony unicode escapes") \
|
||||
V(harmony_unicode_regexps, "harmony unicode regexps") \
|
||||
V(harmony_rest_parameters, "harmony rest parameters")
|
||||
|
||||
// Features that are complete (but still behind --harmony/es-staging flag).
|
||||
#define HARMONY_STAGED(V) \
|
||||
@ -200,14 +200,12 @@ DEFINE_IMPLICATION(es_staging, harmony)
|
||||
V(harmony_tostring, "harmony toString")
|
||||
|
||||
// Features that are shipping (turned on by default, but internal flag remains).
|
||||
#define HARMONY_SHIPPING(V) \
|
||||
V(harmony_numeric_literals, "harmony numeric literals") \
|
||||
V(harmony_strings, "harmony string methods") \
|
||||
V(harmony_scoping, "harmony block scoping") \
|
||||
V(harmony_templates, "harmony template literals") \
|
||||
V(harmony_classes, \
|
||||
"harmony classes (implies block scoping & object literal extension)") \
|
||||
V(harmony_object_literals, "harmony object literal extensions") \
|
||||
#define HARMONY_SHIPPING(V) \
|
||||
V(harmony_numeric_literals, "harmony numeric literals") \
|
||||
V(harmony_strings, "harmony string methods") \
|
||||
V(harmony_templates, "harmony template literals") \
|
||||
V(harmony_classes, "harmony classes (implies object literal extension)") \
|
||||
V(harmony_object_literals, "harmony object literal extensions")
|
||||
|
||||
// Once a shipping feature has proved stable in the wild, it will be dropped
|
||||
// from HARMONY_SHIPPING, all occurrences of the FLAG_ variable are removed,
|
||||
@ -234,8 +232,6 @@ HARMONY_SHIPPING(FLAG_SHIPPING_FEATURES)
|
||||
|
||||
|
||||
// Feature dependencies.
|
||||
DEFINE_IMPLICATION(harmony_modules, harmony_scoping)
|
||||
DEFINE_IMPLICATION(harmony_classes, harmony_scoping)
|
||||
DEFINE_IMPLICATION(harmony_classes, harmony_object_literals)
|
||||
DEFINE_IMPLICATION(harmony_unicode_regexps, harmony_unicode)
|
||||
|
||||
|
@ -5318,7 +5318,8 @@ void HOptimizedGraphBuilder::VisitVariableProxy(VariableProxy* expr) {
|
||||
|
||||
Handle<GlobalObject> global(current_info()->global_object());
|
||||
|
||||
if (FLAG_harmony_scoping) {
|
||||
// Lookup in script contexts.
|
||||
{
|
||||
Handle<ScriptContextTable> script_contexts(
|
||||
global->native_context()->script_context_table());
|
||||
ScriptContextTable::LookupResult lookup;
|
||||
@ -6478,7 +6479,8 @@ void HOptimizedGraphBuilder::HandleGlobalVariableAssignment(
|
||||
BailoutId ast_id) {
|
||||
Handle<GlobalObject> global(current_info()->global_object());
|
||||
|
||||
if (FLAG_harmony_scoping) {
|
||||
// Lookup in script contexts.
|
||||
{
|
||||
Handle<ScriptContextTable> script_contexts(
|
||||
global->native_context()->script_context_table());
|
||||
ScriptContextTable::LookupResult lookup;
|
||||
|
@ -188,7 +188,7 @@ void FullCodeGenerator::Generate() {
|
||||
Comment cmnt(masm_, "[ Allocate context");
|
||||
bool need_write_barrier = true;
|
||||
// Argument to NewContext is the function, which is still in edi.
|
||||
if (FLAG_harmony_scoping && info->scope()->is_script_scope()) {
|
||||
if (info->scope()->is_script_scope()) {
|
||||
__ push(edi);
|
||||
__ Push(info->scope()->GetScopeInfo(info->isolate()));
|
||||
__ CallRuntime(Runtime::kNewScriptContext, 2);
|
||||
|
@ -722,7 +722,7 @@ MaybeHandle<Object> LoadIC::Load(Handle<Object> object, Handle<Name> name) {
|
||||
|
||||
bool use_ic = MigrateDeprecated(object) ? false : FLAG_use_ic;
|
||||
|
||||
if (FLAG_harmony_scoping && object->IsGlobalObject() && name->IsString()) {
|
||||
if (object->IsGlobalObject() && name->IsString()) {
|
||||
// Look up in script context table.
|
||||
Handle<String> str_name = Handle<String>::cast(name);
|
||||
Handle<GlobalObject> global = Handle<GlobalObject>::cast(object);
|
||||
@ -1543,7 +1543,7 @@ bool StoreIC::LookupForWrite(LookupIterator* it, Handle<Object> value,
|
||||
MaybeHandle<Object> StoreIC::Store(Handle<Object> object, Handle<Name> name,
|
||||
Handle<Object> value,
|
||||
JSReceiver::StoreFromKeyed store_mode) {
|
||||
if (FLAG_harmony_scoping && object->IsGlobalObject() && name->IsString()) {
|
||||
if (object->IsGlobalObject() && name->IsString()) {
|
||||
// Look up in script context table.
|
||||
Handle<String> str_name = Handle<String>::cast(name);
|
||||
Handle<GlobalObject> global = Handle<GlobalObject>::cast(object);
|
||||
|
@ -156,7 +156,6 @@ var kMessages = {
|
||||
template_octal_literal: ["Octal literals are not allowed in template strings."],
|
||||
strict_delete: ["Delete of an unqualified identifier in strict mode."],
|
||||
strict_delete_property: ["Cannot delete property '", "%0", "' of ", "%1"],
|
||||
strict_const: ["Use of const in strict mode."],
|
||||
strict_function: ["In strict mode code, functions can only be declared at top level or immediately within another function." ],
|
||||
strict_read_only_property: ["Cannot assign to read only property '", "%0", "' of ", "%1"],
|
||||
strict_cannot_assign: ["Cannot assign to read only '", "%0", "' in strict mode"],
|
||||
|
@ -204,7 +204,7 @@ void FullCodeGenerator::Generate() {
|
||||
Comment cmnt(masm_, "[ Allocate context");
|
||||
// Argument to NewContext is the function, which is still in a1.
|
||||
bool need_write_barrier = true;
|
||||
if (FLAG_harmony_scoping && info->scope()->is_script_scope()) {
|
||||
if (info->scope()->is_script_scope()) {
|
||||
__ push(a1);
|
||||
__ Push(info->scope()->GetScopeInfo(info->isolate()));
|
||||
__ CallRuntime(Runtime::kNewScriptContext, 2);
|
||||
|
@ -201,7 +201,7 @@ void FullCodeGenerator::Generate() {
|
||||
Comment cmnt(masm_, "[ Allocate context");
|
||||
// Argument to NewContext is the function, which is still in a1.
|
||||
bool need_write_barrier = true;
|
||||
if (FLAG_harmony_scoping && info->scope()->is_script_scope()) {
|
||||
if (info->scope()->is_script_scope()) {
|
||||
__ push(a1);
|
||||
__ Push(info->scope()->GetScopeInfo(info->isolate()));
|
||||
__ CallRuntime(Runtime::kNewScriptContext, 2);
|
||||
|
@ -5602,7 +5602,7 @@ bool JSObject::ReferencesObject(Object* obj) {
|
||||
if (context->has_extension() && !context->IsCatchContext()) {
|
||||
// With harmony scoping, a JSFunction may have a global context.
|
||||
// TODO(mvstanton): walk into the ScopeInfo.
|
||||
if (FLAG_harmony_scoping && context->IsScriptContext()) {
|
||||
if (context->IsScriptContext()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -870,7 +870,6 @@ Parser::Parser(ParseInfo* info)
|
||||
DCHECK(!info->script().is_null() || info->source_stream() != NULL);
|
||||
set_allow_lazy(info->allow_lazy_parsing());
|
||||
set_allow_natives(FLAG_allow_natives_syntax || info->is_native());
|
||||
set_allow_harmony_scoping(!info->is_native() && FLAG_harmony_scoping);
|
||||
set_allow_harmony_modules(!info->is_native() && FLAG_harmony_modules);
|
||||
set_allow_harmony_arrow_functions(FLAG_harmony_arrow_functions);
|
||||
set_allow_harmony_numeric_literals(FLAG_harmony_numeric_literals);
|
||||
@ -1026,9 +1025,6 @@ FunctionLiteral* Parser::DoParseProgram(ParseInfo* info, Scope** scope,
|
||||
|
||||
if (ok && is_strict(language_mode())) {
|
||||
CheckStrictOctalLiteral(beg_pos, scanner()->location().end_pos, &ok);
|
||||
}
|
||||
|
||||
if (ok && allow_harmony_scoping() && is_strict(language_mode())) {
|
||||
CheckConflictingVarDeclarations(scope_, &ok);
|
||||
}
|
||||
|
||||
@ -1290,7 +1286,6 @@ Statement* Parser::ParseStatementListItem(bool* ok) {
|
||||
case Token::VAR:
|
||||
return ParseVariableStatement(kStatementListItem, NULL, ok);
|
||||
case Token::LET:
|
||||
DCHECK(allow_harmony_scoping());
|
||||
if (is_strict(language_mode())) {
|
||||
return ParseVariableStatement(kStatementListItem, NULL, ok);
|
||||
}
|
||||
@ -1911,7 +1906,7 @@ Variable* Parser::Declare(Declaration* declaration, bool resolve, bool* ok) {
|
||||
// because the var declaration is hoisted to the function scope where 'x'
|
||||
// is already bound.
|
||||
DCHECK(IsDeclaredVariableMode(var->mode()));
|
||||
if (allow_harmony_scoping() && is_strict(language_mode())) {
|
||||
if (is_strict(language_mode())) {
|
||||
// In harmony we treat re-declarations as early errors. See
|
||||
// ES5 16 for a definition of early errors.
|
||||
ParserTraits::ReportMessage("var_redeclaration", name);
|
||||
@ -2062,12 +2057,13 @@ Statement* Parser::ParseFunctionDeclaration(
|
||||
// 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_strong(language_mode()) ? CONST :
|
||||
allow_harmony_scoping() && is_strict(language_mode()) &&
|
||||
!(scope_->is_script_scope() || scope_->is_eval_scope() ||
|
||||
scope_->is_function_scope())
|
||||
? LET
|
||||
: VAR;
|
||||
is_strong(language_mode())
|
||||
? CONST
|
||||
: is_strict(language_mode()) &&
|
||||
!(scope_->is_script_scope() || scope_->is_eval_scope() ||
|
||||
scope_->is_function_scope())
|
||||
? LET
|
||||
: VAR;
|
||||
VariableProxy* proxy = NewUnresolved(name, mode);
|
||||
Declaration* declaration =
|
||||
factory()->NewFunctionDeclaration(proxy, mode, fun, scope_, pos);
|
||||
@ -2124,7 +2120,7 @@ Statement* Parser::ParseClassDeclaration(ZoneList<const AstRawString*>* names,
|
||||
|
||||
|
||||
Block* Parser::ParseBlock(ZoneList<const AstRawString*>* labels, bool* ok) {
|
||||
if (allow_harmony_scoping() && is_strict(language_mode())) {
|
||||
if (is_strict(language_mode())) {
|
||||
return ParseScopedBlock(labels, ok);
|
||||
}
|
||||
|
||||
@ -2246,19 +2242,12 @@ Block* Parser::ParseVariableDeclarations(
|
||||
init_op = Token::INIT_CONST_LEGACY;
|
||||
} else {
|
||||
DCHECK(var_context != kStatement);
|
||||
// In ES5 const is not allowed in strict mode.
|
||||
if (!allow_harmony_scoping()) {
|
||||
ReportMessage("strict_const");
|
||||
*ok = false;
|
||||
return NULL;
|
||||
}
|
||||
mode = CONST;
|
||||
init_op = Token::INIT_CONST;
|
||||
}
|
||||
is_const = true;
|
||||
needs_init = true;
|
||||
} else if (peek() == Token::LET && is_strict(language_mode())) {
|
||||
DCHECK(allow_harmony_scoping());
|
||||
Consume(Token::LET);
|
||||
DCHECK(var_context != kStatement);
|
||||
mode = LET;
|
||||
@ -3733,13 +3722,12 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
|
||||
// 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::DECLARATION &&
|
||||
(!allow_harmony_scoping() || is_sloppy(language_mode())) &&
|
||||
(original_scope_ == original_declaration_scope ||
|
||||
declaration_scope != original_declaration_scope)
|
||||
? NewScope(declaration_scope, FUNCTION_SCOPE, kind)
|
||||
: NewScope(scope_, FUNCTION_SCOPE, kind);
|
||||
Scope* scope = function_type == FunctionLiteral::DECLARATION &&
|
||||
is_sloppy(language_mode()) &&
|
||||
(original_scope_ == original_declaration_scope ||
|
||||
declaration_scope != original_declaration_scope)
|
||||
? NewScope(declaration_scope, FUNCTION_SCOPE, kind)
|
||||
: NewScope(scope_, FUNCTION_SCOPE, kind);
|
||||
ZoneList<Statement*>* body = NULL;
|
||||
int materialized_literal_count = -1;
|
||||
int expected_property_count = -1;
|
||||
@ -3847,12 +3835,11 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
|
||||
Variable* fvar = NULL;
|
||||
Token::Value fvar_init_op = Token::INIT_CONST_LEGACY;
|
||||
if (function_type == FunctionLiteral::NAMED_EXPRESSION) {
|
||||
if (allow_harmony_scoping() && is_strict(language_mode())) {
|
||||
if (is_strict(language_mode())) {
|
||||
fvar_init_op = Token::INIT_CONST;
|
||||
}
|
||||
VariableMode fvar_mode =
|
||||
allow_harmony_scoping() && is_strict(language_mode()) ? CONST
|
||||
: CONST_LEGACY;
|
||||
is_strict(language_mode()) ? CONST : CONST_LEGACY;
|
||||
DCHECK(function_name != NULL);
|
||||
fvar = new (zone())
|
||||
Variable(scope_, function_name, fvar_mode, true /* is valid LHS */,
|
||||
@ -3926,7 +3913,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
|
||||
CheckStrictOctalLiteral(scope->start_position(), scope->end_position(),
|
||||
CHECK_OK);
|
||||
}
|
||||
if (allow_harmony_scoping() && is_strict(language_mode())) {
|
||||
if (is_strict(language_mode())) {
|
||||
CheckConflictingVarDeclarations(scope, CHECK_OK);
|
||||
}
|
||||
}
|
||||
@ -4126,7 +4113,6 @@ PreParser::PreParseResult Parser::ParseLazyFunctionBodyWithPreParser(
|
||||
NULL, stack_limit_);
|
||||
reusable_preparser_->set_allow_lazy(true);
|
||||
reusable_preparser_->set_allow_natives(allow_natives());
|
||||
reusable_preparser_->set_allow_harmony_scoping(allow_harmony_scoping());
|
||||
reusable_preparser_->set_allow_harmony_modules(allow_harmony_modules());
|
||||
reusable_preparser_->set_allow_harmony_arrow_functions(
|
||||
allow_harmony_arrow_functions());
|
||||
|
@ -200,7 +200,7 @@ void FullCodeGenerator::Generate() {
|
||||
// Argument to NewContext is the function, which is still in r4.
|
||||
Comment cmnt(masm_, "[ Allocate context");
|
||||
bool need_write_barrier = true;
|
||||
if (FLAG_harmony_scoping && info->scope()->is_script_scope()) {
|
||||
if (info->scope()->is_script_scope()) {
|
||||
__ push(r4);
|
||||
__ Push(info->scope()->GetScopeInfo(info->isolate()));
|
||||
__ CallRuntime(Runtime::kNewScriptContext, 2);
|
||||
|
@ -174,7 +174,6 @@ PreParser::Statement PreParser::ParseStatementListItem(bool* ok) {
|
||||
case Token::CONST:
|
||||
return ParseVariableStatement(kStatementListItem, ok);
|
||||
case Token::LET:
|
||||
DCHECK(allow_harmony_scoping());
|
||||
if (is_strict(language_mode())) {
|
||||
return ParseVariableStatement(kStatementListItem, ok);
|
||||
}
|
||||
@ -383,7 +382,7 @@ PreParser::Statement PreParser::ParseBlock(bool* ok) {
|
||||
//
|
||||
Expect(Token::LBRACE, CHECK_OK);
|
||||
while (peek() != Token::RBRACE) {
|
||||
if (allow_harmony_scoping() && is_strict(language_mode())) {
|
||||
if (is_strict(language_mode())) {
|
||||
ParseStatementListItem(CHECK_OK);
|
||||
} else {
|
||||
ParseStatement(CHECK_OK);
|
||||
@ -456,12 +455,6 @@ PreParser::Statement PreParser::ParseVariableDeclarations(
|
||||
Consume(Token::CONST);
|
||||
if (is_strict(language_mode())) {
|
||||
DCHECK(var_context != kStatement);
|
||||
if (!allow_harmony_scoping()) {
|
||||
Scanner::Location location = scanner()->peek_location();
|
||||
ReportMessageAt(location, "strict_const");
|
||||
*ok = false;
|
||||
return Statement::Default();
|
||||
}
|
||||
is_strict_const = true;
|
||||
require_initializer = var_context != kForStatement;
|
||||
}
|
||||
|
@ -100,7 +100,6 @@ class ParserBase : public Traits {
|
||||
return allow_harmony_arrow_functions_;
|
||||
}
|
||||
bool allow_harmony_modules() const { return scanner()->HarmonyModules(); }
|
||||
bool allow_harmony_scoping() const { return scanner()->HarmonyScoping(); }
|
||||
bool allow_harmony_numeric_literals() const {
|
||||
return scanner()->HarmonyNumericLiterals();
|
||||
}
|
||||
@ -130,9 +129,6 @@ class ParserBase : public Traits {
|
||||
void set_allow_harmony_modules(bool allow) {
|
||||
scanner()->SetHarmonyModules(allow);
|
||||
}
|
||||
void set_allow_harmony_scoping(bool allow) {
|
||||
scanner()->SetHarmonyScoping(allow);
|
||||
}
|
||||
void set_allow_harmony_numeric_literals(bool allow) {
|
||||
scanner()->SetHarmonyNumericLiterals(allow);
|
||||
}
|
||||
@ -2942,10 +2938,8 @@ ParserBase<Traits>::ParseArrowFunctionLiteral(int start_pos,
|
||||
if (is_strict(language_mode())) {
|
||||
CheckStrictOctalLiteral(start_pos, scanner()->location().end_pos,
|
||||
CHECK_OK);
|
||||
}
|
||||
|
||||
if (allow_harmony_scoping() && is_strict(language_mode()))
|
||||
this->CheckConflictingVarDeclarations(scope, CHECK_OK);
|
||||
}
|
||||
}
|
||||
|
||||
FunctionLiteralT function_literal = factory()->NewFunctionLiteral(
|
||||
|
142
src/scanner.cc
142
src/scanner.cc
@ -35,7 +35,6 @@ Handle<String> LiteralBuffer::Internalize(Isolate* isolate) const {
|
||||
Scanner::Scanner(UnicodeCache* unicode_cache)
|
||||
: unicode_cache_(unicode_cache),
|
||||
octal_pos_(Location::invalid()),
|
||||
harmony_scoping_(false),
|
||||
harmony_modules_(false),
|
||||
harmony_numeric_literals_(false),
|
||||
harmony_classes_(false),
|
||||
@ -1089,79 +1088,77 @@ uc32 Scanner::ScanUnicodeEscape() {
|
||||
// ----------------------------------------------------------------------------
|
||||
// Keyword Matcher
|
||||
|
||||
#define KEYWORDS(KEYWORD_GROUP, KEYWORD) \
|
||||
KEYWORD_GROUP('b') \
|
||||
KEYWORD("break", Token::BREAK) \
|
||||
KEYWORD_GROUP('c') \
|
||||
KEYWORD("case", Token::CASE) \
|
||||
KEYWORD("catch", Token::CATCH) \
|
||||
KEYWORD("class", \
|
||||
harmony_classes ? Token::CLASS : Token::FUTURE_RESERVED_WORD) \
|
||||
KEYWORD("const", Token::CONST) \
|
||||
KEYWORD("continue", Token::CONTINUE) \
|
||||
KEYWORD_GROUP('d') \
|
||||
KEYWORD("debugger", Token::DEBUGGER) \
|
||||
KEYWORD("default", Token::DEFAULT) \
|
||||
KEYWORD("delete", Token::DELETE) \
|
||||
KEYWORD("do", Token::DO) \
|
||||
KEYWORD_GROUP('e') \
|
||||
KEYWORD("else", Token::ELSE) \
|
||||
KEYWORD("enum", Token::FUTURE_RESERVED_WORD) \
|
||||
KEYWORD("export", \
|
||||
harmony_modules ? Token::EXPORT : Token::FUTURE_RESERVED_WORD) \
|
||||
KEYWORD("extends", \
|
||||
harmony_classes ? Token::EXTENDS : Token::FUTURE_RESERVED_WORD) \
|
||||
KEYWORD_GROUP('f') \
|
||||
KEYWORD("false", Token::FALSE_LITERAL) \
|
||||
KEYWORD("finally", Token::FINALLY) \
|
||||
KEYWORD("for", Token::FOR) \
|
||||
KEYWORD("function", Token::FUNCTION) \
|
||||
KEYWORD_GROUP('i') \
|
||||
KEYWORD("if", Token::IF) \
|
||||
KEYWORD("implements", Token::FUTURE_STRICT_RESERVED_WORD) \
|
||||
KEYWORD("import", \
|
||||
harmony_modules ? Token::IMPORT : Token::FUTURE_RESERVED_WORD) \
|
||||
KEYWORD("in", Token::IN) \
|
||||
KEYWORD("instanceof", Token::INSTANCEOF) \
|
||||
KEYWORD("interface", Token::FUTURE_STRICT_RESERVED_WORD) \
|
||||
KEYWORD_GROUP('l') \
|
||||
KEYWORD("let", \
|
||||
harmony_scoping ? Token::LET : Token::FUTURE_STRICT_RESERVED_WORD) \
|
||||
KEYWORD_GROUP('n') \
|
||||
KEYWORD("new", Token::NEW) \
|
||||
KEYWORD("null", Token::NULL_LITERAL) \
|
||||
KEYWORD_GROUP('p') \
|
||||
KEYWORD("package", Token::FUTURE_STRICT_RESERVED_WORD) \
|
||||
KEYWORD("private", Token::FUTURE_STRICT_RESERVED_WORD) \
|
||||
KEYWORD("protected", Token::FUTURE_STRICT_RESERVED_WORD) \
|
||||
KEYWORD("public", Token::FUTURE_STRICT_RESERVED_WORD) \
|
||||
KEYWORD_GROUP('r') \
|
||||
KEYWORD("return", Token::RETURN) \
|
||||
KEYWORD_GROUP('s') \
|
||||
KEYWORD("static", harmony_classes ? Token::STATIC \
|
||||
: Token::FUTURE_STRICT_RESERVED_WORD) \
|
||||
KEYWORD("super", \
|
||||
harmony_classes ? Token::SUPER : Token::FUTURE_RESERVED_WORD) \
|
||||
KEYWORD("switch", Token::SWITCH) \
|
||||
KEYWORD_GROUP('t') \
|
||||
KEYWORD("this", Token::THIS) \
|
||||
KEYWORD("throw", Token::THROW) \
|
||||
KEYWORD("true", Token::TRUE_LITERAL) \
|
||||
KEYWORD("try", Token::TRY) \
|
||||
KEYWORD("typeof", Token::TYPEOF) \
|
||||
KEYWORD_GROUP('v') \
|
||||
KEYWORD("var", Token::VAR) \
|
||||
KEYWORD("void", Token::VOID) \
|
||||
KEYWORD_GROUP('w') \
|
||||
KEYWORD("while", Token::WHILE) \
|
||||
KEYWORD("with", Token::WITH) \
|
||||
KEYWORD_GROUP('y') \
|
||||
#define KEYWORDS(KEYWORD_GROUP, KEYWORD) \
|
||||
KEYWORD_GROUP('b') \
|
||||
KEYWORD("break", Token::BREAK) \
|
||||
KEYWORD_GROUP('c') \
|
||||
KEYWORD("case", Token::CASE) \
|
||||
KEYWORD("catch", Token::CATCH) \
|
||||
KEYWORD("class", \
|
||||
harmony_classes ? Token::CLASS : Token::FUTURE_RESERVED_WORD) \
|
||||
KEYWORD("const", Token::CONST) \
|
||||
KEYWORD("continue", Token::CONTINUE) \
|
||||
KEYWORD_GROUP('d') \
|
||||
KEYWORD("debugger", Token::DEBUGGER) \
|
||||
KEYWORD("default", Token::DEFAULT) \
|
||||
KEYWORD("delete", Token::DELETE) \
|
||||
KEYWORD("do", Token::DO) \
|
||||
KEYWORD_GROUP('e') \
|
||||
KEYWORD("else", Token::ELSE) \
|
||||
KEYWORD("enum", Token::FUTURE_RESERVED_WORD) \
|
||||
KEYWORD("export", \
|
||||
harmony_modules ? Token::EXPORT : Token::FUTURE_RESERVED_WORD) \
|
||||
KEYWORD("extends", \
|
||||
harmony_classes ? Token::EXTENDS : Token::FUTURE_RESERVED_WORD) \
|
||||
KEYWORD_GROUP('f') \
|
||||
KEYWORD("false", Token::FALSE_LITERAL) \
|
||||
KEYWORD("finally", Token::FINALLY) \
|
||||
KEYWORD("for", Token::FOR) \
|
||||
KEYWORD("function", Token::FUNCTION) \
|
||||
KEYWORD_GROUP('i') \
|
||||
KEYWORD("if", Token::IF) \
|
||||
KEYWORD("implements", Token::FUTURE_STRICT_RESERVED_WORD) \
|
||||
KEYWORD("import", \
|
||||
harmony_modules ? Token::IMPORT : Token::FUTURE_RESERVED_WORD) \
|
||||
KEYWORD("in", Token::IN) \
|
||||
KEYWORD("instanceof", Token::INSTANCEOF) \
|
||||
KEYWORD("interface", Token::FUTURE_STRICT_RESERVED_WORD) \
|
||||
KEYWORD_GROUP('l') \
|
||||
KEYWORD("let", Token::LET) \
|
||||
KEYWORD_GROUP('n') \
|
||||
KEYWORD("new", Token::NEW) \
|
||||
KEYWORD("null", Token::NULL_LITERAL) \
|
||||
KEYWORD_GROUP('p') \
|
||||
KEYWORD("package", Token::FUTURE_STRICT_RESERVED_WORD) \
|
||||
KEYWORD("private", Token::FUTURE_STRICT_RESERVED_WORD) \
|
||||
KEYWORD("protected", Token::FUTURE_STRICT_RESERVED_WORD) \
|
||||
KEYWORD("public", Token::FUTURE_STRICT_RESERVED_WORD) \
|
||||
KEYWORD_GROUP('r') \
|
||||
KEYWORD("return", Token::RETURN) \
|
||||
KEYWORD_GROUP('s') \
|
||||
KEYWORD("static", harmony_classes ? Token::STATIC \
|
||||
: Token::FUTURE_STRICT_RESERVED_WORD) \
|
||||
KEYWORD("super", \
|
||||
harmony_classes ? Token::SUPER : Token::FUTURE_RESERVED_WORD) \
|
||||
KEYWORD("switch", Token::SWITCH) \
|
||||
KEYWORD_GROUP('t') \
|
||||
KEYWORD("this", Token::THIS) \
|
||||
KEYWORD("throw", Token::THROW) \
|
||||
KEYWORD("true", Token::TRUE_LITERAL) \
|
||||
KEYWORD("try", Token::TRY) \
|
||||
KEYWORD("typeof", Token::TYPEOF) \
|
||||
KEYWORD_GROUP('v') \
|
||||
KEYWORD("var", Token::VAR) \
|
||||
KEYWORD("void", Token::VOID) \
|
||||
KEYWORD_GROUP('w') \
|
||||
KEYWORD("while", Token::WHILE) \
|
||||
KEYWORD("with", Token::WITH) \
|
||||
KEYWORD_GROUP('y') \
|
||||
KEYWORD("yield", Token::YIELD)
|
||||
|
||||
|
||||
static Token::Value KeywordOrIdentifierToken(const uint8_t* input,
|
||||
int input_length,
|
||||
bool harmony_scoping,
|
||||
bool harmony_modules,
|
||||
bool harmony_classes) {
|
||||
DCHECK(input_length >= 1);
|
||||
@ -1211,8 +1208,7 @@ bool Scanner::IdentifierIsFutureStrictReserved(
|
||||
}
|
||||
return Token::FUTURE_STRICT_RESERVED_WORD ==
|
||||
KeywordOrIdentifierToken(string->raw_data(), string->length(),
|
||||
harmony_scoping_, harmony_modules_,
|
||||
harmony_classes_);
|
||||
harmony_modules_, harmony_classes_);
|
||||
}
|
||||
|
||||
|
||||
@ -1246,8 +1242,7 @@ Token::Value Scanner::ScanIdentifierOrKeyword() {
|
||||
literal.Complete();
|
||||
Vector<const uint8_t> chars = next_.literal_chars->one_byte_literal();
|
||||
return KeywordOrIdentifierToken(chars.start(), chars.length(),
|
||||
harmony_scoping_, harmony_modules_,
|
||||
harmony_classes_);
|
||||
harmony_modules_, harmony_classes_);
|
||||
}
|
||||
|
||||
HandleLeadSurrogate();
|
||||
@ -1299,7 +1294,6 @@ Token::Value Scanner::ScanIdentifierOrKeyword() {
|
||||
Vector<const uint8_t> chars = next_.literal_chars->one_byte_literal();
|
||||
return KeywordOrIdentifierToken(chars.start(),
|
||||
chars.length(),
|
||||
harmony_scoping_,
|
||||
harmony_modules_,
|
||||
harmony_classes_);
|
||||
}
|
||||
|
@ -444,12 +444,6 @@ class Scanner {
|
||||
// tokens, which is what it is used for.
|
||||
void SeekForward(int pos);
|
||||
|
||||
bool HarmonyScoping() const {
|
||||
return harmony_scoping_;
|
||||
}
|
||||
void SetHarmonyScoping(bool scoping) {
|
||||
harmony_scoping_ = scoping;
|
||||
}
|
||||
bool HarmonyModules() const {
|
||||
return harmony_modules_;
|
||||
}
|
||||
@ -745,8 +739,6 @@ class Scanner {
|
||||
// Whether there is a multi-line comment that contains a
|
||||
// line-terminator after the current token, and before the next.
|
||||
bool has_multiline_comment_before_next_;
|
||||
// Whether we scan 'let' as a keyword for harmony block-scoped let bindings.
|
||||
bool harmony_scoping_;
|
||||
// Whether we scan 'module', 'import', 'export' as keywords.
|
||||
bool harmony_modules_;
|
||||
// Whether we scan 0o777 and 0b111 as numbers.
|
||||
|
@ -187,7 +187,7 @@ void FullCodeGenerator::Generate() {
|
||||
Comment cmnt(masm_, "[ Allocate context");
|
||||
bool need_write_barrier = true;
|
||||
// Argument to NewContext is the function, which is still in rdi.
|
||||
if (FLAG_harmony_scoping && info->scope()->is_script_scope()) {
|
||||
if (info->scope()->is_script_scope()) {
|
||||
__ Push(rdi);
|
||||
__ Push(info->scope()->GetScopeInfo(info->isolate()));
|
||||
__ CallRuntime(Runtime::kNewScriptContext, 2);
|
||||
|
@ -188,7 +188,7 @@ void FullCodeGenerator::Generate() {
|
||||
Comment cmnt(masm_, "[ Allocate context");
|
||||
bool need_write_barrier = true;
|
||||
// Argument to NewContext is the function, which is still in edi.
|
||||
if (FLAG_harmony_scoping && info->scope()->is_script_scope()) {
|
||||
if (info->scope()->is_script_scope()) {
|
||||
__ push(edi);
|
||||
__ Push(info->scope()->GetScopeInfo(info->isolate()));
|
||||
__ CallRuntime(Runtime::kNewScriptContext, 2);
|
||||
|
@ -451,7 +451,6 @@ TEST(LookupStore) {
|
||||
|
||||
|
||||
TEST(BlockLoadStore) {
|
||||
FLAG_harmony_scoping = true;
|
||||
FunctionTester T("(function(a) { 'use strict'; { let x = a+a; return x; }})");
|
||||
|
||||
T.CheckCall(T.Val(46), T.Val(23));
|
||||
@ -460,7 +459,6 @@ TEST(BlockLoadStore) {
|
||||
|
||||
|
||||
TEST(BlockLoadStoreNested) {
|
||||
FLAG_harmony_scoping = true;
|
||||
const char* src =
|
||||
"(function(a,b) {"
|
||||
"'use strict';"
|
||||
|
@ -49,7 +49,6 @@ static const char* bind_tests[] = {
|
||||
|
||||
|
||||
static void RunVariableTests(const char* source, const char* tests[]) {
|
||||
FLAG_harmony_scoping = true;
|
||||
EmbeddedVector<char, 512> buffer;
|
||||
|
||||
for (int i = 0; tests[i] != NULL; i += 3) {
|
||||
|
@ -7646,7 +7646,6 @@ static void DebugHarmonyScopingListener(
|
||||
|
||||
|
||||
TEST(DebugBreakInLexicalScopes) {
|
||||
i::FLAG_harmony_scoping = true;
|
||||
i::FLAG_allow_natives_syntax = true;
|
||||
|
||||
DebugLocalContext env;
|
||||
|
@ -637,7 +637,6 @@ TEST(CrossScriptReferences) {
|
||||
|
||||
|
||||
TEST(CrossScriptReferences_Simple) {
|
||||
i::FLAG_harmony_scoping = true;
|
||||
i::FLAG_use_strict = true;
|
||||
|
||||
v8::Isolate* isolate = CcTest::isolate();
|
||||
@ -652,7 +651,6 @@ TEST(CrossScriptReferences_Simple) {
|
||||
|
||||
|
||||
TEST(CrossScriptReferences_Simple2) {
|
||||
i::FLAG_harmony_scoping = true;
|
||||
i::FLAG_use_strict = true;
|
||||
|
||||
v8::Isolate* isolate = CcTest::isolate();
|
||||
@ -675,8 +673,6 @@ TEST(CrossScriptReferences_Simple2) {
|
||||
|
||||
|
||||
TEST(CrossScriptReferencesHarmony) {
|
||||
i::FLAG_harmony_scoping = true;
|
||||
|
||||
v8::Isolate* isolate = CcTest::isolate();
|
||||
HandleScope scope(isolate);
|
||||
|
||||
@ -819,7 +815,6 @@ TEST(CrossScriptReferencesHarmony) {
|
||||
|
||||
|
||||
TEST(CrossScriptReferencesHarmonyRegress) {
|
||||
i::FLAG_harmony_scoping = true;
|
||||
v8::Isolate* isolate = CcTest::isolate();
|
||||
HandleScope scope(isolate);
|
||||
SimpleContext context;
|
||||
@ -840,7 +835,6 @@ TEST(CrossScriptReferencesHarmonyRegress) {
|
||||
|
||||
TEST(GlobalLexicalOSR) {
|
||||
i::FLAG_use_strict = true;
|
||||
i::FLAG_harmony_scoping = true;
|
||||
|
||||
v8::Isolate* isolate = CcTest::isolate();
|
||||
HandleScope scope(isolate);
|
||||
@ -864,7 +858,6 @@ TEST(GlobalLexicalOSR) {
|
||||
|
||||
TEST(CrossScriptConflicts) {
|
||||
i::FLAG_use_strict = true;
|
||||
i::FLAG_harmony_scoping = true;
|
||||
|
||||
HandleScope scope(CcTest::isolate());
|
||||
|
||||
@ -900,8 +893,6 @@ TEST(CrossScriptConflicts) {
|
||||
|
||||
|
||||
TEST(CrossScriptDynamicLookup) {
|
||||
i::FLAG_harmony_scoping = true;
|
||||
|
||||
HandleScope handle_scope(CcTest::isolate());
|
||||
|
||||
{
|
||||
@ -933,8 +924,6 @@ TEST(CrossScriptDynamicLookup) {
|
||||
|
||||
|
||||
TEST(CrossScriptGlobal) {
|
||||
i::FLAG_harmony_scoping = true;
|
||||
|
||||
HandleScope handle_scope(CcTest::isolate());
|
||||
{
|
||||
SimpleContext context;
|
||||
@ -977,8 +966,6 @@ TEST(CrossScriptGlobal) {
|
||||
|
||||
|
||||
TEST(CrossScriptStaticLookupUndeclared) {
|
||||
i::FLAG_harmony_scoping = true;
|
||||
|
||||
HandleScope handle_scope(CcTest::isolate());
|
||||
|
||||
{
|
||||
@ -1011,7 +998,6 @@ TEST(CrossScriptStaticLookupUndeclared) {
|
||||
|
||||
|
||||
TEST(CrossScriptLoadICs) {
|
||||
i::FLAG_harmony_scoping = true;
|
||||
i::FLAG_allow_natives_syntax = true;
|
||||
|
||||
HandleScope handle_scope(CcTest::isolate());
|
||||
@ -1067,7 +1053,6 @@ TEST(CrossScriptLoadICs) {
|
||||
|
||||
|
||||
TEST(CrossScriptStoreICs) {
|
||||
i::FLAG_harmony_scoping = true;
|
||||
i::FLAG_allow_natives_syntax = true;
|
||||
|
||||
HandleScope handle_scope(CcTest::isolate());
|
||||
@ -1145,7 +1130,6 @@ TEST(CrossScriptStoreICs) {
|
||||
|
||||
|
||||
TEST(CrossScriptAssignmentToConst) {
|
||||
i::FLAG_harmony_scoping = true;
|
||||
i::FLAG_allow_natives_syntax = true;
|
||||
|
||||
HandleScope handle_scope(CcTest::isolate());
|
||||
@ -1168,7 +1152,6 @@ TEST(CrossScriptAssignmentToConst) {
|
||||
|
||||
|
||||
TEST(Regress425510) {
|
||||
i::FLAG_harmony_scoping = true;
|
||||
i::FLAG_allow_natives_syntax = true;
|
||||
|
||||
HandleScope handle_scope(CcTest::isolate());
|
||||
@ -1186,7 +1169,6 @@ TEST(Regress425510) {
|
||||
|
||||
|
||||
TEST(Regress3941) {
|
||||
i::FLAG_harmony_scoping = true;
|
||||
i::FLAG_allow_natives_syntax = true;
|
||||
|
||||
HandleScope handle_scope(CcTest::isolate());
|
||||
@ -1228,7 +1210,6 @@ TEST(Regress3941) {
|
||||
|
||||
|
||||
TEST(Regress3941_Reads) {
|
||||
i::FLAG_harmony_scoping = true;
|
||||
i::FLAG_allow_natives_syntax = true;
|
||||
|
||||
HandleScope handle_scope(CcTest::isolate());
|
||||
|
@ -72,7 +72,6 @@ TEST(ScanKeywords) {
|
||||
i::Utf8ToUtf16CharacterStream stream(keyword, length);
|
||||
i::Scanner scanner(&unicode_cache);
|
||||
// The scanner should parse Harmony keywords for this test.
|
||||
scanner.SetHarmonyScoping(true);
|
||||
scanner.SetHarmonyModules(true);
|
||||
scanner.SetHarmonyClasses(true);
|
||||
scanner.Initialize(&stream);
|
||||
@ -1051,7 +1050,6 @@ TEST(ScopeUsesArgumentsSuperThis) {
|
||||
parser.set_allow_harmony_arrow_functions(true);
|
||||
parser.set_allow_harmony_classes(true);
|
||||
parser.set_allow_harmony_object_literals(true);
|
||||
parser.set_allow_harmony_scoping(true);
|
||||
parser.set_allow_harmony_sloppy(true);
|
||||
info.set_global();
|
||||
CHECK(parser.Parse(&info));
|
||||
@ -1086,8 +1084,6 @@ TEST(ScopeUsesArgumentsSuperThis) {
|
||||
|
||||
|
||||
TEST(ScopePositions) {
|
||||
v8::internal::FLAG_harmony_scoping = true;
|
||||
|
||||
// Test the parser for correctly setting the start and end positions
|
||||
// of a scope. We check the scope positions of exactly one scope
|
||||
// nested in the global scope of a program. 'inner source' is the
|
||||
@ -1301,7 +1297,6 @@ TEST(ScopePositions) {
|
||||
i::ParseInfo info(&zone, script);
|
||||
i::Parser parser(&info);
|
||||
parser.set_allow_lazy(true);
|
||||
parser.set_allow_harmony_scoping(true);
|
||||
parser.set_allow_harmony_arrow_functions(true);
|
||||
info.set_global();
|
||||
info.set_language_mode(source_data[i].language_mode);
|
||||
@ -1377,7 +1372,6 @@ i::Handle<i::String> FormatMessage(i::Vector<unsigned> data) {
|
||||
enum ParserFlag {
|
||||
kAllowLazy,
|
||||
kAllowNatives,
|
||||
kAllowHarmonyScoping,
|
||||
kAllowHarmonyModules,
|
||||
kAllowHarmonyNumericLiterals,
|
||||
kAllowHarmonyArrowFunctions,
|
||||
@ -1403,7 +1397,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_scoping(flags.Contains(kAllowHarmonyScoping));
|
||||
parser->set_allow_harmony_modules(flags.Contains(kAllowHarmonyModules));
|
||||
parser->set_allow_harmony_numeric_literals(
|
||||
flags.Contains(kAllowHarmonyNumericLiterals));
|
||||
@ -1973,8 +1966,8 @@ TEST(NoErrorsFutureStrictReservedWords) {
|
||||
RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
|
||||
always_flags, arraysize(always_flags));
|
||||
|
||||
static const ParserFlag classes_flags[] = {
|
||||
kAllowHarmonyArrowFunctions, kAllowHarmonyClasses, kAllowHarmonyScoping};
|
||||
static const ParserFlag classes_flags[] = {kAllowHarmonyArrowFunctions,
|
||||
kAllowHarmonyClasses};
|
||||
RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
|
||||
classes_flags, arraysize(classes_flags));
|
||||
}
|
||||
@ -3373,7 +3366,6 @@ TEST(InnerAssignment) {
|
||||
i::Zone zone;
|
||||
i::ParseInfo info(&zone, script);
|
||||
i::Parser parser(&info);
|
||||
parser.set_allow_harmony_scoping(true);
|
||||
CHECK(parser.Parse(&info));
|
||||
CHECK(i::Compiler::Analyze(&info));
|
||||
CHECK(info.function() != NULL);
|
||||
@ -3521,7 +3513,7 @@ TEST(ErrorsArrowFunctions) {
|
||||
};
|
||||
|
||||
// The test is quite slow, so run it with a reduced set of flags.
|
||||
static const ParserFlag flags[] = {kAllowLazy, kAllowHarmonyScoping};
|
||||
static const ParserFlag flags[] = {kAllowLazy};
|
||||
static const ParserFlag always_flags[] = { kAllowHarmonyArrowFunctions };
|
||||
RunParserSyncTest(context_data, statement_data, kError, flags,
|
||||
arraysize(flags), always_flags, arraysize(always_flags));
|
||||
@ -4049,8 +4041,7 @@ TEST(ClassDeclarationNoErrors) {
|
||||
"class name extends class base {} {}",
|
||||
NULL};
|
||||
|
||||
static const ParserFlag always_flags[] = {
|
||||
kAllowHarmonyClasses, kAllowHarmonyScoping};
|
||||
static const ParserFlag always_flags[] = {kAllowHarmonyClasses};
|
||||
RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
|
||||
always_flags, arraysize(always_flags));
|
||||
}
|
||||
@ -4569,9 +4560,7 @@ TEST(ConstParsingInForIn) {
|
||||
"for(const x in [1,2,3]) {}",
|
||||
"for(const x of [1,2,3]) {}",
|
||||
NULL};
|
||||
static const ParserFlag always_flags[] = {kAllowHarmonyScoping};
|
||||
RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags,
|
||||
arraysize(always_flags));
|
||||
RunParserSyncTest(context_data, data, kSuccess, nullptr, 0, nullptr, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -4591,9 +4580,7 @@ TEST(ConstParsingInForInError) {
|
||||
"for(const x = 1, y = 2 of []) {}",
|
||||
"for(const x,y of []) {}",
|
||||
NULL};
|
||||
static const ParserFlag always_flags[] = {kAllowHarmonyScoping};
|
||||
RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
|
||||
arraysize(always_flags));
|
||||
RunParserSyncTest(context_data, data, kError, nullptr, 0, nullptr, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -4948,8 +4935,7 @@ TEST(LexicalScopingSloppyMode) {
|
||||
"(class C {})",
|
||||
"(class C extends D {})",
|
||||
NULL};
|
||||
static const ParserFlag always_true_flags[] = {
|
||||
kAllowHarmonyScoping, kAllowHarmonyClasses};
|
||||
static const ParserFlag always_true_flags[] = {kAllowHarmonyClasses};
|
||||
static const ParserFlag always_false_flags[] = {kAllowHarmonySloppy};
|
||||
RunParserSyncTest(context_data, bad_data, kError, NULL, 0,
|
||||
always_true_flags, arraysize(always_true_flags),
|
||||
@ -5085,7 +5071,6 @@ TEST(BasicImportExportParsing) {
|
||||
i::Parser parser(&info);
|
||||
parser.set_allow_harmony_classes(true);
|
||||
parser.set_allow_harmony_modules(true);
|
||||
parser.set_allow_harmony_scoping(true);
|
||||
info.set_module();
|
||||
if (!parser.Parse(&info)) {
|
||||
i::Handle<i::JSObject> exception_handle(
|
||||
@ -5113,7 +5098,6 @@ TEST(BasicImportExportParsing) {
|
||||
i::Parser parser(&info);
|
||||
parser.set_allow_harmony_classes(true);
|
||||
parser.set_allow_harmony_modules(true);
|
||||
parser.set_allow_harmony_scoping(true);
|
||||
info.set_global();
|
||||
CHECK(!parser.Parse(&info));
|
||||
}
|
||||
@ -5204,7 +5188,6 @@ TEST(ImportExportParsingErrors) {
|
||||
i::Parser parser(&info);
|
||||
parser.set_allow_harmony_classes(true);
|
||||
parser.set_allow_harmony_modules(true);
|
||||
parser.set_allow_harmony_scoping(true);
|
||||
info.set_module();
|
||||
CHECK(!parser.Parse(&info));
|
||||
}
|
||||
@ -5234,7 +5217,6 @@ TEST(ModuleParsingInternals) {
|
||||
i::AstValueFactory avf(&zone, isolate->heap()->HashSeed());
|
||||
i::Parser parser(&info);
|
||||
parser.set_allow_harmony_modules(true);
|
||||
parser.set_allow_harmony_scoping(true);
|
||||
info.set_module();
|
||||
CHECK(parser.Parse(&info));
|
||||
CHECK(i::Compiler::Analyze(&info));
|
||||
@ -5335,8 +5317,8 @@ TEST(DeclarationsError) {
|
||||
"class C {}",
|
||||
NULL};
|
||||
|
||||
static const ParserFlag always_flags[] = {
|
||||
kAllowHarmonyClasses, kAllowHarmonyScoping, kAllowStrongMode};
|
||||
static const ParserFlag always_flags[] = {kAllowHarmonyClasses,
|
||||
kAllowStrongMode};
|
||||
RunParserSyncTest(context_data, statement_data, kError, NULL, 0,
|
||||
always_flags, arraysize(always_flags));
|
||||
}
|
||||
@ -5421,8 +5403,7 @@ TEST(PropertyNameEvalArguments) {
|
||||
NULL};
|
||||
|
||||
static const ParserFlag always_flags[] = {
|
||||
kAllowHarmonyClasses, kAllowHarmonyObjectLiterals, kAllowHarmonyScoping,
|
||||
kAllowStrongMode};
|
||||
kAllowHarmonyClasses, kAllowHarmonyObjectLiterals, kAllowStrongMode};
|
||||
RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
|
||||
always_flags, arraysize(always_flags));
|
||||
}
|
||||
@ -5494,8 +5475,7 @@ TEST(VarForbiddenInStrongMode) {
|
||||
"const x = 0;",
|
||||
NULL};
|
||||
|
||||
static const ParserFlag always_flags[] = {kAllowStrongMode,
|
||||
kAllowHarmonyScoping};
|
||||
static const ParserFlag always_flags[] = {kAllowStrongMode};
|
||||
RunParserSyncTest(strong_context_data, var_declarations, kError, NULL, 0,
|
||||
always_flags, arraysize(always_flags));
|
||||
RunParserSyncTest(strong_context_data, let_declarations, kSuccess, NULL, 0,
|
||||
@ -5535,7 +5515,7 @@ TEST(StrongEmptySubStatements) {
|
||||
NULL};
|
||||
|
||||
static const ParserFlag always_flags[] = {
|
||||
kAllowStrongMode, kAllowHarmonyScoping
|
||||
kAllowStrongMode,
|
||||
};
|
||||
RunParserSyncTest(sloppy_context_data, data, kSuccess, NULL, 0, always_flags,
|
||||
arraysize(always_flags));
|
||||
@ -5557,7 +5537,7 @@ TEST(StrongForIn) {
|
||||
NULL};
|
||||
|
||||
static const ParserFlag always_flags[] = {
|
||||
kAllowStrongMode, kAllowHarmonyScoping
|
||||
kAllowStrongMode,
|
||||
};
|
||||
RunParserSyncTest(sloppy_context_data, data, kSuccess, NULL, 0, always_flags,
|
||||
arraysize(always_flags));
|
||||
|
@ -1388,7 +1388,6 @@ TEST(SerializeToplevelBitFlip) {
|
||||
|
||||
TEST(SerializeWithHarmonyScoping) {
|
||||
FLAG_serialize_toplevel = true;
|
||||
FLAG_harmony_scoping = true;
|
||||
|
||||
const char* source1 = "'use strict'; let x = 'X'";
|
||||
const char* source2 = "'use strict'; let y = 'Y'";
|
||||
|
@ -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: --expose-debug-as debug --harmony-scoping
|
||||
// Flags: --expose-debug-as debug
|
||||
// The functions used for testing backtraces. They are at the top to make the
|
||||
// testing of source line/column easier.
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
// Copyright 2011 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-scoping
|
||||
|
||||
// Test for conflicting variable bindings.
|
||||
|
@ -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: --harmony-scoping --harmony-computed-property-names
|
||||
// Flags: --harmony-computed-property-names
|
||||
|
||||
// Test that we throw early syntax errors in harmony mode
|
||||
// when using an immutable binding in an assigment or with
|
@ -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-scoping
|
||||
|
||||
function CheckException(e) {
|
||||
var string = e.toString();
|
||||
assertInstanceof(e, SyntaxError);
|
@ -24,9 +24,6 @@
|
||||
// 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: --harmony-scoping
|
||||
|
||||
"use strict";
|
||||
|
||||
function props(x) {
|
@ -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-scoping
|
||||
|
||||
"use strict";
|
||||
|
||||
// We want to test the context chain shape. In each of the tests cases
|
@ -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: --harmony-scoping --allow-natives-syntax
|
||||
// Flags: --allow-natives-syntax
|
||||
|
||||
"use strict";
|
||||
|
@ -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-scoping
|
||||
|
||||
// Test let declarations in various settings.
|
||||
|
||||
"use strict";
|
@ -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-scoping
|
||||
|
||||
"use strict";
|
||||
|
||||
// Test temporal dead zone semantics of let bound variables in
|
@ -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-scoping --harmony-classes
|
||||
// Flags: --harmony-classes
|
||||
|
||||
function CheckError(source) {
|
||||
var exception = null;
|
@ -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-scoping
|
||||
// Flags: --allow-natives-syntax
|
||||
// Test functionality of block scopes.
|
||||
|
||||
"use strict";
|
@ -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: --expose-debug-as debug --harmony-scoping
|
||||
// Flags: --expose-debug-as debug
|
||||
// The functions used for testing backtraces. They are at the top to make the
|
||||
// testing of source line/column easier.
|
||||
|
@ -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: --expose-debug-as debug --harmony-scoping
|
||||
// Flags: --expose-debug-as debug
|
||||
|
||||
// Test debug evaluation for functions without local context, but with
|
||||
// nested catch contexts.
|
@ -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: --expose-debug-as debug --harmony-scoping
|
||||
// Flags: --expose-debug-as debug
|
||||
|
||||
"use strict";
|
||||
let top_level_let = 255;
|
@ -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-scoping
|
||||
|
||||
"use strict";
|
||||
|
||||
function for_const() {
|
@ -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: --harmony-scoping --allow-natives-syntax --harmony-tostring
|
||||
// Flags: --allow-natives-syntax --harmony-tostring
|
||||
|
||||
// Test instantations of generators.
|
||||
|
||||
|
@ -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: --harmony-scoping --harmony-proxies
|
||||
// Flags: --harmony-proxies
|
||||
|
||||
// Test for-of semantics.
|
||||
|
||||
|
@ -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-scoping
|
||||
|
||||
// Test for-of syntax.
|
||||
|
||||
"use strict";
|
||||
|
@ -25,7 +25,5 @@
|
||||
// (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-scoping
|
||||
|
||||
assertThrows("'use strict'; (function f() { f = 123; })()", TypeError);
|
||||
assertThrows("(function f() { 'use strict'; f = 123; })()", TypeError);
|
@ -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-scoping
|
||||
|
||||
"use strict";
|
||||
|
||||
assertThrows("'use strict'; for (let x in x);", ReferenceError);
|
@ -1,8 +1,6 @@
|
||||
// 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: --harmony-scoping
|
||||
|
||||
'use strict';
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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: --harmony-scoping
|
||||
"use strict";
|
||||
|
||||
function f() {
|
@ -2,6 +2,4 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --harmony-scoping
|
||||
|
||||
assertThrows("(function() { 'use strict'; { let f; var f; } })", SyntaxError);
|
@ -1,8 +1,6 @@
|
||||
// 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: --harmony-scoping
|
||||
|
||||
"use strict";
|
||||
|
@ -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-scoping --allow-natives-syntax
|
||||
// Flags: --allow-natives-syntax
|
||||
'use strict';
|
||||
function f24(deopt) {
|
||||
let x = 1;
|
@ -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-scoping --lazy
|
||||
// Flags: --lazy
|
||||
|
||||
function foo(a, b, c, d) {
|
||||
"use strict"
|
||||
|
@ -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: --harmony-modules --harmony-scoping
|
||||
// Flags: --harmony-modules
|
||||
|
||||
// Test basic module linking and initialization.
|
||||
|
||||
|
@ -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: --harmony-modules --harmony-scoping
|
||||
// Flags: --harmony-modules
|
||||
|
||||
// Test basic module interface inference.
|
||||
|
||||
|
@ -110,7 +110,7 @@
|
||||
'debug-stepout-scope-part3': [PASS, NO_VARIANTS],
|
||||
'es6/debug-stepin-microtasks': [PASS, NO_VARIANTS],
|
||||
'es6/debug-stepnext-for': [PASS, NO_VARIANTS],
|
||||
'harmony/debug-evaluate-blockscopes': [PASS, NO_VARIANTS],
|
||||
'es6/debug-evaluate-blockscopes': [PASS, NO_VARIANTS],
|
||||
'regress/regress-crbug-259300': [PASS, NO_VARIANTS],
|
||||
|
||||
##############################################################################
|
||||
@ -208,7 +208,7 @@
|
||||
'fast-prototype': [SKIP],
|
||||
'field-type-tracking': [SKIP],
|
||||
'getters-on-elements': [SKIP],
|
||||
'harmony/block-let-crankshaft': [SKIP],
|
||||
'es6/block-let-crankshaft': [SKIP],
|
||||
'opt-elements-kind': [SKIP],
|
||||
'osr-elements-kind': [SKIP],
|
||||
'regress/regress-crbug-137689': [SKIP],
|
||||
|
@ -25,8 +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: --turbo-deoptimization --noharmony-scoping
|
||||
// Flags: --noharmony-classes --noharmony-object-literals
|
||||
// Flags: --turbo-deoptimization
|
||||
|
||||
function CheckStrictMode(code, exception) {
|
||||
assertDoesNotThrow(code);
|
||||
@ -287,19 +286,6 @@ CheckStrictMode("function strict() { print(--arguments); }", SyntaxError);
|
||||
CheckStrictMode("function strict() { var x = --eval; }", SyntaxError);
|
||||
CheckStrictMode("function strict() { var x = --arguments; }", SyntaxError);
|
||||
|
||||
// Use of const in strict mode is disallowed in anticipation of ES Harmony.
|
||||
CheckStrictMode("const x = 0;", SyntaxError);
|
||||
CheckStrictMode("for (const x = 0; false;) {}", SyntaxError);
|
||||
CheckStrictMode("function strict() { const x = 0; }", SyntaxError);
|
||||
|
||||
// Strict mode only allows functions in StatementList
|
||||
CheckStrictMode("if (true) { function invalid() {} }", SyntaxError);
|
||||
CheckStrictMode("for (;false;) { function invalid() {} }", SyntaxError);
|
||||
CheckStrictMode("{ function invalid() {} }", SyntaxError);
|
||||
CheckStrictMode("try { function invalid() {} } catch(e) {}", SyntaxError);
|
||||
CheckStrictMode("try { } catch(e) { function invalid() {} }", SyntaxError);
|
||||
CheckStrictMode("function outer() {{ function invalid() {} }}", SyntaxError);
|
||||
|
||||
// Delete of an unqualified identifier
|
||||
CheckStrictMode("delete unqualified;", SyntaxError);
|
||||
CheckStrictMode("function strict() { delete unqualified; }", SyntaxError);
|
||||
|
@ -1,31 +0,0 @@
|
||||
// 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: --noharmony-scoping
|
||||
|
||||
"use strict";
|
||||
const x = 42;
|
@ -1,109 +0,0 @@
|
||||
# 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.
|
||||
|
||||
# In strict mode, function declarations may only appear as source elements.
|
||||
|
||||
# A template that performs the same strict-mode test in different
|
||||
# scopes (global scope, function scope, and nested function scope).
|
||||
def StrictTest(name, source, legacy):
|
||||
if legacy:
|
||||
extra_flags = [
|
||||
"--noharmony-scoping",
|
||||
"--noharmony-classes",
|
||||
"--noharmony-object-literals"]
|
||||
else:
|
||||
extra_flags = []
|
||||
Test(name, '"use strict";\n' + source, "strict_function",
|
||||
extra_flags)
|
||||
Test(name + '-infunc',
|
||||
'function foo() {\n "use strict";\n' + source +'\n}\n',
|
||||
"strict_function",
|
||||
extra_flags)
|
||||
Test(name + '-infunc2',
|
||||
'function foo() {\n "use strict";\n function bar() {\n' +
|
||||
source +'\n }\n}\n',
|
||||
"strict_function",
|
||||
extra_flags)
|
||||
|
||||
# Not testing with-scope, since with is not allowed in strict mode at all.
|
||||
|
||||
StrictTest("block", """
|
||||
{ function foo() { } }
|
||||
""", True)
|
||||
|
||||
StrictTest("try-w-catch", """
|
||||
try { function foo() { } } catch (e) { }
|
||||
""", True)
|
||||
|
||||
StrictTest("try-w-finally", """
|
||||
try { function foo() { } } finally { }
|
||||
""", True)
|
||||
|
||||
StrictTest("catch", """
|
||||
try { } catch (e) { function foo() { } }
|
||||
""", True)
|
||||
|
||||
StrictTest("finally", """
|
||||
try { } finally { function foo() { } }
|
||||
""", True)
|
||||
|
||||
StrictTest("for", """
|
||||
for (;;) { function foo() { } }
|
||||
""", True)
|
||||
|
||||
StrictTest("while", """
|
||||
while (true) { function foo() { } }
|
||||
""", True)
|
||||
|
||||
StrictTest("do", """
|
||||
do { function foo() { } } while (true);
|
||||
""", True)
|
||||
|
||||
StrictTest("then", """
|
||||
if (true) { function foo() { } }
|
||||
""", True)
|
||||
|
||||
|
||||
StrictTest("then-w-else", """
|
||||
if (true) { function foo() { } } else { }
|
||||
""", True)
|
||||
|
||||
|
||||
StrictTest("else", """
|
||||
if (true) { } else { function foo() { } }
|
||||
""", True)
|
||||
|
||||
StrictTest("switch-case", """
|
||||
switch (true) { case true: function foo() { } }
|
||||
""", False)
|
||||
|
||||
StrictTest("labeled", """
|
||||
label: function foo() { }
|
||||
""", False)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user