Index: src/ast/scopes.cc |
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc |
index c150336668545eb1a8bf78b3af3823f70bb476c1..fc86e60257d8c2308aec20dd728bb7916f0e9d3d 100644 |
--- a/src/ast/scopes.cc |
+++ b/src/ast/scopes.cc |
@@ -636,6 +636,24 @@ Variable* DeclarationScope::DeclareFunctionVar(const AstRawString* name) { |
return function_; |
} |
+bool Scope::HasBeenRemoved() const { |
+ if (!is_block_scope() || is_declaration_scope()) return false; // Shortcut. |
Toon Verwaest
2016/11/23 12:20:45
if (is_declaration_scope()) return false;
DCHECK(i
neis
2016/11/23 15:52:38
This DCHECK is failing, for instance in the follow
|
+ |
+ Scope* parent = outer_scope(); |
+ if (parent == nullptr) { |
+ DCHECK(is_script_scope()); |
+ return false; |
+ } |
+ |
+ Scope* sibling = parent->inner_scope(); |
+ for (; sibling != nullptr; sibling = sibling->sibling()) { |
+ if (sibling == this) return false; |
+ } |
+ |
+ DCHECK_NULL(inner_scope_); |
+ return true; |
+} |
+ |
Scope* Scope::FinalizeBlockScope() { |
DCHECK(is_block_scope()); |