Index: src/preparser.h |
diff --git a/src/preparser.h b/src/preparser.h |
index 8680f88bf940ff208f9b419ca90d048e98917374..a0ff0ce45f68fcffa92f1712da5b9564abfded6e 100644 |
--- a/src/preparser.h |
+++ b/src/preparser.h |
@@ -3511,6 +3511,11 @@ ParserBase<Traits>::ParseSuperExpression(bool is_new, |
scope = scope->DeclarationScope(); |
} |
+ if (scope->is_block_scope() && scope->is_declaration_scope()) { |
+ scope = scope->outer_scope(); |
+ DCHECK(scope->is_function_scope()); |
+ } |
+ |
FunctionKind kind = scope->function_kind(); |
if (IsConciseMethod(kind) || IsAccessorFunction(kind) || |
i::IsConstructor(kind)) { |
@@ -3554,7 +3559,11 @@ ParserBase<Traits>::ParseNewTargetExpression(bool* ok) { |
DCHECK_NOT_NULL(scope); |
scope = scope->DeclarationScope(); |
} |
- |
+ if (scope->is_block_scope() && scope->is_declaration_scope()) { |
+ // Inner function scope |
+ scope = scope->outer_scope(); |
+ DCHECK(scope->is_function_scope()); |
+ } |
if (!scope->is_function_scope()) { |
ReportMessageAt(scanner()->location(), |
MessageTemplate::kUnexpectedNewTarget); |
@@ -3700,7 +3709,6 @@ int ParserBase<Traits>::ParseFormalParameterList( |
return -1; |
} |
} |
- |
return parameter_count; |
} |