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

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: Disable test262 module tests. 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') | no next file with comments »
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 417345a5ef8b6ae33969c54126d16c98d5d4188d..eb5f0a83328f06375a2e5e442fe6268290915de8 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -262,11 +262,17 @@ Scope* Scope::DeserializeScopeChain(Isolate* isolate, Zone* zone,
}
} else if (context->IsScriptContext()) {
Handle<ScopeInfo> scope_info(context->scope_info(), isolate);
+ DCHECK_EQ(scope_info->scope_type(), SCRIPT_SCOPE);
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);
DeclarationScope* function_scope = new (zone)
DeclarationScope(zone, current_scope, FUNCTION_SCOPE, scope_info);
if (scope_info->IsAsmFunction()) function_scope->set_asm_function();
@@ -274,6 +280,7 @@ Scope* Scope::DeserializeScopeChain(Isolate* isolate, Zone* zone,
current_scope = function_scope;
} else if (context->IsBlockContext()) {
Handle<ScopeInfo> scope_info(context->scope_info(), isolate);
+ DCHECK_EQ(scope_info->scope_type(), BLOCK_SCOPE);
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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698