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

Unified Diff: src/preparser.cc

Issue 1104223002: [es6] implement optional parameters via desugaring (with scoping) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Make scoping sort-of work-ish, still no hole-checking Created 5 years, 8 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
Index: src/preparser.cc
diff --git a/src/preparser.cc b/src/preparser.cc
index 950f7b50ec35ca6a255788dac4b1aecccdef9086..d9f117ca8b0438086a22895437fe55e24459f766 100644
--- a/src/preparser.cc
+++ b/src/preparser.cc
@@ -983,6 +983,7 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
// Parse function body.
bool outer_is_script_scope = scope_->is_script_scope();
Scope* function_scope = NewScope(scope_, FUNCTION_SCOPE);
+ Scope* parameter_scope = NewScope(function_scope, PARAMETER_SCOPE);
PreParserFactory factory(NULL);
FunctionState function_state(&function_state_, &scope_, function_scope, kind,
&factory);
@@ -995,8 +996,12 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
int num_parameters;
{
DuplicateFinder duplicate_finder(scanner()->unicode_cache());
- num_parameters = ParseFormalParameterList(&duplicate_finder, &error_locs,
- &is_rest, CHECK_OK);
+ PreParserExpressionList initializers = NewExpressionList(0, zone());
+ bool has_initializers = false;
+
+ num_parameters = ParseFormalParameterList(
+ &duplicate_finder, parameter_scope, &error_locs, initializers,
+ &has_initializers, &is_rest, CHECK_OK);
}
Expect(Token::RPAREN, CHECK_OK);
int formals_end_position = scanner()->location().end_pos;
« src/globals.h ('K') | « src/preparser.h ('k') | src/runtime/runtime-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698