| 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 1599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1610 ExpressionClassifier* classifier, bool is_rest) {} | 1610 ExpressionClassifier* classifier, bool is_rest) {} |
| 1611 | 1611 |
| 1612 void CheckConflictingVarDeclarations(Scope* scope, bool* ok) {} | 1612 void CheckConflictingVarDeclarations(Scope* scope, bool* ok) {} |
| 1613 | 1613 |
| 1614 // Temporary glue; these functions will move to ParserBase. | 1614 // Temporary glue; these functions will move to ParserBase. |
| 1615 PreParserExpression ParseV8Intrinsic(bool* ok); | 1615 PreParserExpression ParseV8Intrinsic(bool* ok); |
| 1616 PreParserExpression ParseFunctionLiteral( | 1616 PreParserExpression ParseFunctionLiteral( |
| 1617 PreParserIdentifier name, Scanner::Location function_name_location, | 1617 PreParserIdentifier name, Scanner::Location function_name_location, |
| 1618 bool name_is_strict_reserved, FunctionKind kind, | 1618 bool name_is_strict_reserved, FunctionKind kind, |
| 1619 int function_token_position, FunctionLiteral::FunctionType type, | 1619 int function_token_position, FunctionLiteral::FunctionType type, |
| 1620 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); | 1620 FunctionLiteral::ArityRestriction arity_restriction, |
| 1621 LanguageMode language_mode, bool* ok); |
| 1621 | 1622 |
| 1622 PreParserExpression ParseClassLiteral(PreParserIdentifier name, | 1623 PreParserExpression ParseClassLiteral(PreParserIdentifier name, |
| 1623 Scanner::Location class_name_location, | 1624 Scanner::Location class_name_location, |
| 1624 bool name_is_strict_reserved, int pos, | 1625 bool name_is_strict_reserved, int pos, |
| 1625 bool* ok); | 1626 bool* ok); |
| 1626 | 1627 |
| 1627 PreParserExpressionList PrepareSpreadArguments(PreParserExpressionList list) { | 1628 PreParserExpressionList PrepareSpreadArguments(PreParserExpressionList list) { |
| 1628 return list; | 1629 return list; |
| 1629 } | 1630 } |
| 1630 | 1631 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1758 V8_INLINE PreParserStatementList | 1759 V8_INLINE PreParserStatementList |
| 1759 ParseEagerFunctionBody(PreParserIdentifier function_name, int pos, | 1760 ParseEagerFunctionBody(PreParserIdentifier function_name, int pos, |
| 1760 const FormalParameterParsingStateT& formal_parameters, | 1761 const FormalParameterParsingStateT& formal_parameters, |
| 1761 Variable* fvar, Token::Value fvar_init_op, | 1762 Variable* fvar, Token::Value fvar_init_op, |
| 1762 FunctionKind kind, bool* ok); | 1763 FunctionKind kind, bool* ok); |
| 1763 | 1764 |
| 1764 Expression ParseFunctionLiteral( | 1765 Expression ParseFunctionLiteral( |
| 1765 Identifier name, Scanner::Location function_name_location, | 1766 Identifier name, Scanner::Location function_name_location, |
| 1766 bool name_is_strict_reserved, FunctionKind kind, int function_token_pos, | 1767 bool name_is_strict_reserved, FunctionKind kind, int function_token_pos, |
| 1767 FunctionLiteral::FunctionType function_type, | 1768 FunctionLiteral::FunctionType function_type, |
| 1768 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); | 1769 FunctionLiteral::ArityRestriction arity_restriction, |
| 1770 LanguageMode language_mode, bool* ok); |
| 1769 void ParseLazyFunctionLiteralBody(bool* ok, | 1771 void ParseLazyFunctionLiteralBody(bool* ok, |
| 1770 Scanner::BookmarkScope* bookmark = nullptr); | 1772 Scanner::BookmarkScope* bookmark = nullptr); |
| 1771 | 1773 |
| 1772 PreParserExpression ParseClassLiteral(PreParserIdentifier name, | 1774 PreParserExpression ParseClassLiteral(PreParserIdentifier name, |
| 1773 Scanner::Location class_name_location, | 1775 Scanner::Location class_name_location, |
| 1774 bool name_is_strict_reserved, int pos, | 1776 bool name_is_strict_reserved, int pos, |
| 1775 bool* ok); | 1777 bool* ok); |
| 1776 }; | 1778 }; |
| 1777 | 1779 |
| 1778 | 1780 |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2534 kind = has_extends ? FunctionKind::kSubclassConstructor | 2536 kind = has_extends ? FunctionKind::kSubclassConstructor |
| 2535 : FunctionKind::kBaseConstructor; | 2537 : FunctionKind::kBaseConstructor; |
| 2536 } | 2538 } |
| 2537 | 2539 |
| 2538 if (!in_class) kind = WithObjectLiteralBit(kind); | 2540 if (!in_class) kind = WithObjectLiteralBit(kind); |
| 2539 | 2541 |
| 2540 value = this->ParseFunctionLiteral( | 2542 value = this->ParseFunctionLiteral( |
| 2541 name, scanner()->location(), | 2543 name, scanner()->location(), |
| 2542 false, // reserved words are allowed here | 2544 false, // reserved words are allowed here |
| 2543 kind, RelocInfo::kNoPosition, FunctionLiteral::ANONYMOUS_EXPRESSION, | 2545 kind, RelocInfo::kNoPosition, FunctionLiteral::ANONYMOUS_EXPRESSION, |
| 2544 FunctionLiteral::NORMAL_ARITY, | 2546 FunctionLiteral::NORMAL_ARITY, language_mode(), |
| 2545 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); | 2547 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| 2546 | 2548 |
| 2547 return factory()->NewObjectLiteralProperty(name_expression, value, | 2549 return factory()->NewObjectLiteralProperty(name_expression, value, |
| 2548 ObjectLiteralProperty::COMPUTED, | 2550 ObjectLiteralProperty::COMPUTED, |
| 2549 is_static, *is_computed_name); | 2551 is_static, *is_computed_name); |
| 2550 | 2552 |
| 2551 } else if (in_class && name_is_static && !is_static) { | 2553 } else if (in_class && name_is_static && !is_static) { |
| 2552 // static MethodDefinition | 2554 // static MethodDefinition |
| 2553 return ParsePropertyDefinition(checker, true, has_extends, true, | 2555 return ParsePropertyDefinition(checker, true, has_extends, true, |
| 2554 is_computed_name, nullptr, classifier, ok); | 2556 is_computed_name, nullptr, classifier, ok); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2568 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); | 2570 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| 2569 } | 2571 } |
| 2570 | 2572 |
| 2571 FunctionKind kind = FunctionKind::kAccessorFunction; | 2573 FunctionKind kind = FunctionKind::kAccessorFunction; |
| 2572 if (!in_class) kind = WithObjectLiteralBit(kind); | 2574 if (!in_class) kind = WithObjectLiteralBit(kind); |
| 2573 typename Traits::Type::FunctionLiteral value = this->ParseFunctionLiteral( | 2575 typename Traits::Type::FunctionLiteral value = this->ParseFunctionLiteral( |
| 2574 name, scanner()->location(), | 2576 name, scanner()->location(), |
| 2575 false, // reserved words are allowed here | 2577 false, // reserved words are allowed here |
| 2576 kind, RelocInfo::kNoPosition, FunctionLiteral::ANONYMOUS_EXPRESSION, | 2578 kind, RelocInfo::kNoPosition, FunctionLiteral::ANONYMOUS_EXPRESSION, |
| 2577 is_get ? FunctionLiteral::GETTER_ARITY : FunctionLiteral::SETTER_ARITY, | 2579 is_get ? FunctionLiteral::GETTER_ARITY : FunctionLiteral::SETTER_ARITY, |
| 2578 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); | 2580 language_mode(), CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| 2579 | 2581 |
| 2580 // Make sure the name expression is a string since we need a Name for | 2582 // Make sure the name expression is a string since we need a Name for |
| 2581 // Runtime_DefineAccessorPropertyUnchecked and since we can determine this | 2583 // Runtime_DefineAccessorPropertyUnchecked and since we can determine this |
| 2582 // statically we can skip the extra runtime check. | 2584 // statically we can skip the extra runtime check. |
| 2583 if (!*is_computed_name) { | 2585 if (!*is_computed_name) { |
| 2584 name_expression = | 2586 name_expression = |
| 2585 factory()->NewStringLiteral(name, name_expression->position()); | 2587 factory()->NewStringLiteral(name, name_expression->position()); |
| 2586 } | 2588 } |
| 2587 | 2589 |
| 2588 return factory()->NewObjectLiteralProperty( | 2590 return factory()->NewObjectLiteralProperty( |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3285 name = ParseIdentifierOrStrictReservedWord(&is_strict_reserved_name, | 3287 name = ParseIdentifierOrStrictReservedWord(&is_strict_reserved_name, |
| 3286 CHECK_OK); | 3288 CHECK_OK); |
| 3287 function_name_location = scanner()->location(); | 3289 function_name_location = scanner()->location(); |
| 3288 function_type = FunctionLiteral::NAMED_EXPRESSION; | 3290 function_type = FunctionLiteral::NAMED_EXPRESSION; |
| 3289 } | 3291 } |
| 3290 result = this->ParseFunctionLiteral( | 3292 result = this->ParseFunctionLiteral( |
| 3291 name, function_name_location, is_strict_reserved_name, | 3293 name, function_name_location, is_strict_reserved_name, |
| 3292 is_generator ? FunctionKind::kGeneratorFunction | 3294 is_generator ? FunctionKind::kGeneratorFunction |
| 3293 : FunctionKind::kNormalFunction, | 3295 : FunctionKind::kNormalFunction, |
| 3294 function_token_position, function_type, FunctionLiteral::NORMAL_ARITY, | 3296 function_token_position, function_type, FunctionLiteral::NORMAL_ARITY, |
| 3295 CHECK_OK); | 3297 language_mode(), CHECK_OK); |
| 3296 } else if (peek() == Token::SUPER) { | 3298 } else if (peek() == Token::SUPER) { |
| 3297 const bool is_new = false; | 3299 const bool is_new = false; |
| 3298 result = ParseSuperExpression(is_new, classifier, CHECK_OK); | 3300 result = ParseSuperExpression(is_new, classifier, CHECK_OK); |
| 3299 } else { | 3301 } else { |
| 3300 result = ParsePrimaryExpression(classifier, CHECK_OK); | 3302 result = ParsePrimaryExpression(classifier, CHECK_OK); |
| 3301 } | 3303 } |
| 3302 | 3304 |
| 3303 result = ParseMemberExpressionContinuation(result, classifier, CHECK_OK); | 3305 result = ParseMemberExpressionContinuation(result, classifier, CHECK_OK); |
| 3304 return result; | 3306 return result; |
| 3305 } | 3307 } |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3968 *ok = false; | 3970 *ok = false; |
| 3969 return; | 3971 return; |
| 3970 } | 3972 } |
| 3971 has_seen_constructor_ = true; | 3973 has_seen_constructor_ = true; |
| 3972 return; | 3974 return; |
| 3973 } | 3975 } |
| 3974 } | 3976 } |
| 3975 } } // v8::internal | 3977 } } // v8::internal |
| 3976 | 3978 |
| 3977 #endif // V8_PREPARSER_H | 3979 #endif // V8_PREPARSER_H |
| OLD | NEW |