Chromium Code Reviews| Index: src/ast/scopes.h |
| diff --git a/src/ast/scopes.h b/src/ast/scopes.h |
| index d8edf9148fe91a6cbc5221b095eee599962017cc..98b56fe515a5cedbbf4947cdacfadbe0cb6ed655 100644 |
| --- a/src/ast/scopes.h |
| +++ b/src/ast/scopes.h |
| @@ -199,6 +199,7 @@ class Scope: public ZoneObject { |
| // the same name because they may be removed selectively via |
| // RemoveUnresolved(). |
| DCHECK(!already_resolved()); |
| + DCHECK_EQ(factory->zone(), zone()); |
| VariableProxy* proxy = |
| factory->NewVariableProxy(name, kind, start_position, end_position); |
| proxy->set_next_unresolved(unresolved_); |
| @@ -586,6 +587,11 @@ class Scope: public ZoneObject { |
| Handle<StringSet> CollectNonLocals(Handle<StringSet> non_locals); |
| + // Tries to resolve local variables inside max_outer_scope; collects those |
| + // which cannot be resolved. |
| + void CollectUnresolvableLocals(VariableProxy** still_unresolved, |
|
titzer
2016/08/01 17:58:43
Since this is a public method, is it possible to w
marja
2016/08/02 07:42:37
Oops, this was public by accident, making it priva
|
| + Scope* max_outer_scope); |
| + |
| // --------------------------------------------------------------------------- |
| // Strict mode support. |
| bool IsDeclared(const AstRawString* name) { |
| @@ -608,6 +614,13 @@ class Scope: public ZoneObject { |
| return &sloppy_block_function_map_; |
| } |
| + // To be called during parsing. Do just enough scope analysis that we can |
| + // discard the Scope for lazily compiled functions. In particular, this |
| + // records variables which cannot be resolved inside the Scope (we don't yet |
| + // know what they will resolve to since the outer Scopes are incomplete) and |
| + // migrates them into migrate_to. |
| + void AnalyzePartially(Scope* migrate_to, AstNodeFactory* ast_node_factory); |
|
titzer
2016/08/01 17:58:43
Same here. Is it possible to write a unittest that
marja
2016/08/02 07:42:37
I'll look into that after this CL to see how much
|
| + |
| // --------------------------------------------------------------------------- |
| // Debugging. |
| @@ -616,6 +629,9 @@ class Scope: public ZoneObject { |
| // Check that the scope has positions assigned. |
| void CheckScopePositions(); |
| + |
| + // Check that all Scopes in the scope tree use the same Zone. |
| + void CheckZones(); |
| #endif |
| // --------------------------------------------------------------------------- |
| @@ -775,10 +791,12 @@ class Scope: public ZoneObject { |
| }; |
| // Lookup a variable reference given by name recursively starting with this |
| - // scope. If the code is executed because of a call to 'eval', the context |
| - // parameter should be set to the calling context of 'eval'. |
| + // scope, but only until max_outer_scope (if not nullptr). If the code is |
| + // executed because of a call to 'eval', the context parameter should be set |
| + // to the calling context of 'eval'. |
| Variable* LookupRecursive(VariableProxy* proxy, BindingKind* binding_kind, |
| - AstNodeFactory* factory); |
| + AstNodeFactory* factory, |
| + Scope* max_outer_scope = nullptr); |
| MUST_USE_RESULT |
| bool ResolveVariable(ParseInfo* info, VariableProxy* proxy, |
| AstNodeFactory* factory); |