Index: src/ast/scopes.cc |
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc |
index 5d4b80987607b531c423a35c04cdec582a870371..c82ec698d210889b666913b42c7e3c6a619797cc 100644 |
--- a/src/ast/scopes.cc |
+++ b/src/ast/scopes.cc |
@@ -193,6 +193,7 @@ void Scope::SetDefaults(ScopeType scope_type, Scope* outer_scope, |
scope_info_ = scope_info; |
start_position_ = RelocInfo::kNoPosition; |
end_position_ = RelocInfo::kNoPosition; |
+ is_hidden_ = false; |
if (!scope_info.is_null()) { |
scope_calls_eval_ = scope_info->CallsEval(); |
language_mode_ = scope_info->language_mode(); |
@@ -287,6 +288,7 @@ bool Scope::Analyze(ParseInfo* info) { |
: FLAG_print_scopes) { |
scope->Print(); |
} |
+ scope->CheckScopePositions(); |
#endif |
info->set_scope(scope); |
@@ -1007,6 +1009,16 @@ void Scope::Print(int n) { |
Indent(n0, "}\n"); |
} |
+ |
+void Scope::CheckScopePositions() { |
+ // A scope is allowed to have invalid positions if it is hidden and has no |
+ // inner scopes |
+ if (!is_hidden() && inner_scopes_.length() == 0) { |
+ CHECK_NE(RelocInfo::kNoPosition, start_position()); |
+ CHECK_NE(RelocInfo::kNoPosition, end_position()); |
+ } |
+ for (Scope* scope : inner_scopes_) scope->CheckScopePositions(); |
+} |
#endif // DEBUG |