Index: src/ast/scopes.cc |
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc |
index bc26f1da9ac7984cbf1c05be61e9dbe0698e9f24..0ab42d11ddffe7ab05414355afd090d6f1d05d5f 100644 |
--- a/src/ast/scopes.cc |
+++ b/src/ast/scopes.cc |
@@ -363,11 +363,9 @@ void Scope::DeserializeScopeInfo(Isolate* isolate, |
if (scope_info_->HasFunctionName()) { |
Handle<String> name_handle(scope_info_->FunctionName(), isolate); |
const AstRawString* name = ast_value_factory->GetString(name_handle); |
- VariableMode mode; |
- int index = scope_info_->FunctionContextSlotIndex(*name_handle, &mode); |
+ int index = scope_info_->FunctionContextSlotIndex(*name_handle); |
if (index >= 0) { |
Variable* result = AsDeclarationScope()->DeclareFunctionVar(name); |
- DCHECK_EQ(mode, result->mode()); |
result->AllocateTo(VariableLocation::CONTEXT, index); |
} |
} |
@@ -475,9 +473,11 @@ void DeclarationScope::DeclareDefaultFunctionVariables( |
Variable* DeclarationScope::DeclareFunctionVar(const AstRawString* name) { |
DCHECK(is_function_scope()); |
DCHECK_NULL(function_); |
- VariableMode mode = is_strict(language_mode()) ? CONST : CONST_LEGACY; |
- function_ = new (zone()) |
- Variable(this, name, mode, Variable::NORMAL, kCreatedInitialized); |
+ Variable::Kind kind = is_sloppy(language_mode()) |
+ ? Variable::SLOPPY_FUNCTION_NAME |
+ : Variable::NORMAL; |
+ function_ = |
+ new (zone()) Variable(this, name, CONST, kind, kCreatedInitialized); |
return function_; |
} |
@@ -638,11 +638,9 @@ Variable* DeclarationScope::LookupFunctionVar(const AstRawString* name) { |
return function_; |
} else if (!scope_info_.is_null()) { |
// If we are backed by a scope info, try to lookup the variable there. |
- VariableMode mode; |
- int index = scope_info_->FunctionContextSlotIndex(*(name->string()), &mode); |
+ int index = scope_info_->FunctionContextSlotIndex(*(name->string())); |
if (index < 0) return nullptr; |
Variable* var = DeclareFunctionVar(name); |
- DCHECK_EQ(mode, var->mode()); |
var->AllocateTo(VariableLocation::CONTEXT, index); |
return var; |
} else { |
@@ -704,7 +702,7 @@ Variable* Scope::DeclareVariable( |
Declaration* declaration, VariableMode mode, InitializationFlag init, |
bool allow_harmony_restrictive_generators, |
bool* sloppy_mode_block_scope_function_redefinition, bool* ok) { |
- DCHECK(IsDeclaredVariableMode(mode) && mode != CONST_LEGACY); |
+ DCHECK(IsDeclaredVariableMode(mode)); |
DCHECK(!already_resolved_); |
if (mode == VAR && !is_declaration_scope()) { |