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

Side by Side Diff: src/parser.h

Issue 1251603004: [es6] Fix and clean up recognition of simple parameter lists (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase 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
« no previous file with comments | « no previous file | src/parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 // If bookmark is set, the (pre-)parser may decide to abort skipping 1147 // If bookmark is set, the (pre-)parser may decide to abort skipping
1148 // in order to force the function to be eagerly parsed, after all. 1148 // in order to force the function to be eagerly parsed, after all.
1149 // In this case, it'll reset the scanner using the bookmark. 1149 // In this case, it'll reset the scanner using the bookmark.
1150 void SkipLazyFunctionBody(int* materialized_literal_count, 1150 void SkipLazyFunctionBody(int* materialized_literal_count,
1151 int* expected_property_count, bool* ok, 1151 int* expected_property_count, bool* ok,
1152 Scanner::BookmarkScope* bookmark = nullptr); 1152 Scanner::BookmarkScope* bookmark = nullptr);
1153 1153
1154 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( 1154 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser(
1155 SingletonLogger* logger, Scanner::BookmarkScope* bookmark = nullptr); 1155 SingletonLogger* logger, Scanner::BookmarkScope* bookmark = nullptr);
1156 1156
1157 bool IsSimpleParameterList(const ParserFormalParameters& parameters);
1158 Block* BuildParameterInitializationBlock( 1157 Block* BuildParameterInitializationBlock(
1159 const ParserFormalParameters& parameters, bool* ok); 1158 const ParserFormalParameters& parameters, bool* ok);
1160 1159
1161 // Consumes the ending }. 1160 // Consumes the ending }.
1162 ZoneList<Statement*>* ParseEagerFunctionBody( 1161 ZoneList<Statement*>* ParseEagerFunctionBody(
1163 const AstRawString* function_name, int pos, 1162 const AstRawString* function_name, int pos,
1164 const ParserFormalParameters& parameters, 1163 const ParserFormalParameters& parameters,
1165 Variable* fvar, Token::Value fvar_init_op, FunctionKind kind, bool* ok); 1164 Variable* fvar, Token::Value fvar_init_op, FunctionKind kind, bool* ok);
1166 1165
1167 void ThrowPendingError(Isolate* isolate, Handle<Script> script); 1166 void ThrowPendingError(Isolate* isolate, Handle<Script> script);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 // conservative approximation necessary to account for parameters 1330 // conservative approximation necessary to account for parameters
1332 // that are assigned via the arguments array. 1331 // that are assigned via the arguments array.
1333 var->set_maybe_assigned(); 1332 var->set_maybe_assigned();
1334 } 1333 }
1335 } 1334 }
1336 1335
1337 1336
1338 void ParserTraits::AddParameterInitializationBlock( 1337 void ParserTraits::AddParameterInitializationBlock(
1339 const ParserFormalParameters& parameters, 1338 const ParserFormalParameters& parameters,
1340 ZoneList<v8::internal::Statement*>* body, bool* ok) { 1339 ZoneList<v8::internal::Statement*>* body, bool* ok) {
1341 if (!parser_->IsSimpleParameterList(parameters)) { 1340 if (!parameters.is_simple) {
1342 auto* init_block = 1341 auto* init_block =
1343 parser_->BuildParameterInitializationBlock(parameters, ok); 1342 parser_->BuildParameterInitializationBlock(parameters, ok);
1344 if (!*ok) return; 1343 if (!*ok) return;
1345 if (init_block != nullptr) { 1344 if (init_block != nullptr) {
1346 body->Add(init_block, parser_->zone()); 1345 body->Add(init_block, parser_->zone());
1347 } 1346 }
1348 } 1347 }
1349 } 1348 }
1350 } } // namespace v8::internal 1349 } } // namespace v8::internal
1351 1350
1352 #endif // V8_PARSER_H_ 1351 #endif // V8_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698