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 3873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3884 } | 3884 } |
3885 } | 3885 } |
3886 return false; | 3886 return false; |
3887 } | 3887 } |
3888 | 3888 |
3889 template <typename Impl> | 3889 template <typename Impl> |
3890 typename ParserBase<Impl>::ExpressionT | 3890 typename ParserBase<Impl>::ExpressionT |
3891 ParserBase<Impl>::ParseArrowFunctionLiteral( | 3891 ParserBase<Impl>::ParseArrowFunctionLiteral( |
3892 bool accept_IN, const FormalParametersT& formal_parameters, bool* ok) { | 3892 bool accept_IN, const FormalParametersT& formal_parameters, bool* ok) { |
3893 const RuntimeCallStats::CounterId counters[2][2] = { | 3893 const RuntimeCallStats::CounterId counters[2][2] = { |
3894 {&RuntimeCallStats::ParseArrowFunctionLiteral, | 3894 {&RuntimeCallStats::ParseBackgroundArrowFunctionLiteral, |
3895 &RuntimeCallStats::ParseBackgroundArrowFunctionLiteral}, | 3895 &RuntimeCallStats::ParseArrowFunctionLiteral}, |
3896 {&RuntimeCallStats::PreParseArrowFunctionLiteral, | 3896 {&RuntimeCallStats::PreParseBackgroundArrowFunctionLiteral, |
3897 &RuntimeCallStats::PreParseBackgroundArrowFunctionLiteral}}; | 3897 &RuntimeCallStats::PreParseArrowFunctionLiteral}}; |
3898 RuntimeCallTimerScope runtime_timer( | 3898 RuntimeCallTimerScope runtime_timer( |
3899 runtime_call_stats_, | 3899 runtime_call_stats_, |
3900 counters[Impl::IsPreParser()][parsing_on_main_thread_]); | 3900 counters[Impl::IsPreParser()][parsing_on_main_thread_]); |
3901 | 3901 |
3902 if (peek() == Token::ARROW && scanner_->HasAnyLineTerminatorBeforeNext()) { | 3902 if (peek() == Token::ARROW && scanner_->HasAnyLineTerminatorBeforeNext()) { |
3903 // ASI inserts `;` after arrow parameters if a line terminator is found. | 3903 // ASI inserts `;` after arrow parameters if a line terminator is found. |
3904 // `=> ...` is never a valid expression, so report as syntax error. | 3904 // `=> ...` is never a valid expression, so report as syntax error. |
3905 // If next token is not `=>`, it's a syntax error anyways. | 3905 // If next token is not `=>`, it's a syntax error anyways. |
3906 ReportUnexpectedTokenAt(scanner_->peek_location(), Token::ARROW); | 3906 ReportUnexpectedTokenAt(scanner_->peek_location(), Token::ARROW); |
3907 *ok = false; | 3907 *ok = false; |
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5458 has_seen_constructor_ = true; | 5458 has_seen_constructor_ = true; |
5459 return; | 5459 return; |
5460 } | 5460 } |
5461 } | 5461 } |
5462 | 5462 |
5463 | 5463 |
5464 } // namespace internal | 5464 } // namespace internal |
5465 } // namespace v8 | 5465 } // namespace v8 |
5466 | 5466 |
5467 #endif // V8_PARSING_PARSER_BASE_H | 5467 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |