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

Side by Side Diff: src/parsing/parser-base.h

Issue 1895603002: [esnext] prototype runtime implementation for async functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@AsyncFunction
Patch Set: fix test nits Created 4 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 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_PARSING_PARSER_BASE_H 5 #ifndef V8_PARSING_PARSER_BASE_H
6 #define V8_PARSING_PARSER_BASE_H 6 #define V8_PARSING_PARSER_BASE_H
7 7
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/bailout-reason.h" 9 #include "src/bailout-reason.h"
10 #include "src/hashmap.h" 10 #include "src/hashmap.h"
(...skipping 3316 matching lines...) Expand 10 before | Expand all | Expand 10 after
3327 expected_property_count = function_state.expected_property_count(); 3327 expected_property_count = function_state.expected_property_count();
3328 } 3328 }
3329 } else { 3329 } else {
3330 // Single-expression body 3330 // Single-expression body
3331 int pos = position(); 3331 int pos = position();
3332 ExpressionClassifier classifier(this); 3332 ExpressionClassifier classifier(this);
3333 DCHECK(ReturnExprContext::kInsideValidBlock == 3333 DCHECK(ReturnExprContext::kInsideValidBlock ==
3334 function_state_->return_expr_context()); 3334 function_state_->return_expr_context());
3335 ReturnExprScope allow_tail_calls( 3335 ReturnExprScope allow_tail_calls(
3336 function_state_, ReturnExprContext::kInsideValidReturnStatement); 3336 function_state_, ReturnExprContext::kInsideValidReturnStatement);
3337 ExpressionT expression =
3338 ParseAssignmentExpression(accept_IN, &classifier, CHECK_OK);
3339 Traits::RewriteNonPattern(&classifier, CHECK_OK);
3340 body = this->NewStatementList(1, zone()); 3337 body = this->NewStatementList(1, zone());
3341 this->AddParameterInitializationBlock(formal_parameters, body, CHECK_OK); 3338 this->AddParameterInitializationBlock(formal_parameters, body, is_async,
3342 body->Add(factory()->NewReturnStatement(expression, pos), zone()); 3339 CHECK_OK);
3340 if (is_async) {
3341 this->ParseAsyncArrowSingleExpressionBody(body, accept_IN, &classifier,
3342 pos, CHECK_OK);
3343 Traits::RewriteNonPattern(&classifier, CHECK_OK);
3344 } else {
3345 ExpressionT expression =
3346 ParseAssignmentExpression(accept_IN, &classifier, CHECK_OK);
3347 Traits::RewriteNonPattern(&classifier, CHECK_OK);
3348 body->Add(factory()->NewReturnStatement(expression, pos), zone());
3349 if (allow_tailcalls() && !is_sloppy(language_mode())) {
3350 // ES6 14.6.1 Static Semantics: IsInTailPosition
3351 this->MarkTailPosition(expression);
3352 }
3353 }
3343 materialized_literal_count = function_state.materialized_literal_count(); 3354 materialized_literal_count = function_state.materialized_literal_count();
3344 expected_property_count = function_state.expected_property_count(); 3355 expected_property_count = function_state.expected_property_count();
3345 if (allow_tailcalls() && !is_sloppy(language_mode())) {
3346 // ES6 14.6.1 Static Semantics: IsInTailPosition
3347 this->MarkTailPosition(expression);
3348 }
3349 this->MarkCollectedTailCallExpressions(); 3356 this->MarkCollectedTailCallExpressions();
3350 } 3357 }
3351 super_loc = function_state.super_location(); 3358 super_loc = function_state.super_location();
3352 3359
3353 formal_parameters.scope->set_end_position(scanner()->location().end_pos); 3360 formal_parameters.scope->set_end_position(scanner()->location().end_pos);
3354 3361
3355 // Arrow function formal parameters are parsed as StrictFormalParameterList, 3362 // Arrow function formal parameters are parsed as StrictFormalParameterList,
3356 // which is not the same as "parameters of a strict function"; it only means 3363 // which is not the same as "parameters of a strict function"; it only means
3357 // that duplicates are not allowed. Of course, the arrow function may 3364 // that duplicates are not allowed. Of course, the arrow function may
3358 // itself be strict as well. 3365 // itself be strict as well.
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
3598 has_seen_constructor_ = true; 3605 has_seen_constructor_ = true;
3599 return; 3606 return;
3600 } 3607 }
3601 } 3608 }
3602 3609
3603 3610
3604 } // namespace internal 3611 } // namespace internal
3605 } // namespace v8 3612 } // namespace v8
3606 3613
3607 #endif // V8_PARSING_PARSER_BASE_H 3614 #endif // V8_PARSING_PARSER_BASE_H
OLDNEW
« src/builtins.cc ('K') | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698