Index: src/ast/scopes.cc |
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc |
index c150336668545eb1a8bf78b3af3823f70bb476c1..21d67bcf5b24288f9f8dcb12f1200a5af67989c6 100644 |
--- a/src/ast/scopes.cc |
+++ b/src/ast/scopes.cc |
@@ -636,6 +636,22 @@ Variable* DeclarationScope::DeclareFunctionVar(const AstRawString* name) { |
return function_; |
} |
+bool Scope::HasBeenRemoved() const { |
+ Scope* parent = outer_scope(); |
Toon Verwaest
2016/11/22 08:30:18
if (is_declaration_scope()) return false; ?
Dan Ehrenberg
2016/11/22 16:07:00
Or, that could be an assertion before the return t
Toon Verwaest
2016/11/22 16:18:37
That's what I was originally thinking of suggestin
neis
2016/11/23 12:51:08
Done.
|
+ 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; |
+ } |
Dan Ehrenberg
2016/11/22 16:07:00
This is asymptotically a bit unfortunate. Is there
Toon Verwaest
2016/11/22 16:19:47
Yeah that's a good suggestion though. We can just
|
+ |
+ DCHECK_NULL(inner_scope_); |
+ return true; |
+} |
+ |
Scope* Scope::FinalizeBlockScope() { |
DCHECK(is_block_scope()); |