Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1216)

Unified Diff: src/ast/scopes.cc

Issue 2237873002: Declare 'this' as DYNAMIC_GLOBAL on the script_scope (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: typo Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ast/scopes.h ('k') | src/parsing/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/scopes.cc
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc
index 8f24894a8019ac7c42fbb63605d588c6fb2e9060..d81ccc20497e426c4cfda47ef4297f18d81f8bd3 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -1252,8 +1252,7 @@ void Scope::CheckZones() {
}
#endif // DEBUG
-Variable* Scope::NonLocal(const AstRawString* name, VariableMode mode,
- Variable::Kind kind) {
+Variable* Scope::NonLocal(const AstRawString* name, VariableMode mode) {
if (dynamics_ == NULL) dynamics_ = new (zone()) DynamicScopePart(zone());
VariableMap* map = dynamics_->GetMap(mode);
Variable* var = map->Lookup(name);
@@ -1261,7 +1260,7 @@ Variable* Scope::NonLocal(const AstRawString* name, VariableMode mode,
// Declare a new non-local.
InitializationFlag init_flag = (mode == VAR)
? kCreatedInitialized : kNeedsInitialization;
- var = map->Declare(zone(), NULL, name, mode, kind, init_flag);
+ var = map->Declare(zone(), NULL, name, mode, Variable::NORMAL, init_flag);
// Allocate it by giving it a dynamic lookup.
var->AllocateTo(VariableLocation::LOOKUP, -1);
}
@@ -1385,9 +1384,6 @@ void Scope::ResolveTo(ParseInfo* info, BindingKind binding_kind,
}
#endif
- // TODO(verwaest): 'this' should always be declared and found. That way we can
- // remove this workaround.
- Variable::Kind kind = proxy->is_this() ? Variable::THIS : Variable::NORMAL;
switch (binding_kind) {
case BOUND:
break;
@@ -1398,29 +1394,30 @@ void Scope::ResolveTo(ParseInfo* info, BindingKind binding_kind,
// scope which was not promoted to a context, this can happen if we use
// debugger to evaluate arbitrary expressions at a break point).
if (var->IsGlobalObjectProperty()) {
- var = NonLocal(proxy->raw_name(), DYNAMIC_GLOBAL, kind);
+ var = NonLocal(proxy->raw_name(), DYNAMIC_GLOBAL);
} else if (var->is_dynamic()) {
- var = NonLocal(proxy->raw_name(), DYNAMIC, kind);
+ var = NonLocal(proxy->raw_name(), DYNAMIC);
} else {
Variable* invalidated = var;
- var = NonLocal(proxy->raw_name(), DYNAMIC_LOCAL, kind);
+ var = NonLocal(proxy->raw_name(), DYNAMIC_LOCAL);
var->set_local_if_not_shadowed(invalidated);
}
break;
case UNBOUND:
// No binding has been found. Declare a variable on the global object.
- var = info->script_scope()->DeclareDynamicGlobal(proxy->raw_name(), kind);
+ var = info->script_scope()->DeclareDynamicGlobal(proxy->raw_name(),
+ Variable::NORMAL);
break;
case UNBOUND_EVAL_SHADOWED:
// No binding has been found. But some scope makes a sloppy 'eval' call.
- var = NonLocal(proxy->raw_name(), DYNAMIC_GLOBAL, kind);
+ var = NonLocal(proxy->raw_name(), DYNAMIC_GLOBAL);
break;
case DYNAMIC_LOOKUP:
// The variable could not be resolved statically.
- var = NonLocal(proxy->raw_name(), DYNAMIC, kind);
+ var = NonLocal(proxy->raw_name(), DYNAMIC);
break;
}
« no previous file with comments | « src/ast/scopes.h ('k') | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698