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

Unified Diff: src/scopes.h

Issue 1414283002: [es6] Fix scoping for default parameters in arrow functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased Created 5 years, 2 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/pattern-rewriter.cc ('k') | src/scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scopes.h
diff --git a/src/scopes.h b/src/scopes.h
index 16581d776f09355a099645170a69ce53bb0c18e1..8400094564cff764622a8b159745e33ba56ff14f 100644
--- a/src/scopes.h
+++ b/src/scopes.h
@@ -112,6 +112,11 @@ class Scope: public ZoneObject {
// tree and its children are reparented.
Scope* FinalizeBlockScope();
+ // Inserts outer_scope into this scope's scope chain (and removes this
+ // from the current outer_scope_'s inner_scopes_).
+ // Assumes outer_scope_ is non-null.
+ void ReplaceOuterScope(Scope* outer_scope);
+
Zone* zone() const { return zone_; }
// ---------------------------------------------------------------------------
@@ -178,13 +183,19 @@ class Scope: public ZoneObject {
return proxy;
}
+ void AddUnresolved(VariableProxy* proxy) {
+ DCHECK(!already_resolved());
+ DCHECK(!proxy->is_resolved());
+ unresolved_.Add(proxy, zone_);
+ }
+
// Remove a unresolved variable. During parsing, an unresolved variable
// may have been added optimistically, but then only the variable name
// was used (typically for labels). If the variable was not declared, the
// addition introduced a new unresolved variable which may end up being
// allocated globally as a "ghost" variable. RemoveUnresolved removes
// such a variable again if it was added; otherwise this is a no-op.
- void RemoveUnresolved(VariableProxy* var);
+ bool RemoveUnresolved(VariableProxy* var);
// Creates a new temporary variable in this scope's TemporaryScope. The
// name is only used for printing and cannot be used to find the variable.
@@ -813,6 +824,16 @@ class Scope: public ZoneObject {
}
}
+ void RemoveInnerScope(Scope* inner_scope) {
+ DCHECK_NOT_NULL(inner_scope);
+ for (int i = 0; i < inner_scopes_.length(); i++) {
+ if (inner_scopes_[i] == inner_scope) {
+ inner_scopes_.Remove(i);
+ break;
+ }
+ }
+ }
+
void SetDefaults(ScopeType type, Scope* outer_scope,
Handle<ScopeInfo> scope_info,
FunctionKind function_kind = kNormalFunction);
« no previous file with comments | « src/pattern-rewriter.cc ('k') | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698