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

Side by Side Diff: src/parser.h

Issue 1235153006: [es6] re-implement rest parameters via desugaring (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: More/fewer removals 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #ifndef V8_PARSER_H_ 5 #ifndef V8_PARSER_H_
6 #define V8_PARSER_H_ 6 #define V8_PARSER_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/ast.h" 9 #include "src/ast.h"
10 #include "src/compiler.h" // TODO(titzer): remove this include dependency 10 #include "src/compiler.h" // TODO(titzer): remove this include dependency
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 return parser_->SpreadCallNew(function, args, pos); 1306 return parser_->SpreadCallNew(function, args, pos);
1307 } 1307 }
1308 1308
1309 1309
1310 void ParserTraits::DeclareFormalParameter( 1310 void ParserTraits::DeclareFormalParameter(
1311 ParserFormalParameterParsingState* parsing_state, Expression* pattern, 1311 ParserFormalParameterParsingState* parsing_state, Expression* pattern,
1312 ExpressionClassifier* classifier, bool is_rest) { 1312 ExpressionClassifier* classifier, bool is_rest) {
1313 bool is_duplicate = false; 1313 bool is_duplicate = false;
1314 bool is_simple_name = pattern->IsVariableProxy(); 1314 bool is_simple_name = pattern->IsVariableProxy();
1315 DCHECK(parser_->allow_harmony_destructuring() || is_simple_name); 1315 DCHECK(parser_->allow_harmony_destructuring() || is_simple_name);
1316 1316 if (is_rest) parsing_state->has_rest = true;
1317 const AstRawString* name = is_simple_name 1317 const AstRawString* name = is_simple_name
1318 ? pattern->AsVariableProxy()->raw_name() 1318 ? pattern->AsVariableProxy()->raw_name()
1319 : parser_->ast_value_factory()->empty_string(); 1319 : parser_->ast_value_factory()->empty_string();
1320 Variable* var = 1320 Variable* var =
1321 parsing_state->scope->DeclareParameter(name, VAR, is_rest, &is_duplicate); 1321 parsing_state->scope->DeclareParameter(name, VAR, is_rest, &is_duplicate);
1322 parsing_state->AddParameter(var, is_simple_name ? nullptr : pattern); 1322 parsing_state->AddParameter(var, is_simple_name ? nullptr : pattern);
1323 if (is_sloppy(parsing_state->scope->language_mode())) { 1323 if (is_sloppy(parsing_state->scope->language_mode())) {
1324 // TODO(sigurds) Mark every parameter as maybe assigned. This is a 1324 // TODO(sigurds) Mark every parameter as maybe assigned. This is a
1325 // conservative approximation necessary to account for parameters 1325 // conservative approximation necessary to account for parameters
1326 // that are assigned via the arguments array. 1326 // that are assigned via the arguments array.
(...skipping 12 matching lines...) Expand all
1339 auto* init_block = 1339 auto* init_block =
1340 parser_->BuildParameterInitializationBlock(formal_parameters, ok); 1340 parser_->BuildParameterInitializationBlock(formal_parameters, ok);
1341 if (!*ok) return; 1341 if (!*ok) return;
1342 if (init_block != nullptr) { 1342 if (init_block != nullptr) {
1343 body->Add(init_block, parser_->zone()); 1343 body->Add(init_block, parser_->zone());
1344 } 1344 }
1345 } 1345 }
1346 } } // namespace v8::internal 1346 } } // namespace v8::internal
1347 1347
1348 #endif // V8_PARSER_H_ 1348 #endif // V8_PARSER_H_
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/parser.cc » ('j') | src/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698