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

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

Issue 1620253003: Implement the function.sent proposal. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add TODO Created 4 years, 10 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 | « src/parsing/parser.cc ('k') | src/parsing/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 #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 2526 matching lines...) Expand 10 before | Expand all | Expand 10 after
2537 // caller. 2537 // caller.
2538 2538
2539 // Parse the initial primary or function expression. 2539 // Parse the initial primary or function expression.
2540 ExpressionT result = this->EmptyExpression(); 2540 ExpressionT result = this->EmptyExpression();
2541 if (peek() == Token::FUNCTION) { 2541 if (peek() == Token::FUNCTION) {
2542 BindingPatternUnexpectedToken(classifier); 2542 BindingPatternUnexpectedToken(classifier);
2543 ArrowFormalParametersUnexpectedToken(classifier); 2543 ArrowFormalParametersUnexpectedToken(classifier);
2544 2544
2545 Consume(Token::FUNCTION); 2545 Consume(Token::FUNCTION);
2546 int function_token_position = position(); 2546 int function_token_position = position();
2547
2548 if (FLAG_harmony_function_sent && Check(Token::PERIOD)) {
2549 // function.sent
2550
2551 int pos = position();
2552 ExpectContextualKeyword(CStrVector("sent"), CHECK_OK);
2553
2554 if (!is_generator()) {
2555 // TODO(neis): allow escaping into closures?
2556 ReportMessageAt(scanner()->location(),
2557 MessageTemplate::kUnexpectedFunctionSent);
2558 *ok = false;
2559 return this->EmptyExpression();
2560 }
2561
2562 return this->FunctionSentExpression(scope_, factory(), pos);
2563 }
2564
2547 bool is_generator = Check(Token::MUL); 2565 bool is_generator = Check(Token::MUL);
2548 IdentifierT name = this->EmptyIdentifier(); 2566 IdentifierT name = this->EmptyIdentifier();
2549 bool is_strict_reserved_name = false; 2567 bool is_strict_reserved_name = false;
2550 Scanner::Location function_name_location = Scanner::Location::invalid(); 2568 Scanner::Location function_name_location = Scanner::Location::invalid();
2551 FunctionLiteral::FunctionType function_type = 2569 FunctionLiteral::FunctionType function_type =
2552 FunctionLiteral::kAnonymousExpression; 2570 FunctionLiteral::kAnonymousExpression;
2553 if (peek_any_identifier()) { 2571 if (peek_any_identifier()) {
2554 name = ParseIdentifierOrStrictReservedWord( 2572 name = ParseIdentifierOrStrictReservedWord(
2555 is_generator, &is_strict_reserved_name, CHECK_OK); 2573 is_generator, &is_strict_reserved_name, CHECK_OK);
2556 function_name_location = scanner()->location(); 2574 function_name_location = scanner()->location();
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
3338 return; 3356 return;
3339 } 3357 }
3340 has_seen_constructor_ = true; 3358 has_seen_constructor_ = true;
3341 return; 3359 return;
3342 } 3360 }
3343 } 3361 }
3344 } // namespace internal 3362 } // namespace internal
3345 } // namespace v8 3363 } // namespace v8
3346 3364
3347 #endif // V8_PARSING_PARSER_BASE_H 3365 #endif // V8_PARSING_PARSER_BASE_H
OLDNEW
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698