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

Unified Diff: src/ast/scopes.cc

Issue 2617923003: PreParsing inner funcs: make scope analysis more complete. (Closed)
Patch Set: Created 3 years, 11 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/parsing/parser.cc » ('j') | src/parsing/parser.cc » ('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 5e29af727d24fc7a624de948d05671c00a17674a..41f2ec320beb4d482b7b7ddb17e33d9b745535ad 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -1032,11 +1032,14 @@ void Scope::DeclareVariableName(const AstRawString* name, VariableMode mode) {
if (mode == VAR && !is_declaration_scope()) {
return GetDeclarationScope()->DeclareVariableName(name, mode);
}
- DCHECK(!is_catch_scope());
DCHECK(!is_with_scope());
DCHECK(!is_eval_scope());
- DCHECK(is_declaration_scope() ||
- (IsLexicalVariableMode(mode) && is_block_scope()));
+ // Unlike DeclareVariable, DeclareVariableName allows declaring variables in
+ // catch scopes: Parser::RewriteCatchPattern bypasses DeclareVariable by
+ // calling DeclareLocal directly, and it doesn't make sense to add a similar
+ // bypass mechanism for PreParser.
+ DCHECK(is_declaration_scope() || (IsLexicalVariableMode(mode) &&
+ (is_block_scope() || is_catch_scope())));
DCHECK(scope_info_.is_null());
// Declare the variable in the declaration scope.
« no previous file with comments | « no previous file | src/parsing/parser.cc » ('j') | src/parsing/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698