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

Side by Side Diff: src/parser.cc

Issue 1407633002: [es6] parse arrow ConciseBody with accept_IN flag (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove pesky stray var Created 5 years, 2 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/preparser.h » ('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 #include "src/parser.h" 5 #include "src/parser.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast.h" 8 #include "src/ast.h"
9 #include "src/ast-literal-reindexer.h" 9 #include "src/ast-literal-reindexer.h"
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 ParseFormalParameter(&formals, &formals_classifier, &ok); 1210 ParseFormalParameter(&formals, &formals_classifier, &ok);
1211 if (ok) { 1211 if (ok) {
1212 DeclareFormalParameter(formals.scope, formals.at(0), 1212 DeclareFormalParameter(formals.scope, formals.at(0),
1213 &formals_classifier); 1213 &formals_classifier);
1214 } 1214 }
1215 } 1215 }
1216 } 1216 }
1217 1217
1218 if (ok) { 1218 if (ok) {
1219 checkpoint.Restore(&formals.materialized_literals_count); 1219 checkpoint.Restore(&formals.materialized_literals_count);
1220 // Pass `accept_IN=true` to ParseArrowFunctionLiteral --- This should
1221 // not be observable, or else the preparser would have failed.
1220 Expression* expression = 1222 Expression* expression =
1221 ParseArrowFunctionLiteral(formals, formals_classifier, &ok); 1223 ParseArrowFunctionLiteral(true, formals, formals_classifier, &ok);
1222 if (ok) { 1224 if (ok) {
1223 // Scanning must end at the same position that was recorded 1225 // Scanning must end at the same position that was recorded
1224 // previously. If not, parsing has been interrupted due to a stack 1226 // previously. If not, parsing has been interrupted due to a stack
1225 // overflow, at which point the partially parsed arrow function 1227 // overflow, at which point the partially parsed arrow function
1226 // concise body happens to be a valid expression. This is a problem 1228 // concise body happens to be a valid expression. This is a problem
1227 // only for arrow functions with single expression bodies, since there 1229 // only for arrow functions with single expression bodies, since there
1228 // is no end token such as "}" for normal functions. 1230 // is no end token such as "}" for normal functions.
1229 if (scanner()->location().end_pos == shared_info->end_position()) { 1231 if (scanner()->location().end_pos == shared_info->end_position()) {
1230 // The pre-parser saw an arrow function here, so the full parser 1232 // The pre-parser saw an arrow function here, so the full parser
1231 // must produce a FunctionLiteral. 1233 // must produce a FunctionLiteral.
(...skipping 5105 matching lines...) Expand 10 before | Expand all | Expand 10 after
6337 6339
6338 Expression* Parser::SpreadCallNew(Expression* function, 6340 Expression* Parser::SpreadCallNew(Expression* function,
6339 ZoneList<v8::internal::Expression*>* args, 6341 ZoneList<v8::internal::Expression*>* args,
6340 int pos) { 6342 int pos) {
6341 args->InsertAt(0, function, zone()); 6343 args->InsertAt(0, function, zone());
6342 6344
6343 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); 6345 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos);
6344 } 6346 }
6345 } // namespace internal 6347 } // namespace internal
6346 } // namespace v8 6348 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698