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/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 1829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1840 if (Check(Token::RPAREN)) { | 1840 if (Check(Token::RPAREN)) { |
1841 // ()=>x. The continuation that looks for the => is in | 1841 // ()=>x. The continuation that looks for the => is in |
1842 // ParseAssignmentExpression. | 1842 // ParseAssignmentExpression. |
1843 classifier()->RecordExpressionError(scanner()->location(), | 1843 classifier()->RecordExpressionError(scanner()->location(), |
1844 MessageTemplate::kUnexpectedToken, | 1844 MessageTemplate::kUnexpectedToken, |
1845 Token::String(Token::RPAREN)); | 1845 Token::String(Token::RPAREN)); |
1846 return factory()->NewEmptyParentheses(beg_pos); | 1846 return factory()->NewEmptyParentheses(beg_pos); |
1847 } | 1847 } |
1848 // Heuristically try to detect immediately called functions before | 1848 // Heuristically try to detect immediately called functions before |
1849 // seeing the call parentheses. | 1849 // seeing the call parentheses. |
1850 if (peek() == Token::FUNCTION) { | 1850 if (peek() == Token::FUNCTION || |
| 1851 (peek() == Token::ASYNC && PeekAhead() == Token::FUNCTION)) { |
1851 function_state_->set_next_function_is_likely_called(); | 1852 function_state_->set_next_function_is_likely_called(); |
1852 } | 1853 } |
1853 ExpressionT expr = ParseExpressionCoverGrammar(true, CHECK_OK); | 1854 ExpressionT expr = ParseExpressionCoverGrammar(true, CHECK_OK); |
1854 Expect(Token::RPAREN, CHECK_OK); | 1855 Expect(Token::RPAREN, CHECK_OK); |
1855 return expr; | 1856 return expr; |
1856 } | 1857 } |
1857 | 1858 |
1858 case Token::CLASS: { | 1859 case Token::CLASS: { |
1859 BindingPatternUnexpectedToken(); | 1860 BindingPatternUnexpectedToken(); |
1860 Consume(Token::CLASS); | 1861 Consume(Token::CLASS); |
(...skipping 3913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5774 } | 5775 } |
5775 | 5776 |
5776 #undef CHECK_OK | 5777 #undef CHECK_OK |
5777 #undef CHECK_OK_CUSTOM | 5778 #undef CHECK_OK_CUSTOM |
5778 #undef CHECK_OK_VOID | 5779 #undef CHECK_OK_VOID |
5779 | 5780 |
5780 } // namespace internal | 5781 } // namespace internal |
5781 } // namespace v8 | 5782 } // namespace v8 |
5782 | 5783 |
5783 #endif // V8_PARSING_PARSER_BASE_H | 5784 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |