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_PREPARSER_H | 5 #ifndef V8_PREPARSER_H |
6 #define V8_PREPARSER_H | 6 #define V8_PREPARSER_H |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 private: | 193 private: |
194 typename Traits::Type::Scope** scope_stack_; | 194 typename Traits::Type::Scope** scope_stack_; |
195 typename Traits::Type::Scope* outer_scope_; | 195 typename Traits::Type::Scope* outer_scope_; |
196 typename Traits::Type::Scope* scope_; | 196 typename Traits::Type::Scope* scope_; |
197 }; | 197 }; |
198 | 198 |
199 class FunctionState BASE_EMBEDDED { | 199 class FunctionState BASE_EMBEDDED { |
200 public: | 200 public: |
201 FunctionState(FunctionState** function_state_stack, | 201 FunctionState(FunctionState** function_state_stack, |
202 typename Traits::Type::Scope** scope_stack, | 202 typename Traits::Type::Scope** scope_stack, |
203 typename Traits::Type::Scope* scope, | 203 typename Traits::Type::Scope* scope, FunctionKind kind, |
204 typename Traits::Type::Factory* factory); | 204 typename Traits::Type::Factory* factory); |
205 ~FunctionState(); | 205 ~FunctionState(); |
206 | 206 |
207 int NextMaterializedLiteralIndex() { | 207 int NextMaterializedLiteralIndex() { |
208 return next_materialized_literal_index_++; | 208 return next_materialized_literal_index_++; |
209 } | 209 } |
210 int materialized_literal_count() { | 210 int materialized_literal_count() { |
211 return next_materialized_literal_index_ - JSFunction::kLiteralsPrefixSize; | 211 return next_materialized_literal_index_ - JSFunction::kLiteralsPrefixSize; |
212 } | 212 } |
213 | 213 |
214 int NextHandlerIndex() { return next_handler_index_++; } | 214 int NextHandlerIndex() { return next_handler_index_++; } |
215 int handler_count() { return next_handler_index_; } | 215 int handler_count() { return next_handler_index_; } |
216 | 216 |
217 void AddProperty() { expected_property_count_++; } | 217 void AddProperty() { expected_property_count_++; } |
218 int expected_property_count() { return expected_property_count_; } | 218 int expected_property_count() { return expected_property_count_; } |
219 | 219 |
220 void set_is_generator(bool is_generator) { is_generator_ = is_generator; } | 220 bool is_generator() const { return IsGeneratorFunction(kind_); } |
221 bool is_generator() const { return is_generator_; } | 221 |
| 222 FunctionKind kind() const { return kind_; } |
222 | 223 |
223 void set_generator_object_variable( | 224 void set_generator_object_variable( |
224 typename Traits::Type::GeneratorVariable* variable) { | 225 typename Traits::Type::GeneratorVariable* variable) { |
225 DCHECK(variable != NULL); | 226 DCHECK(variable != NULL); |
226 DCHECK(!is_generator()); | 227 DCHECK(is_generator()); |
227 generator_object_variable_ = variable; | 228 generator_object_variable_ = variable; |
228 is_generator_ = true; | |
229 } | 229 } |
230 typename Traits::Type::GeneratorVariable* generator_object_variable() | 230 typename Traits::Type::GeneratorVariable* generator_object_variable() |
231 const { | 231 const { |
232 return generator_object_variable_; | 232 return generator_object_variable_; |
233 } | 233 } |
234 | 234 |
235 typename Traits::Type::Factory* factory() { return factory_; } | 235 typename Traits::Type::Factory* factory() { return factory_; } |
236 | 236 |
237 private: | 237 private: |
238 // Used to assign an index to each literal that needs materialization in | 238 // Used to assign an index to each literal that needs materialization in |
239 // the function. Includes regexp literals, and boilerplate for object and | 239 // the function. Includes regexp literals, and boilerplate for object and |
240 // array literals. | 240 // array literals. |
241 int next_materialized_literal_index_; | 241 int next_materialized_literal_index_; |
242 | 242 |
243 // Used to assign a per-function index to try and catch handlers. | 243 // Used to assign a per-function index to try and catch handlers. |
244 int next_handler_index_; | 244 int next_handler_index_; |
245 | 245 |
246 // Properties count estimation. | 246 // Properties count estimation. |
247 int expected_property_count_; | 247 int expected_property_count_; |
248 | 248 |
249 // Whether the function is a generator. | 249 FunctionKind kind_; |
250 bool is_generator_; | |
251 // For generators, this variable may hold the generator object. It variable | 250 // For generators, this variable may hold the generator object. It variable |
252 // is used by yield expressions and return statements. It is not necessary | 251 // is used by yield expressions and return statements. It is not necessary |
253 // for generator functions to have this variable set. | 252 // for generator functions to have this variable set. |
254 Variable* generator_object_variable_; | 253 Variable* generator_object_variable_; |
255 | 254 |
| 255 |
256 FunctionState** function_state_stack_; | 256 FunctionState** function_state_stack_; |
257 FunctionState* outer_function_state_; | 257 FunctionState* outer_function_state_; |
258 typename Traits::Type::Scope** scope_stack_; | 258 typename Traits::Type::Scope** scope_stack_; |
259 typename Traits::Type::Scope* outer_scope_; | 259 typename Traits::Type::Scope* outer_scope_; |
260 typename Traits::Type::Zone* extra_param_; | 260 typename Traits::Type::Zone* extra_param_; |
261 typename Traits::Type::Factory* factory_; | 261 typename Traits::Type::Factory* factory_; |
262 | 262 |
263 friend class ParserTraits; | 263 friend class ParserTraits; |
264 friend class Checkpoint; | 264 friend class Checkpoint; |
265 }; | 265 }; |
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1444 return PreParserExpressionList(); | 1444 return PreParserExpressionList(); |
1445 } | 1445 } |
1446 | 1446 |
1447 V8_INLINE void SkipLazyFunctionBody(PreParserIdentifier function_name, | 1447 V8_INLINE void SkipLazyFunctionBody(PreParserIdentifier function_name, |
1448 int* materialized_literal_count, | 1448 int* materialized_literal_count, |
1449 int* expected_property_count, bool* ok) { | 1449 int* expected_property_count, bool* ok) { |
1450 UNREACHABLE(); | 1450 UNREACHABLE(); |
1451 } | 1451 } |
1452 | 1452 |
1453 V8_INLINE PreParserStatementList | 1453 V8_INLINE PreParserStatementList |
1454 ParseEagerFunctionBody(PreParserIdentifier function_name, int pos, | 1454 ParseEagerFunctionBody(PreParserIdentifier function_name, int pos, |
1455 Variable* fvar, Token::Value fvar_init_op, | 1455 Variable* fvar, Token::Value fvar_init_op, |
1456 bool is_generator, bool* ok); | 1456 FunctionKind kind, bool* ok); |
1457 | 1457 |
1458 // Utility functions | 1458 // Utility functions |
1459 int DeclareArrowParametersFromExpression(PreParserExpression expression, | 1459 int DeclareArrowParametersFromExpression(PreParserExpression expression, |
1460 PreParserScope* scope, | 1460 PreParserScope* scope, |
1461 Scanner::Location* dupe_loc, | 1461 Scanner::Location* dupe_loc, |
1462 bool* ok) { | 1462 bool* ok) { |
1463 // TODO(aperez): Detect duplicated identifiers in paramlists. | 1463 // TODO(aperez): Detect duplicated identifiers in paramlists. |
1464 *ok = expression.IsValidArrowParamList(); | 1464 *ok = expression.IsValidArrowParamList(); |
1465 return 0; | 1465 return 0; |
1466 } | 1466 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 : ParserBase<PreParserTraits>(isolate, NULL, scanner, stack_limit, NULL, | 1538 : ParserBase<PreParserTraits>(isolate, NULL, scanner, stack_limit, NULL, |
1539 log, this) {} | 1539 log, this) {} |
1540 | 1540 |
1541 // Pre-parse the program from the character stream; returns true on | 1541 // Pre-parse the program from the character stream; returns true on |
1542 // success (even if parsing failed, the pre-parse data successfully | 1542 // success (even if parsing failed, the pre-parse data successfully |
1543 // captured the syntax error), and false if a stack-overflow happened | 1543 // captured the syntax error), and false if a stack-overflow happened |
1544 // during parsing. | 1544 // during parsing. |
1545 PreParseResult PreParseProgram(int* materialized_literals = 0) { | 1545 PreParseResult PreParseProgram(int* materialized_literals = 0) { |
1546 PreParserScope scope(scope_, SCRIPT_SCOPE); | 1546 PreParserScope scope(scope_, SCRIPT_SCOPE); |
1547 PreParserFactory factory(NULL); | 1547 PreParserFactory factory(NULL); |
1548 FunctionState top_scope(&function_state_, &scope_, &scope, &factory); | 1548 FunctionState top_scope(&function_state_, &scope_, &scope, kNormalFunction, |
| 1549 &factory); |
1549 bool ok = true; | 1550 bool ok = true; |
1550 int start_position = scanner()->peek_location().beg_pos; | 1551 int start_position = scanner()->peek_location().beg_pos; |
1551 ParseSourceElements(Token::EOS, &ok); | 1552 ParseSourceElements(Token::EOS, &ok); |
1552 if (stack_overflow()) return kPreParseStackOverflow; | 1553 if (stack_overflow()) return kPreParseStackOverflow; |
1553 if (!ok) { | 1554 if (!ok) { |
1554 ReportUnexpectedToken(scanner()->current_token()); | 1555 ReportUnexpectedToken(scanner()->current_token()); |
1555 } else if (is_strict(scope_->language_mode())) { | 1556 } else if (is_strict(scope_->language_mode())) { |
1556 CheckStrictOctalLiteral(start_position, scanner()->location().end_pos, | 1557 CheckStrictOctalLiteral(start_position, scanner()->location().end_pos, |
1557 &ok); | 1558 &ok); |
1558 } | 1559 } |
1559 if (materialized_literals) { | 1560 if (materialized_literals) { |
1560 *materialized_literals = function_state_->materialized_literal_count(); | 1561 *materialized_literals = function_state_->materialized_literal_count(); |
1561 } | 1562 } |
1562 return kPreParseSuccess; | 1563 return kPreParseSuccess; |
1563 } | 1564 } |
1564 | 1565 |
1565 // Parses a single function literal, from the opening parentheses before | 1566 // Parses a single function literal, from the opening parentheses before |
1566 // parameters to the closing brace after the body. | 1567 // parameters to the closing brace after the body. |
1567 // Returns a FunctionEntry describing the body of the function in enough | 1568 // Returns a FunctionEntry describing the body of the function in enough |
1568 // detail that it can be lazily compiled. | 1569 // detail that it can be lazily compiled. |
1569 // The scanner is expected to have matched the "function" or "function*" | 1570 // The scanner is expected to have matched the "function" or "function*" |
1570 // keyword and parameters, and have consumed the initial '{'. | 1571 // keyword and parameters, and have consumed the initial '{'. |
1571 // At return, unless an error occurred, the scanner is positioned before the | 1572 // At return, unless an error occurred, the scanner is positioned before the |
1572 // the final '}'. | 1573 // the final '}'. |
1573 PreParseResult PreParseLazyFunction(LanguageMode language_mode, | 1574 PreParseResult PreParseLazyFunction(LanguageMode language_mode, |
1574 bool is_generator, ParserRecorder* log); | 1575 FunctionKind kind, ParserRecorder* log); |
1575 | 1576 |
1576 private: | 1577 private: |
1577 friend class PreParserTraits; | 1578 friend class PreParserTraits; |
1578 | 1579 |
1579 // These types form an algebra over syntactic categories that is just | 1580 // These types form an algebra over syntactic categories that is just |
1580 // rich enough to let us recognize and propagate the constructs that | 1581 // rich enough to let us recognize and propagate the constructs that |
1581 // are either being counted in the preparser data, or is important | 1582 // are either being counted in the preparser data, or is important |
1582 // to throw the correct syntax error exceptions. | 1583 // to throw the correct syntax error exceptions. |
1583 | 1584 |
1584 enum VariableDeclarationContext { | 1585 enum VariableDeclarationContext { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1628 Statement ParseTryStatement(bool* ok); | 1629 Statement ParseTryStatement(bool* ok); |
1629 Statement ParseDebuggerStatement(bool* ok); | 1630 Statement ParseDebuggerStatement(bool* ok); |
1630 Expression ParseConditionalExpression(bool accept_IN, bool* ok); | 1631 Expression ParseConditionalExpression(bool accept_IN, bool* ok); |
1631 Expression ParseObjectLiteral(bool* ok); | 1632 Expression ParseObjectLiteral(bool* ok); |
1632 Expression ParseV8Intrinsic(bool* ok); | 1633 Expression ParseV8Intrinsic(bool* ok); |
1633 | 1634 |
1634 V8_INLINE void SkipLazyFunctionBody(PreParserIdentifier function_name, | 1635 V8_INLINE void SkipLazyFunctionBody(PreParserIdentifier function_name, |
1635 int* materialized_literal_count, | 1636 int* materialized_literal_count, |
1636 int* expected_property_count, bool* ok); | 1637 int* expected_property_count, bool* ok); |
1637 V8_INLINE PreParserStatementList | 1638 V8_INLINE PreParserStatementList |
1638 ParseEagerFunctionBody(PreParserIdentifier function_name, int pos, | 1639 ParseEagerFunctionBody(PreParserIdentifier function_name, int pos, |
1639 Variable* fvar, Token::Value fvar_init_op, | 1640 Variable* fvar, Token::Value fvar_init_op, |
1640 bool is_generator, bool* ok); | 1641 FunctionKind kind, bool* ok); |
1641 | 1642 |
1642 Expression ParseFunctionLiteral( | 1643 Expression ParseFunctionLiteral( |
1643 Identifier name, Scanner::Location function_name_location, | 1644 Identifier name, Scanner::Location function_name_location, |
1644 bool name_is_strict_reserved, FunctionKind kind, int function_token_pos, | 1645 bool name_is_strict_reserved, FunctionKind kind, int function_token_pos, |
1645 FunctionLiteral::FunctionType function_type, | 1646 FunctionLiteral::FunctionType function_type, |
1646 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); | 1647 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); |
1647 void ParseLazyFunctionLiteralBody(bool* ok); | 1648 void ParseLazyFunctionLiteralBody(bool* ok); |
1648 | 1649 |
1649 PreParserExpression ParseClassLiteral(PreParserIdentifier name, | 1650 PreParserExpression ParseClassLiteral(PreParserIdentifier name, |
1650 Scanner::Location class_name_location, | 1651 Scanner::Location class_name_location, |
1651 bool name_is_strict_reserved, int pos, | 1652 bool name_is_strict_reserved, int pos, |
1652 bool* ok); | 1653 bool* ok); |
1653 | 1654 |
1654 bool CheckInOrOf(bool accept_OF); | 1655 bool CheckInOrOf(bool accept_OF); |
1655 }; | 1656 }; |
1656 | 1657 |
1657 | 1658 |
1658 void PreParserTraits::MaterializeTemplateCallsiteLiterals() { | 1659 void PreParserTraits::MaterializeTemplateCallsiteLiterals() { |
1659 pre_parser_->function_state_->NextMaterializedLiteralIndex(); | 1660 pre_parser_->function_state_->NextMaterializedLiteralIndex(); |
1660 pre_parser_->function_state_->NextMaterializedLiteralIndex(); | 1661 pre_parser_->function_state_->NextMaterializedLiteralIndex(); |
1661 } | 1662 } |
1662 | 1663 |
1663 | 1664 |
1664 PreParserStatementList PreParser::ParseEagerFunctionBody( | 1665 PreParserStatementList PreParser::ParseEagerFunctionBody( |
1665 PreParserIdentifier function_name, int pos, Variable* fvar, | 1666 PreParserIdentifier function_name, int pos, Variable* fvar, |
1666 Token::Value fvar_init_op, bool is_generator, bool* ok) { | 1667 Token::Value fvar_init_op, FunctionKind kind, bool* ok) { |
1667 ParsingModeScope parsing_mode(this, PARSE_EAGERLY); | 1668 ParsingModeScope parsing_mode(this, PARSE_EAGERLY); |
1668 | 1669 |
1669 ParseSourceElements(Token::RBRACE, ok); | 1670 ParseSourceElements(Token::RBRACE, ok); |
1670 if (!*ok) return PreParserStatementList(); | 1671 if (!*ok) return PreParserStatementList(); |
1671 | 1672 |
1672 Expect(Token::RBRACE, ok); | 1673 Expect(Token::RBRACE, ok); |
1673 return PreParserStatementList(); | 1674 return PreParserStatementList(); |
1674 } | 1675 } |
1675 | 1676 |
1676 | 1677 |
1677 PreParserStatementList PreParserTraits::ParseEagerFunctionBody( | 1678 PreParserStatementList PreParserTraits::ParseEagerFunctionBody( |
1678 PreParserIdentifier function_name, int pos, Variable* fvar, | 1679 PreParserIdentifier function_name, int pos, Variable* fvar, |
1679 Token::Value fvar_init_op, bool is_generator, bool* ok) { | 1680 Token::Value fvar_init_op, FunctionKind kind, bool* ok) { |
1680 return pre_parser_->ParseEagerFunctionBody(function_name, pos, fvar, | 1681 return pre_parser_->ParseEagerFunctionBody(function_name, pos, fvar, |
1681 fvar_init_op, is_generator, ok); | 1682 fvar_init_op, kind, ok); |
1682 } | 1683 } |
1683 | 1684 |
1684 | 1685 |
1685 template <class Traits> | 1686 template <class Traits> |
1686 ParserBase<Traits>::FunctionState::FunctionState( | 1687 ParserBase<Traits>::FunctionState::FunctionState( |
1687 FunctionState** function_state_stack, | 1688 FunctionState** function_state_stack, |
1688 typename Traits::Type::Scope** scope_stack, | 1689 typename Traits::Type::Scope** scope_stack, |
1689 typename Traits::Type::Scope* scope, | 1690 typename Traits::Type::Scope* scope, FunctionKind kind, |
1690 typename Traits::Type::Factory* factory) | 1691 typename Traits::Type::Factory* factory) |
1691 : next_materialized_literal_index_(JSFunction::kLiteralsPrefixSize), | 1692 : next_materialized_literal_index_(JSFunction::kLiteralsPrefixSize), |
1692 next_handler_index_(0), | 1693 next_handler_index_(0), |
1693 expected_property_count_(0), | 1694 expected_property_count_(0), |
1694 is_generator_(false), | 1695 kind_(kind), |
1695 generator_object_variable_(NULL), | 1696 generator_object_variable_(NULL), |
1696 function_state_stack_(function_state_stack), | 1697 function_state_stack_(function_state_stack), |
1697 outer_function_state_(*function_state_stack), | 1698 outer_function_state_(*function_state_stack), |
1698 scope_stack_(scope_stack), | 1699 scope_stack_(scope_stack), |
1699 outer_scope_(*scope_stack), | 1700 outer_scope_(*scope_stack), |
1700 factory_(factory) { | 1701 factory_(factory) { |
1701 *scope_stack_ = scope; | 1702 *scope_stack_ = scope; |
1702 *function_state_stack = this; | 1703 *function_state_stack = this; |
1703 } | 1704 } |
1704 | 1705 |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2150 is_generator, | 2151 is_generator, |
2151 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); | 2152 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
2152 } | 2153 } |
2153 | 2154 |
2154 FunctionKind kind = is_generator ? FunctionKind::kConciseGeneratorMethod | 2155 FunctionKind kind = is_generator ? FunctionKind::kConciseGeneratorMethod |
2155 : FunctionKind::kConciseMethod; | 2156 : FunctionKind::kConciseMethod; |
2156 | 2157 |
2157 if (in_class && !is_static && this->IsConstructor(name)) { | 2158 if (in_class && !is_static && this->IsConstructor(name)) { |
2158 *has_seen_constructor = true; | 2159 *has_seen_constructor = true; |
2159 kind = has_extends ? FunctionKind::kSubclassConstructor | 2160 kind = has_extends ? FunctionKind::kSubclassConstructor |
2160 : FunctionKind::kNormalFunction; | 2161 : FunctionKind::kBaseConstructor; |
2161 } | 2162 } |
2162 | 2163 |
2163 value = this->ParseFunctionLiteral( | 2164 value = this->ParseFunctionLiteral( |
2164 name, scanner()->location(), | 2165 name, scanner()->location(), |
2165 false, // reserved words are allowed here | 2166 false, // reserved words are allowed here |
2166 kind, RelocInfo::kNoPosition, FunctionLiteral::ANONYMOUS_EXPRESSION, | 2167 kind, RelocInfo::kNoPosition, FunctionLiteral::ANONYMOUS_EXPRESSION, |
2167 FunctionLiteral::NORMAL_ARITY, | 2168 FunctionLiteral::NORMAL_ARITY, |
2168 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); | 2169 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
2169 | 2170 |
2170 return factory()->NewObjectLiteralProperty(name_expression, value, | 2171 return factory()->NewObjectLiteralProperty(name_expression, value, |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2831 typename Traits::Type::StatementList body; | 2832 typename Traits::Type::StatementList body; |
2832 int num_parameters = -1; | 2833 int num_parameters = -1; |
2833 int materialized_literal_count = -1; | 2834 int materialized_literal_count = -1; |
2834 int expected_property_count = -1; | 2835 int expected_property_count = -1; |
2835 int handler_count = 0; | 2836 int handler_count = 0; |
2836 | 2837 |
2837 { | 2838 { |
2838 typename Traits::Type::Factory function_factory(this->ast_value_factory()); | 2839 typename Traits::Type::Factory function_factory(this->ast_value_factory()); |
2839 FunctionState function_state(&function_state_, &scope_, | 2840 FunctionState function_state(&function_state_, &scope_, |
2840 Traits::Type::ptr_to_scope(scope), | 2841 Traits::Type::ptr_to_scope(scope), |
2841 &function_factory); | 2842 kArrowFunction, &function_factory); |
2842 Scanner::Location dupe_error_loc = Scanner::Location::invalid(); | 2843 Scanner::Location dupe_error_loc = Scanner::Location::invalid(); |
2843 num_parameters = Traits::DeclareArrowParametersFromExpression( | 2844 num_parameters = Traits::DeclareArrowParametersFromExpression( |
2844 params_ast, scope_, &dupe_error_loc, ok); | 2845 params_ast, scope_, &dupe_error_loc, ok); |
2845 if (!*ok) { | 2846 if (!*ok) { |
2846 ReportMessageAt( | 2847 ReportMessageAt( |
2847 Scanner::Location(start_pos, scanner()->location().beg_pos), | 2848 Scanner::Location(start_pos, scanner()->location().beg_pos), |
2848 "malformed_arrow_function_parameter_list"); | 2849 "malformed_arrow_function_parameter_list"); |
2849 return this->EmptyExpression(); | 2850 return this->EmptyExpression(); |
2850 } | 2851 } |
2851 | 2852 |
(...skipping 12 matching lines...) Expand all Loading... |
2864 bool is_lazily_parsed = | 2865 bool is_lazily_parsed = |
2865 (mode() == PARSE_LAZILY && scope_->AllowsLazyCompilation()); | 2866 (mode() == PARSE_LAZILY && scope_->AllowsLazyCompilation()); |
2866 if (is_lazily_parsed) { | 2867 if (is_lazily_parsed) { |
2867 body = this->NewStatementList(0, zone()); | 2868 body = this->NewStatementList(0, zone()); |
2868 this->SkipLazyFunctionBody(this->EmptyIdentifier(), | 2869 this->SkipLazyFunctionBody(this->EmptyIdentifier(), |
2869 &materialized_literal_count, | 2870 &materialized_literal_count, |
2870 &expected_property_count, CHECK_OK); | 2871 &expected_property_count, CHECK_OK); |
2871 } else { | 2872 } else { |
2872 body = this->ParseEagerFunctionBody( | 2873 body = this->ParseEagerFunctionBody( |
2873 this->EmptyIdentifier(), RelocInfo::kNoPosition, NULL, | 2874 this->EmptyIdentifier(), RelocInfo::kNoPosition, NULL, |
2874 Token::INIT_VAR, false, // Not a generator. | 2875 Token::INIT_VAR, kArrowFunction, CHECK_OK); |
2875 CHECK_OK); | |
2876 materialized_literal_count = | 2876 materialized_literal_count = |
2877 function_state.materialized_literal_count(); | 2877 function_state.materialized_literal_count(); |
2878 expected_property_count = function_state.expected_property_count(); | 2878 expected_property_count = function_state.expected_property_count(); |
2879 handler_count = function_state.handler_count(); | 2879 handler_count = function_state.handler_count(); |
2880 } | 2880 } |
2881 } else { | 2881 } else { |
2882 // Single-expression body | 2882 // Single-expression body |
2883 int pos = position(); | 2883 int pos = position(); |
2884 parenthesized_function_ = false; | 2884 parenthesized_function_ = false; |
2885 ExpressionT expression = ParseAssignmentExpression(true, CHECK_OK); | 2885 ExpressionT expression = ParseAssignmentExpression(true, CHECK_OK); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3097 *ok = false; | 3097 *ok = false; |
3098 return; | 3098 return; |
3099 } | 3099 } |
3100 has_seen_constructor_ = true; | 3100 has_seen_constructor_ = true; |
3101 return; | 3101 return; |
3102 } | 3102 } |
3103 } | 3103 } |
3104 } } // v8::internal | 3104 } } // v8::internal |
3105 | 3105 |
3106 #endif // V8_PREPARSER_H | 3106 #endif // V8_PREPARSER_H |
OLD | NEW |