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

Side by Side Diff: src/parser.h

Issue 1234213004: [parser] use-strict directives in function body affect init block (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix arrow-function failures 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 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 // If bookmark is set, the (pre-)parser may decide to abort skipping 1148 // If bookmark is set, the (pre-)parser may decide to abort skipping
1149 // in order to force the function to be eagerly parsed, after all. 1149 // in order to force the function to be eagerly parsed, after all.
1150 // In this case, it'll reset the scanner using the bookmark. 1150 // In this case, it'll reset the scanner using the bookmark.
1151 void SkipLazyFunctionBody(int* materialized_literal_count, 1151 void SkipLazyFunctionBody(int* materialized_literal_count,
1152 int* expected_property_count, bool* ok, 1152 int* expected_property_count, bool* ok,
1153 Scanner::BookmarkScope* bookmark = nullptr); 1153 Scanner::BookmarkScope* bookmark = nullptr);
1154 1154
1155 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( 1155 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser(
1156 SingletonLogger* logger, Scanner::BookmarkScope* bookmark = nullptr); 1156 SingletonLogger* logger, Scanner::BookmarkScope* bookmark = nullptr);
1157 1157
1158 bool IsSimpleParameterList(
1159 const ParserFormalParameterParsingState& formal_parameters);
1158 Block* BuildParameterInitializationBlock( 1160 Block* BuildParameterInitializationBlock(
1159 const ParserFormalParameterParsingState& formal_parameters, bool* ok); 1161 const ParserFormalParameterParsingState& formal_parameters, bool* ok);
1160 1162
1161 // Consumes the ending }. 1163 // Consumes the ending }.
1162 ZoneList<Statement*>* ParseEagerFunctionBody( 1164 ZoneList<Statement*>* ParseEagerFunctionBody(
1163 const AstRawString* function_name, int pos, 1165 const AstRawString* function_name, int pos,
1164 const ParserFormalParameterParsingState& formal_parameters, 1166 const ParserFormalParameterParsingState& formal_parameters,
1165 Variable* fvar, Token::Value fvar_init_op, FunctionKind kind, bool* ok); 1167 Variable* fvar, Token::Value fvar_init_op, FunctionKind kind, bool* ok);
1166 1168
1167 void ThrowPendingError(Isolate* isolate, Handle<Script> script); 1169 void ThrowPendingError(Isolate* isolate, Handle<Script> script);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 if (is_duplicate) { 1333 if (is_duplicate) {
1332 classifier->RecordDuplicateFormalParameterError( 1334 classifier->RecordDuplicateFormalParameterError(
1333 parser_->scanner()->location()); 1335 parser_->scanner()->location());
1334 } 1336 }
1335 } 1337 }
1336 1338
1337 1339
1338 void ParserTraits::AddParameterInitializationBlock( 1340 void ParserTraits::AddParameterInitializationBlock(
1339 const ParserFormalParameterParsingState& formal_parameters, 1341 const ParserFormalParameterParsingState& formal_parameters,
1340 ZoneList<v8::internal::Statement*>* body, bool* ok) { 1342 ZoneList<v8::internal::Statement*>* body, bool* ok) {
1343 if (parser_->IsSimpleParameterList(formal_parameters)) return;
1341 auto* init_block = 1344 auto* init_block =
1342 parser_->BuildParameterInitializationBlock(formal_parameters, ok); 1345 parser_->BuildParameterInitializationBlock(formal_parameters, ok);
1343 if (!*ok) return; 1346 if (!*ok) return;
1344 if (init_block != nullptr) { 1347 if (init_block != nullptr) {
1345 body->Add(init_block, parser_->zone()); 1348 body->Add(init_block, parser_->zone());
1346 } 1349 }
1347 } 1350 }
1348 } } // namespace v8::internal 1351 } } // namespace v8::internal
1349 1352
1350 #endif // V8_PARSER_H_ 1353 #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