Chromium Code Reviews| 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_PREPARSER_H | 5 #ifndef V8_PARSING_PREPARSER_H |
| 6 #define V8_PARSING_PREPARSER_H | 6 #define V8_PARSING_PREPARSER_H |
| 7 | 7 |
| 8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
| 9 #include "src/parsing/parser-base.h" | 9 #include "src/parsing/parser-base.h" |
| 10 | 10 |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 904 // All ParseXXX functions take as the last argument an *ok parameter | 904 // All ParseXXX functions take as the last argument an *ok parameter |
| 905 // which is set to false if parsing failed; it is unchanged otherwise. | 905 // which is set to false if parsing failed; it is unchanged otherwise. |
| 906 // By making the 'exception handling' explicit, we are forced to check | 906 // By making the 'exception handling' explicit, we are forced to check |
| 907 // for failure at the call sites. | 907 // for failure at the call sites. |
| 908 | 908 |
| 909 V8_INLINE PreParserStatementList ParseEagerFunctionBody( | 909 V8_INLINE PreParserStatementList ParseEagerFunctionBody( |
| 910 PreParserIdentifier function_name, int pos, | 910 PreParserIdentifier function_name, int pos, |
| 911 const PreParserFormalParameters& parameters, FunctionKind kind, | 911 const PreParserFormalParameters& parameters, FunctionKind kind, |
| 912 FunctionLiteral::FunctionType function_type, bool* ok); | 912 FunctionLiteral::FunctionType function_type, bool* ok); |
| 913 | 913 |
| 914 // Indicates that we won't switch from the preparser to the preparser; we'll | |
| 915 // just stay where we are. | |
| 914 bool AllowsLazyParsingWithoutUnresolvedVariables() const { return false; } | 916 bool AllowsLazyParsingWithoutUnresolvedVariables() const { return false; } |
| 915 | 917 |
| 918 // Indicates that we won't switch from the preparser to the preparser; we'll | |
|
vogelheim
2016/11/07 14:56:17
Since this just duplicates the comments (because b
| |
| 919 // just stay where we are. | |
| 920 Mode mode() { return PARSE_EAGERLY; } | |
| 921 | |
| 916 V8_INLINE LazyParsingResult SkipFunction( | 922 V8_INLINE LazyParsingResult SkipFunction( |
| 917 FunctionKind kind, DeclarationScope* function_scope, int* num_parameters, | 923 FunctionKind kind, DeclarationScope* function_scope, int* num_parameters, |
| 918 int* function_length, bool* has_duplicate_parameters, | 924 int* function_length, bool* has_duplicate_parameters, |
| 919 int* materialized_literal_count, int* expected_property_count, | 925 int* materialized_literal_count, int* expected_property_count, |
| 920 bool is_inner_function, bool may_abort, bool* ok) { | 926 bool is_inner_function, bool may_abort, bool* ok) { |
| 921 UNREACHABLE(); | 927 UNREACHABLE(); |
| 922 return kLazyParsingComplete; | 928 return kLazyParsingComplete; |
| 923 } | 929 } |
| 924 Expression ParseFunctionLiteral( | 930 Expression ParseFunctionLiteral( |
| 925 Identifier name, Scanner::Location function_name_location, | 931 Identifier name, Scanner::Location function_name_location, |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1516 PreParserExpression PreParser::SpreadCallNew(PreParserExpression function, | 1522 PreParserExpression PreParser::SpreadCallNew(PreParserExpression function, |
| 1517 PreParserExpressionList args, | 1523 PreParserExpressionList args, |
| 1518 int pos) { | 1524 int pos) { |
| 1519 return factory()->NewCallNew(function, args, pos); | 1525 return factory()->NewCallNew(function, args, pos); |
| 1520 } | 1526 } |
| 1521 | 1527 |
| 1522 PreParserStatementList PreParser::ParseEagerFunctionBody( | 1528 PreParserStatementList PreParser::ParseEagerFunctionBody( |
| 1523 PreParserIdentifier function_name, int pos, | 1529 PreParserIdentifier function_name, int pos, |
| 1524 const PreParserFormalParameters& parameters, FunctionKind kind, | 1530 const PreParserFormalParameters& parameters, FunctionKind kind, |
| 1525 FunctionLiteral::FunctionType function_type, bool* ok) { | 1531 FunctionLiteral::FunctionType function_type, bool* ok) { |
| 1526 ParsingModeScope parsing_mode(this, PARSE_EAGERLY); | |
| 1527 PreParserStatementList result; | 1532 PreParserStatementList result; |
| 1528 | 1533 |
| 1529 Scope* inner_scope = scope(); | 1534 Scope* inner_scope = scope(); |
| 1530 if (!parameters.is_simple) inner_scope = NewScope(BLOCK_SCOPE); | 1535 if (!parameters.is_simple) inner_scope = NewScope(BLOCK_SCOPE); |
| 1531 | 1536 |
| 1532 { | 1537 { |
| 1533 BlockState block_state(&scope_state_, inner_scope); | 1538 BlockState block_state(&scope_state_, inner_scope); |
| 1534 ParseStatementList(result, Token::RBRACE, ok); | 1539 ParseStatementList(result, Token::RBRACE, ok); |
| 1535 if (!*ok) return PreParserStatementList(); | 1540 if (!*ok) return PreParserStatementList(); |
| 1536 } | 1541 } |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1548 function_state_->NextMaterializedLiteralIndex(); | 1553 function_state_->NextMaterializedLiteralIndex(); |
| 1549 function_state_->NextMaterializedLiteralIndex(); | 1554 function_state_->NextMaterializedLiteralIndex(); |
| 1550 } | 1555 } |
| 1551 return EmptyExpression(); | 1556 return EmptyExpression(); |
| 1552 } | 1557 } |
| 1553 | 1558 |
| 1554 } // namespace internal | 1559 } // namespace internal |
| 1555 } // namespace v8 | 1560 } // namespace v8 |
| 1556 | 1561 |
| 1557 #endif // V8_PARSING_PREPARSER_H | 1562 #endif // V8_PARSING_PREPARSER_H |
| OLD | NEW |