| 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.
|
|
|