Commit 2e040f54 authored by rossberg's avatar rossberg Committed by Commit bot

[strong] Keep language mode consistent

R=mstarzinger@chromium.org
BUG=v8:4312
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#29756}
parent 1a8776db
...@@ -512,7 +512,7 @@ CACHED_OP_LIST(CACHED) ...@@ -512,7 +512,7 @@ CACHED_OP_LIST(CACHED)
return &cache_.k##Name##StrictOperator; \ return &cache_.k##Name##StrictOperator; \
case STRONG: \ case STRONG: \
return &cache_.k##Name##StrongOperator; \ return &cache_.k##Name##StrongOperator; \
case STRONG_BIT: \ default: \
break; /* %*!%^$#@ */ \ break; /* %*!%^$#@ */ \
} \ } \
UNREACHABLE(); \ UNREACHABLE(); \
......
...@@ -346,7 +346,7 @@ FunctionLiteral* Parser::DefaultConstructor(bool call_super, Scope* scope, ...@@ -346,7 +346,7 @@ FunctionLiteral* Parser::DefaultConstructor(bool call_super, Scope* scope,
: FunctionKind::kDefaultBaseConstructor; : FunctionKind::kDefaultBaseConstructor;
Scope* function_scope = NewScope(scope, FUNCTION_SCOPE, kind); Scope* function_scope = NewScope(scope, FUNCTION_SCOPE, kind);
function_scope->SetLanguageMode( function_scope->SetLanguageMode(
static_cast<LanguageMode>(language_mode | STRICT_BIT)); static_cast<LanguageMode>(language_mode | STRICT));
// Set start and end position to the same value // Set start and end position to the same value
function_scope->set_start_position(pos); function_scope->set_start_position(pos);
function_scope->set_end_position(pos); function_scope->set_end_position(pos);
...@@ -1327,12 +1327,12 @@ void* Parser::ParseStatementList(ZoneList<Statement*>* body, int end_token, ...@@ -1327,12 +1327,12 @@ void* Parser::ParseStatementList(ZoneList<Statement*>* body, int end_token,
// / "use strong" directives, do the strict mode changes only once. // / "use strong" directives, do the strict mode changes only once.
if (is_sloppy(scope_->language_mode())) { if (is_sloppy(scope_->language_mode())) {
scope_->SetLanguageMode(static_cast<LanguageMode>( scope_->SetLanguageMode(static_cast<LanguageMode>(
scope_->language_mode() | STRICT_BIT)); scope_->language_mode() | STRICT));
} }
if (use_strong_found) { if (use_strong_found) {
scope_->SetLanguageMode(static_cast<LanguageMode>( scope_->SetLanguageMode(static_cast<LanguageMode>(
scope_->language_mode() | STRONG_BIT)); scope_->language_mode() | STRONG));
} }
// Because declarations in strict eval code don't leak into the scope // Because declarations in strict eval code don't leak into the scope
// of the eval call, it is likely that functions declared in strict // of the eval call, it is likely that functions declared in strict
...@@ -1432,7 +1432,7 @@ void* Parser::ParseModuleItemList(ZoneList<Statement*>* body, bool* ok) { ...@@ -1432,7 +1432,7 @@ void* Parser::ParseModuleItemList(ZoneList<Statement*>* body, bool* ok) {
DCHECK(scope_->is_module_scope()); DCHECK(scope_->is_module_scope());
scope_->SetLanguageMode( scope_->SetLanguageMode(
static_cast<LanguageMode>(scope_->language_mode() | STRICT_BIT)); static_cast<LanguageMode>(scope_->language_mode() | STRICT));
while (peek() != Token::EOS) { while (peek() != Token::EOS) {
Statement* stat = ParseModuleItem(CHECK_OK); Statement* stat = ParseModuleItem(CHECK_OK);
...@@ -4517,7 +4517,7 @@ ClassLiteral* Parser::ParseClassLiteral(const AstRawString* name, ...@@ -4517,7 +4517,7 @@ ClassLiteral* Parser::ParseClassLiteral(const AstRawString* name,
Scope* block_scope = NewScope(scope_, BLOCK_SCOPE); Scope* block_scope = NewScope(scope_, BLOCK_SCOPE);
BlockState block_state(&scope_, block_scope); BlockState block_state(&scope_, block_scope);
scope_->SetLanguageMode( scope_->SetLanguageMode(
static_cast<LanguageMode>(scope_->language_mode() | STRICT_BIT)); static_cast<LanguageMode>(scope_->language_mode() | STRICT));
scope_->SetScopeName(name); scope_->SetScopeName(name);
VariableProxy* proxy = NULL; VariableProxy* proxy = NULL;
......
...@@ -253,10 +253,10 @@ void PreParser::ParseStatementList(int end_token, bool* ok, ...@@ -253,10 +253,10 @@ void PreParser::ParseStatementList(int end_token, bool* ok,
if (directive_prologue) { if (directive_prologue) {
if (statement.IsUseStrictLiteral()) { if (statement.IsUseStrictLiteral()) {
scope_->SetLanguageMode( scope_->SetLanguageMode(
static_cast<LanguageMode>(scope_->language_mode() | STRICT_BIT)); static_cast<LanguageMode>(scope_->language_mode() | STRICT));
} else if (statement.IsUseStrongLiteral() && allow_strong_mode()) { } else if (statement.IsUseStrongLiteral() && allow_strong_mode()) {
scope_->SetLanguageMode(static_cast<LanguageMode>( scope_->SetLanguageMode(static_cast<LanguageMode>(
scope_->language_mode() | STRICT_BIT | STRONG_BIT)); scope_->language_mode() | STRONG));
} else if (!statement.IsStringLiteral()) { } else if (!statement.IsStringLiteral()) {
directive_prologue = false; directive_prologue = false;
} }
...@@ -1151,7 +1151,7 @@ PreParserExpression PreParser::ParseClassLiteral( ...@@ -1151,7 +1151,7 @@ PreParserExpression PreParser::ParseClassLiteral(
Scope* scope = NewScope(scope_, BLOCK_SCOPE); Scope* scope = NewScope(scope_, BLOCK_SCOPE);
BlockState block_state(&scope_, scope); BlockState block_state(&scope_, scope);
scope_->SetLanguageMode( scope_->SetLanguageMode(
static_cast<LanguageMode>(class_language_mode | STRICT_BIT)); static_cast<LanguageMode>(class_language_mode | STRICT));
// TODO(marja): Make PreParser use scope names too. // TODO(marja): Make PreParser use scope names too.
// scope_->SetScopeName(name); // scope_->SetScopeName(name);
......
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