OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 #include <cmath> | 5 #include <cmath> |
6 | 6 |
7 #include "src/allocation.h" | 7 #include "src/allocation.h" |
8 #include "src/base/logging.h" | 8 #include "src/base/logging.h" |
9 #include "src/conversions-inl.h" | 9 #include "src/conversions-inl.h" |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 int formals_end_position = scanner()->location().end_pos; | 1111 int formals_end_position = scanner()->location().end_pos; |
1112 | 1112 |
1113 CheckArityRestrictions(formals.arity, kind, formals.has_rest, start_position, | 1113 CheckArityRestrictions(formals.arity, kind, formals.has_rest, start_position, |
1114 formals_end_position, CHECK_OK); | 1114 formals_end_position, CHECK_OK); |
1115 | 1115 |
1116 // See Parser::ParseFunctionLiteral for more information about lazy parsing | 1116 // See Parser::ParseFunctionLiteral for more information about lazy parsing |
1117 // and lazy compilation. | 1117 // and lazy compilation. |
1118 bool is_lazily_parsed = (outer_is_script_scope && allow_lazy() && | 1118 bool is_lazily_parsed = (outer_is_script_scope && allow_lazy() && |
1119 !function_state_->this_function_is_parenthesized()); | 1119 !function_state_->this_function_is_parenthesized()); |
1120 | 1120 |
| 1121 function_state.set_parse_phase(FunctionParsePhase::FunctionBody); |
1121 Expect(Token::LBRACE, CHECK_OK); | 1122 Expect(Token::LBRACE, CHECK_OK); |
1122 function_state.set_parse_phase(FunctionParsePhase::FunctionBody); | 1123 function_state.set_parse_phase(FunctionParsePhase::FunctionBody); |
1123 if (is_lazily_parsed) { | 1124 if (is_lazily_parsed) { |
1124 ParseLazyFunctionLiteralBody(CHECK_OK); | 1125 ParseLazyFunctionLiteralBody(CHECK_OK); |
1125 } else { | 1126 } else { |
1126 ParseStatementList(Token::RBRACE, CHECK_OK); | 1127 ParseStatementList(Token::RBRACE, CHECK_OK); |
1127 } | 1128 } |
1128 Expect(Token::RBRACE, CHECK_OK); | 1129 Expect(Token::RBRACE, CHECK_OK); |
1129 | 1130 |
1130 // Parsing the body may change the language mode in our scope. | 1131 // Parsing the body may change the language mode in our scope. |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1285 // do '{' StatementList '}' | 1286 // do '{' StatementList '}' |
1286 Expect(Token::DO, CHECK_OK); | 1287 Expect(Token::DO, CHECK_OK); |
1287 Expect(Token::LBRACE, CHECK_OK); | 1288 Expect(Token::LBRACE, CHECK_OK); |
1288 while (peek() != Token::RBRACE) { | 1289 while (peek() != Token::RBRACE) { |
1289 ParseStatementListItem(CHECK_OK); | 1290 ParseStatementListItem(CHECK_OK); |
1290 } | 1291 } |
1291 Expect(Token::RBRACE, CHECK_OK); | 1292 Expect(Token::RBRACE, CHECK_OK); |
1292 return PreParserExpression::Default(); | 1293 return PreParserExpression::Default(); |
1293 } | 1294 } |
1294 | 1295 |
| 1296 void PreParserTraits::ParseAsyncArrowSingleExpressionBody( |
| 1297 PreParserStatementList body, bool accept_IN, |
| 1298 Type::ExpressionClassifier* classifier, int pos, bool* ok) { |
| 1299 Scope* scope = pre_parser_->scope_; |
| 1300 scope->ForceContextAllocation(); |
| 1301 |
| 1302 PreParserExpression return_value = |
| 1303 pre_parser_->ParseAssignmentExpression(accept_IN, classifier, ok); |
| 1304 if (!*ok) return; |
| 1305 |
| 1306 body->Add(PreParserStatement::ExpressionStatement(return_value), zone()); |
| 1307 } |
| 1308 |
1295 #undef CHECK_OK | 1309 #undef CHECK_OK |
1296 | 1310 |
1297 | 1311 |
1298 } // namespace internal | 1312 } // namespace internal |
1299 } // namespace v8 | 1313 } // namespace v8 |
OLD | NEW |