Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Unified Diff: src/ast/scopes.cc

Issue 2263523002: Add some scope-related DCHECKs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/ast/variables.h » ('j') | src/ast/variables.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/scopes.cc
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc
index 376fbc532af2e848365ba5d822bde2f01ea20ab7..322f801317c3b09a5373dbfe153f94aabe1d5eaf 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -254,17 +254,24 @@ Scope* Scope::DeserializeScopeChain(Isolate* isolate, Zone* zone,
}
} else if (context->IsScriptContext()) {
Handle<ScopeInfo> scope_info(context->scope_info(), isolate);
+ DCHECK(scope_info->scope_type() == SCRIPT_SCOPE);
Toon Verwaest 2016/08/19 12:48:52 DCHECK_EQ
current_scope = new (zone)
DeclarationScope(zone, current_scope, SCRIPT_SCOPE, scope_info);
} else if (context->IsFunctionContext()) {
Handle<ScopeInfo> scope_info(context->closure()->shared()->scope_info(),
isolate);
+ // TODO(neis): For an eval scope, we currently create an ordinary function
+ // context. This is wrong and needs to be fixed.
+ // https://bugs.chromium.org/p/v8/issues/detail?id=5295
+ DCHECK(scope_info->scope_type() == FUNCTION_SCOPE ||
+ scope_info->scope_type() == EVAL_SCOPE);
current_scope = new (zone)
DeclarationScope(zone, current_scope, FUNCTION_SCOPE, scope_info);
if (scope_info->IsAsmFunction()) current_scope->asm_function_ = true;
if (scope_info->IsAsmModule()) current_scope->asm_module_ = true;
} else if (context->IsBlockContext()) {
Handle<ScopeInfo> scope_info(context->scope_info(), isolate);
+ DCHECK(scope_info->scope_type() == BLOCK_SCOPE);
Toon Verwaest 2016/08/19 12:48:52 DCHECK_EQ
if (scope_info->is_declaration_scope()) {
current_scope = new (zone)
DeclarationScope(zone, current_scope, BLOCK_SCOPE, scope_info);
« no previous file with comments | « no previous file | src/ast/variables.h » ('j') | src/ast/variables.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698