diff options
Diffstat (limited to 'src/scopes.cc')
| -rw-r--r-- | src/scopes.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/scopes.cc b/src/scopes.cc index 859cbd1a..c142c3d6 100644 --- a/src/scopes.cc +++ b/src/scopes.cc @@ -649,6 +649,26 @@ bool Scope::HasTrivialOuterContext() const { } +bool Scope::AllowsLazyRecompilation() const { + return !force_eager_compilation_ && + !TrivialDeclarationScopesBeforeWithScope(); +} + + +bool Scope::TrivialDeclarationScopesBeforeWithScope() const { + Scope* outer = outer_scope_; + if (outer == NULL) return false; + outer = outer->DeclarationScope(); + while (outer != NULL) { + if (outer->is_with_scope()) return true; + if (outer->is_declaration_scope() && outer->num_heap_slots() > 0) + return false; + outer = outer->outer_scope_; + } + return false; +} + + int Scope::ContextChainLength(Scope* scope) { int n = 0; for (Scope* s = this; s != scope; s = s->outer_scope_) { |
