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

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: arv's comments 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 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 PreParserFactory factory(NULL); 1024 PreParserFactory factory(NULL);
1025 FunctionState function_state(&function_state_, &scope_, function_scope, kind, 1025 FunctionState function_state(&function_state_, &scope_, function_scope, kind,
1026 &factory); 1026 &factory);
1027 FormalParameterErrorLocations error_locs; 1027 FormalParameterErrorLocations error_locs;
1028 1028
1029 bool is_rest = false; 1029 bool is_rest = false;
1030 Expect(Token::LPAREN, CHECK_OK); 1030 Expect(Token::LPAREN, CHECK_OK);
1031 int start_position = scanner()->location().beg_pos; 1031 int start_position = scanner()->location().beg_pos;
1032 function_scope->set_start_position(start_position); 1032 function_scope->set_start_position(start_position);
1033 int num_parameters; 1033 int num_parameters;
1034 bool has_initializers = false;
1034 { 1035 {
1035 DuplicateFinder duplicate_finder(scanner()->unicode_cache()); 1036 DuplicateFinder duplicate_finder(scanner()->unicode_cache());
1036 num_parameters = ParseFormalParameterList(&duplicate_finder, &error_locs, 1037 PreParserExpressionList initializers = NewExpressionList(0, zone());
1037 &is_rest, CHECK_OK); 1038 num_parameters =
1039 ParseFormalParameterList(&duplicate_finder, &error_locs, initializers,
1040 &has_initializers, &is_rest, CHECK_OK);
1038 } 1041 }
1039 Expect(Token::RPAREN, CHECK_OK); 1042 Expect(Token::RPAREN, CHECK_OK);
1040 int formals_end_position = scanner()->location().end_pos; 1043 int formals_end_position = scanner()->location().end_pos;
1041 1044
1042 CheckArityRestrictions(num_parameters, arity_restriction, start_position, 1045 CheckArityRestrictions(num_parameters, arity_restriction, start_position,
1043 formals_end_position, CHECK_OK); 1046 formals_end_position, CHECK_OK);
1044 1047
1045 // See Parser::ParseFunctionLiteral for more information about lazy parsing 1048 // See Parser::ParseFunctionLiteral for more information about lazy parsing
1046 // and lazy compilation. 1049 // and lazy compilation.
1047 bool is_lazily_parsed = 1050 bool is_lazily_parsed =
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 1177
1175 DCHECK(!spread_pos.IsValid()); 1178 DCHECK(!spread_pos.IsValid());
1176 1179
1177 return Expression::Default(); 1180 return Expression::Default();
1178 } 1181 }
1179 1182
1180 #undef CHECK_OK 1183 #undef CHECK_OK
1181 1184
1182 1185
1183 } } // v8::internal 1186 } } // v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698