OLD | NEW |
---|---|
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 2568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2579 // caller. | 2579 // caller. |
2580 | 2580 |
2581 // Parse the initial primary or function expression. | 2581 // Parse the initial primary or function expression. |
2582 ExpressionT result = this->EmptyExpression(); | 2582 ExpressionT result = this->EmptyExpression(); |
2583 if (peek() == Token::FUNCTION) { | 2583 if (peek() == Token::FUNCTION) { |
2584 BindingPatternUnexpectedToken(classifier); | 2584 BindingPatternUnexpectedToken(classifier); |
2585 ArrowFormalParametersUnexpectedToken(classifier); | 2585 ArrowFormalParametersUnexpectedToken(classifier); |
2586 | 2586 |
2587 Consume(Token::FUNCTION); | 2587 Consume(Token::FUNCTION); |
2588 int function_token_position = position(); | 2588 int function_token_position = position(); |
2589 | |
2590 if (FLAG_harmony_function_sent && Check(Token::PERIOD)) { | |
2591 // function.sent | |
2592 | |
2593 int pos = position(); | |
2594 ExpectContextualKeyword(CStrVector("sent"), CHECK_OK); | |
2595 | |
2596 if (!is_generator()) { | |
rossberg
2016/01/22 14:13:06
This may not be good enough. Like other magic cons
neis
2016/01/27 16:49:40
Done.
| |
2597 ReportMessageAt(scanner()->location(), | |
2598 MessageTemplate::kUnexpectedFunctionSent); | |
2599 *ok = false; | |
2600 return this->EmptyExpression(); | |
2601 } | |
2602 | |
2603 return this->FunctionSentExpression(scope_, factory(), pos); | |
2604 } | |
2605 | |
2589 bool is_generator = Check(Token::MUL); | 2606 bool is_generator = Check(Token::MUL); |
2590 IdentifierT name = this->EmptyIdentifier(); | 2607 IdentifierT name = this->EmptyIdentifier(); |
2591 bool is_strict_reserved_name = false; | 2608 bool is_strict_reserved_name = false; |
2592 Scanner::Location function_name_location = Scanner::Location::invalid(); | 2609 Scanner::Location function_name_location = Scanner::Location::invalid(); |
2593 FunctionLiteral::FunctionType function_type = | 2610 FunctionLiteral::FunctionType function_type = |
2594 FunctionLiteral::kAnonymousExpression; | 2611 FunctionLiteral::kAnonymousExpression; |
2595 if (peek_any_identifier()) { | 2612 if (peek_any_identifier()) { |
2596 name = ParseIdentifierOrStrictReservedWord( | 2613 name = ParseIdentifierOrStrictReservedWord( |
2597 is_generator, &is_strict_reserved_name, CHECK_OK); | 2614 is_generator, &is_strict_reserved_name, CHECK_OK); |
2598 function_name_location = scanner()->location(); | 2615 function_name_location = scanner()->location(); |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3374 return; | 3391 return; |
3375 } | 3392 } |
3376 has_seen_constructor_ = true; | 3393 has_seen_constructor_ = true; |
3377 return; | 3394 return; |
3378 } | 3395 } |
3379 } | 3396 } |
3380 } // namespace internal | 3397 } // namespace internal |
3381 } // namespace v8 | 3398 } // namespace v8 |
3382 | 3399 |
3383 #endif // V8_PARSING_PARSER_BASE_H | 3400 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |