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

Unified Diff: src/preparser.h

Issue 1235153006: [es6] re-implement rest parameters via desugaring (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Refactor Scope::TempScope Created 5 years, 5 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 | « src/pattern-rewriter.cc ('k') | src/runtime.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « src/pattern-rewriter.cc ('k') | src/runtime.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698