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

Side by Side Diff: src/preparser.cc

Issue 1127063003: [es6] implement default parameters via desugaring (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <cmath> 5 #include <cmath>
6 6
7 #include "src/allocation.h" 7 #include "src/allocation.h"
8 #include "src/base/logging.h" 8 #include "src/base/logging.h"
9 #include "src/conversions-inl.h" 9 #include "src/conversions-inl.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 PreParserFactory factory(NULL); 999 PreParserFactory factory(NULL);
1000 FunctionState function_state(&function_state_, &scope_, function_scope, kind, 1000 FunctionState function_state(&function_state_, &scope_, function_scope, kind,
1001 &factory); 1001 &factory);
1002 FormalParameterErrorLocations error_locs; 1002 FormalParameterErrorLocations error_locs;
1003 1003
1004 bool is_rest = false; 1004 bool is_rest = false;
1005 Expect(Token::LPAREN, CHECK_OK); 1005 Expect(Token::LPAREN, CHECK_OK);
1006 int start_position = scanner()->location().beg_pos; 1006 int start_position = scanner()->location().beg_pos;
1007 function_scope->set_start_position(start_position); 1007 function_scope->set_start_position(start_position);
1008 int num_parameters; 1008 int num_parameters;
1009 bool has_initializers = false;
1009 { 1010 {
1010 DuplicateFinder duplicate_finder(scanner()->unicode_cache()); 1011 DuplicateFinder duplicate_finder(scanner()->unicode_cache());
1011 num_parameters = ParseFormalParameterList(&duplicate_finder, &error_locs, 1012 PreParserExpressionList initializers = NewExpressionList(0, zone());
1012 &is_rest, CHECK_OK); 1013 num_parameters =
1014 ParseFormalParameterList(&duplicate_finder, &error_locs, initializers,
1015 &has_initializers, &is_rest, CHECK_OK);
1013 } 1016 }
1014 Expect(Token::RPAREN, CHECK_OK); 1017 Expect(Token::RPAREN, CHECK_OK);
1015 int formals_end_position = scanner()->location().end_pos; 1018 int formals_end_position = scanner()->location().end_pos;
1016 1019
1017 CheckArityRestrictions(num_parameters, arity_restriction, start_position, 1020 CheckArityRestrictions(num_parameters, arity_restriction, start_position,
1018 formals_end_position, CHECK_OK); 1021 formals_end_position, CHECK_OK);
1019 1022
1020 // See Parser::ParseFunctionLiteral for more information about lazy parsing 1023 // See Parser::ParseFunctionLiteral for more information about lazy parsing
1021 // and lazy compilation. 1024 // and lazy compilation.
1022 bool is_lazily_parsed = 1025 bool is_lazily_parsed =
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 1150
1148 DCHECK(!spread_pos.IsValid()); 1151 DCHECK(!spread_pos.IsValid());
1149 1152
1150 return Expression::Default(); 1153 return Expression::Default();
1151 } 1154 }
1152 1155
1153 #undef CHECK_OK 1156 #undef CHECK_OK
1154 1157
1155 1158
1156 } } // v8::internal 1159 } } // v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698