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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // typedef Factory; | 59 // typedef Factory; |
60 // }; | 60 // }; |
61 // // ... | 61 // // ... |
62 // }; | 62 // }; |
63 | 63 |
64 template <typename Traits> | 64 template <typename Traits> |
65 class ParserBase : public Traits { | 65 class ParserBase : public Traits { |
66 public: | 66 public: |
67 // Shorten type names defined by Traits. | 67 // Shorten type names defined by Traits. |
68 typedef typename Traits::Type::Expression ExpressionT; | 68 typedef typename Traits::Type::Expression ExpressionT; |
| 69 typedef typename Traits::Type::ExpressionList ExpressionListT; |
69 typedef typename Traits::Type::Identifier IdentifierT; | 70 typedef typename Traits::Type::Identifier IdentifierT; |
70 typedef typename Traits::Type::FormalParameter FormalParameterT; | 71 typedef typename Traits::Type::FormalParameter FormalParameterT; |
71 typedef typename Traits::Type::FormalParameterScope FormalParameterScopeT; | 72 typedef typename Traits::Type::FormalParameterScope FormalParameterScopeT; |
72 typedef typename Traits::Type::FunctionLiteral FunctionLiteralT; | 73 typedef typename Traits::Type::FunctionLiteral FunctionLiteralT; |
73 typedef typename Traits::Type::Literal LiteralT; | 74 typedef typename Traits::Type::Literal LiteralT; |
74 typedef typename Traits::Type::ObjectLiteralProperty ObjectLiteralPropertyT; | 75 typedef typename Traits::Type::ObjectLiteralProperty ObjectLiteralPropertyT; |
75 | 76 |
76 ParserBase(Zone* zone, Scanner* scanner, uintptr_t stack_limit, | 77 ParserBase(Zone* zone, Scanner* scanner, uintptr_t stack_limit, |
77 v8::Extension* extension, AstValueFactory* ast_value_factory, | 78 v8::Extension* extension, AstValueFactory* ast_value_factory, |
78 ParserRecorder* log, typename Traits::Type::Parser this_object) | 79 ParserRecorder* log, typename Traits::Type::Parser this_object) |
(...skipping 11 matching lines...) Expand all Loading... |
90 scanner_(scanner), | 91 scanner_(scanner), |
91 stack_overflow_(false), | 92 stack_overflow_(false), |
92 allow_lazy_(false), | 93 allow_lazy_(false), |
93 allow_natives_(false), | 94 allow_natives_(false), |
94 allow_harmony_arrow_functions_(false), | 95 allow_harmony_arrow_functions_(false), |
95 allow_harmony_object_literals_(false), | 96 allow_harmony_object_literals_(false), |
96 allow_harmony_sloppy_(false), | 97 allow_harmony_sloppy_(false), |
97 allow_harmony_computed_property_names_(false), | 98 allow_harmony_computed_property_names_(false), |
98 allow_harmony_rest_params_(false), | 99 allow_harmony_rest_params_(false), |
99 allow_harmony_spreadcalls_(false), | 100 allow_harmony_spreadcalls_(false), |
| 101 allow_harmony_default_parameters_(false), |
100 allow_strong_mode_(false) {} | 102 allow_strong_mode_(false) {} |
101 | 103 |
102 // Getters that indicate whether certain syntactical constructs are | 104 // Getters that indicate whether certain syntactical constructs are |
103 // allowed to be parsed by this instance of the parser. | 105 // allowed to be parsed by this instance of the parser. |
104 bool allow_lazy() const { return allow_lazy_; } | 106 bool allow_lazy() const { return allow_lazy_; } |
105 bool allow_natives() const { return allow_natives_; } | 107 bool allow_natives() const { return allow_natives_; } |
106 bool allow_harmony_arrow_functions() const { | 108 bool allow_harmony_arrow_functions() const { |
107 return allow_harmony_arrow_functions_; | 109 return allow_harmony_arrow_functions_; |
108 } | 110 } |
109 bool allow_harmony_modules() const { return scanner()->HarmonyModules(); } | 111 bool allow_harmony_modules() const { return scanner()->HarmonyModules(); } |
110 bool allow_harmony_classes() const { return scanner()->HarmonyClasses(); } | 112 bool allow_harmony_classes() const { return scanner()->HarmonyClasses(); } |
111 bool allow_harmony_object_literals() const { | 113 bool allow_harmony_object_literals() const { |
112 return allow_harmony_object_literals_; | 114 return allow_harmony_object_literals_; |
113 } | 115 } |
114 bool allow_harmony_sloppy() const { return allow_harmony_sloppy_; } | 116 bool allow_harmony_sloppy() const { return allow_harmony_sloppy_; } |
115 bool allow_harmony_unicode() const { return scanner()->HarmonyUnicode(); } | 117 bool allow_harmony_unicode() const { return scanner()->HarmonyUnicode(); } |
116 bool allow_harmony_computed_property_names() const { | 118 bool allow_harmony_computed_property_names() const { |
117 return allow_harmony_computed_property_names_; | 119 return allow_harmony_computed_property_names_; |
118 } | 120 } |
119 bool allow_harmony_rest_params() const { | 121 bool allow_harmony_rest_params() const { |
120 return allow_harmony_rest_params_; | 122 return allow_harmony_rest_params_; |
121 } | 123 } |
122 bool allow_harmony_spreadcalls() const { return allow_harmony_spreadcalls_; } | 124 bool allow_harmony_spreadcalls() const { return allow_harmony_spreadcalls_; } |
123 bool allow_harmony_destructuring() const { | 125 bool allow_harmony_destructuring() const { |
124 return allow_harmony_destructuring_; | 126 return allow_harmony_destructuring_; |
125 } | 127 } |
126 bool allow_harmony_spread_arrays() const { | 128 bool allow_harmony_spread_arrays() const { |
127 return allow_harmony_spread_arrays_; | 129 return allow_harmony_spread_arrays_; |
128 } | 130 } |
| 131 bool allow_harmony_default_parameters() const { |
| 132 return allow_harmony_default_parameters_; |
| 133 } |
129 | 134 |
130 bool allow_strong_mode() const { return allow_strong_mode_; } | 135 bool allow_strong_mode() const { return allow_strong_mode_; } |
131 | 136 |
132 // Setters that determine whether certain syntactical constructs are | 137 // Setters that determine whether certain syntactical constructs are |
133 // allowed to be parsed by this instance of the parser. | 138 // allowed to be parsed by this instance of the parser. |
134 void set_allow_lazy(bool allow) { allow_lazy_ = allow; } | 139 void set_allow_lazy(bool allow) { allow_lazy_ = allow; } |
135 void set_allow_natives(bool allow) { allow_natives_ = allow; } | 140 void set_allow_natives(bool allow) { allow_natives_ = allow; } |
136 void set_allow_harmony_arrow_functions(bool allow) { | 141 void set_allow_harmony_arrow_functions(bool allow) { |
137 allow_harmony_arrow_functions_ = allow; | 142 allow_harmony_arrow_functions_ = allow; |
138 } | 143 } |
(...skipping 21 matching lines...) Expand all Loading... |
160 void set_allow_harmony_spreadcalls(bool allow) { | 165 void set_allow_harmony_spreadcalls(bool allow) { |
161 allow_harmony_spreadcalls_ = allow; | 166 allow_harmony_spreadcalls_ = allow; |
162 } | 167 } |
163 void set_allow_strong_mode(bool allow) { allow_strong_mode_ = allow; } | 168 void set_allow_strong_mode(bool allow) { allow_strong_mode_ = allow; } |
164 void set_allow_harmony_destructuring(bool allow) { | 169 void set_allow_harmony_destructuring(bool allow) { |
165 allow_harmony_destructuring_ = allow; | 170 allow_harmony_destructuring_ = allow; |
166 } | 171 } |
167 void set_allow_harmony_spread_arrays(bool allow) { | 172 void set_allow_harmony_spread_arrays(bool allow) { |
168 allow_harmony_spread_arrays_ = allow; | 173 allow_harmony_spread_arrays_ = allow; |
169 } | 174 } |
| 175 void set_allow_harmony_default_parameters(bool allow) { |
| 176 allow_harmony_default_parameters_ = allow; |
| 177 } |
| 178 |
170 | 179 |
171 protected: | 180 protected: |
172 enum AllowRestrictedIdentifiers { | 181 enum AllowRestrictedIdentifiers { |
173 kAllowRestrictedIdentifiers, | 182 kAllowRestrictedIdentifiers, |
174 kDontAllowRestrictedIdentifiers | 183 kDontAllowRestrictedIdentifiers |
175 }; | 184 }; |
176 | 185 |
177 enum Mode { | 186 enum Mode { |
178 PARSE_LAZILY, | 187 PARSE_LAZILY, |
179 PARSE_EAGERLY | 188 PARSE_EAGERLY |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 void AddTemplateExpression(ExpressionT); | 921 void AddTemplateExpression(ExpressionT); |
913 ExpressionT ParseSuperExpression(bool is_new, | 922 ExpressionT ParseSuperExpression(bool is_new, |
914 ExpressionClassifier* classifier, bool* ok); | 923 ExpressionClassifier* classifier, bool* ok); |
915 ExpressionT ParseStrongInitializationExpression( | 924 ExpressionT ParseStrongInitializationExpression( |
916 ExpressionClassifier* classifier, bool* ok); | 925 ExpressionClassifier* classifier, bool* ok); |
917 ExpressionT ParseStrongSuperCallExpression(ExpressionClassifier* classifier, | 926 ExpressionT ParseStrongSuperCallExpression(ExpressionClassifier* classifier, |
918 bool* ok); | 927 bool* ok); |
919 | 928 |
920 void ParseFormalParameter(FormalParameterScopeT* scope, bool is_rest, | 929 void ParseFormalParameter(FormalParameterScopeT* scope, bool is_rest, |
921 ExpressionClassifier* classifier, bool* ok); | 930 ExpressionClassifier* classifier, bool* ok); |
922 int ParseFormalParameterList(FormalParameterScopeT* scope, bool* has_rest, | 931 int ParseFormalParameterList(FormalParameterScopeT* scope, |
| 932 ExpressionListT initializers, |
| 933 bool* has_parameter_expressions, bool* has_rest, |
923 ExpressionClassifier* classifier, bool* ok); | 934 ExpressionClassifier* classifier, bool* ok); |
924 void CheckArityRestrictions( | 935 void CheckArityRestrictions( |
925 int param_count, FunctionLiteral::ArityRestriction arity_restriction, | 936 int param_count, FunctionLiteral::ArityRestriction arity_restriction, |
926 bool has_rest, int formals_start_pos, int formals_end_pos, bool* ok); | 937 bool has_rest, int formals_start_pos, int formals_end_pos, bool* ok); |
927 | 938 |
928 // Checks if the expression is a valid reference expression (e.g., on the | 939 // Checks if the expression is a valid reference expression (e.g., on the |
929 // left-hand side of assignments). Although ruled out by ECMA as early errors, | 940 // left-hand side of assignments). Although ruled out by ECMA as early errors, |
930 // we allow calls for web compatibility and rewrite them to a runtime throw. | 941 // we allow calls for web compatibility and rewrite them to a runtime throw. |
931 ExpressionT CheckAndRewriteReferenceExpression( | 942 ExpressionT CheckAndRewriteReferenceExpression( |
932 ExpressionT expression, Scanner::Location location, | 943 ExpressionT expression, Scanner::Location location, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 bool allow_lazy_; | 1026 bool allow_lazy_; |
1016 bool allow_natives_; | 1027 bool allow_natives_; |
1017 bool allow_harmony_arrow_functions_; | 1028 bool allow_harmony_arrow_functions_; |
1018 bool allow_harmony_object_literals_; | 1029 bool allow_harmony_object_literals_; |
1019 bool allow_harmony_sloppy_; | 1030 bool allow_harmony_sloppy_; |
1020 bool allow_harmony_computed_property_names_; | 1031 bool allow_harmony_computed_property_names_; |
1021 bool allow_harmony_rest_params_; | 1032 bool allow_harmony_rest_params_; |
1022 bool allow_harmony_spreadcalls_; | 1033 bool allow_harmony_spreadcalls_; |
1023 bool allow_harmony_destructuring_; | 1034 bool allow_harmony_destructuring_; |
1024 bool allow_harmony_spread_arrays_; | 1035 bool allow_harmony_spread_arrays_; |
| 1036 bool allow_harmony_default_parameters_; |
1025 bool allow_strong_mode_; | 1037 bool allow_strong_mode_; |
1026 }; | 1038 }; |
1027 | 1039 |
1028 | 1040 |
1029 class PreParserIdentifier { | 1041 class PreParserIdentifier { |
1030 public: | 1042 public: |
1031 PreParserIdentifier() : type_(kUnknownIdentifier) {} | 1043 PreParserIdentifier() : type_(kUnknownIdentifier) {} |
1032 static PreParserIdentifier Default() { | 1044 static PreParserIdentifier Default() { |
1033 return PreParserIdentifier(kUnknownIdentifier); | 1045 return PreParserIdentifier(kUnknownIdentifier); |
1034 } | 1046 } |
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1792 } | 1804 } |
1793 inline void MaterializeTemplateCallsiteLiterals(); | 1805 inline void MaterializeTemplateCallsiteLiterals(); |
1794 PreParserExpression NoTemplateTag() { | 1806 PreParserExpression NoTemplateTag() { |
1795 return PreParserExpression::NoTemplateTag(); | 1807 return PreParserExpression::NoTemplateTag(); |
1796 } | 1808 } |
1797 static bool IsTaggedTemplate(const PreParserExpression tag) { | 1809 static bool IsTaggedTemplate(const PreParserExpression tag) { |
1798 return !tag.IsNoTemplateTag(); | 1810 return !tag.IsNoTemplateTag(); |
1799 } | 1811 } |
1800 | 1812 |
1801 V8_INLINE bool DeclareFormalParameter(DuplicateFinder* scope, | 1813 V8_INLINE bool DeclareFormalParameter(DuplicateFinder* scope, |
1802 PreParserIdentifier param, | 1814 PreParserIdentifier param, bool is_rest, |
1803 bool is_rest); | 1815 int pos); |
1804 | 1816 |
1805 void CheckConflictingVarDeclarations(Scope* scope, bool* ok) {} | 1817 void CheckConflictingVarDeclarations(Scope* scope, bool* ok) {} |
1806 | 1818 |
1807 // Temporary glue; these functions will move to ParserBase. | 1819 // Temporary glue; these functions will move to ParserBase. |
1808 PreParserExpression ParseV8Intrinsic(bool* ok); | 1820 PreParserExpression ParseV8Intrinsic(bool* ok); |
1809 PreParserExpression ParseFunctionLiteral( | 1821 PreParserExpression ParseFunctionLiteral( |
1810 PreParserIdentifier name, Scanner::Location function_name_location, | 1822 PreParserIdentifier name, Scanner::Location function_name_location, |
1811 bool name_is_strict_reserved, FunctionKind kind, | 1823 bool name_is_strict_reserved, FunctionKind kind, |
1812 int function_token_position, FunctionLiteral::FunctionType type, | 1824 int function_token_position, FunctionLiteral::FunctionType type, |
1813 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); | 1825 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1989 | 2001 |
1990 PreParserExpression PreParserTraits::SpreadCallNew(PreParserExpression function, | 2002 PreParserExpression PreParserTraits::SpreadCallNew(PreParserExpression function, |
1991 PreParserExpressionList args, | 2003 PreParserExpressionList args, |
1992 int pos) { | 2004 int pos) { |
1993 return pre_parser_->factory()->NewCallNew(function, args, pos); | 2005 return pre_parser_->factory()->NewCallNew(function, args, pos); |
1994 } | 2006 } |
1995 | 2007 |
1996 | 2008 |
1997 bool PreParserTraits::DeclareFormalParameter( | 2009 bool PreParserTraits::DeclareFormalParameter( |
1998 DuplicateFinder* duplicate_finder, PreParserIdentifier current_identifier, | 2010 DuplicateFinder* duplicate_finder, PreParserIdentifier current_identifier, |
1999 bool is_rest) { | 2011 bool is_rest, int pos) { |
2000 return pre_parser_->scanner()->FindSymbol(duplicate_finder, 1) != 0; | 2012 return pre_parser_->scanner()->FindSymbol(duplicate_finder, 1) != 0; |
2001 } | 2013 } |
2002 | 2014 |
2003 | 2015 |
2004 void PreParserTraits::ParseArrowFunctionFormalParameters( | 2016 void PreParserTraits::ParseArrowFunctionFormalParameters( |
2005 Scope* scope, PreParserExpression params, | 2017 Scope* scope, PreParserExpression params, |
2006 const Scanner::Location& params_loc, bool* is_rest, | 2018 const Scanner::Location& params_loc, bool* is_rest, |
2007 Scanner::Location* duplicate_loc, bool* ok) { | 2019 Scanner::Location* duplicate_loc, bool* ok) { |
2008 // TODO(wingo): Detect duplicated identifiers in paramlists. Detect parameter | 2020 // TODO(wingo): Detect duplicated identifiers in paramlists. Detect parameter |
2009 // lists that are too long. | 2021 // lists that are too long. |
(...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3666 } | 3678 } |
3667 | 3679 |
3668 | 3680 |
3669 template <class Traits> | 3681 template <class Traits> |
3670 void ParserBase<Traits>::ParseFormalParameter(FormalParameterScopeT* scope, | 3682 void ParserBase<Traits>::ParseFormalParameter(FormalParameterScopeT* scope, |
3671 bool is_rest, | 3683 bool is_rest, |
3672 ExpressionClassifier* classifier, | 3684 ExpressionClassifier* classifier, |
3673 bool* ok) { | 3685 bool* ok) { |
3674 // FormalParameter[Yield,GeneratorParameter] : | 3686 // FormalParameter[Yield,GeneratorParameter] : |
3675 // BindingElement[?Yield, ?GeneratorParameter] | 3687 // BindingElement[?Yield, ?GeneratorParameter] |
| 3688 int pos = peek_position(); |
3676 IdentifierT name = ParseAndClassifyIdentifier(classifier, ok); | 3689 IdentifierT name = ParseAndClassifyIdentifier(classifier, ok); |
3677 if (!*ok) return; | 3690 if (!*ok) return; |
3678 | 3691 |
3679 bool was_declared = Traits::DeclareFormalParameter(scope, name, is_rest); | 3692 bool was_declared = Traits::DeclareFormalParameter(scope, name, is_rest, pos); |
3680 if (was_declared) { | 3693 if (was_declared) { |
3681 classifier->RecordDuplicateFormalParameterError(scanner()->location()); | 3694 classifier->RecordDuplicateFormalParameterError(scanner()->location()); |
3682 } | 3695 } |
3683 } | 3696 } |
3684 | 3697 |
3685 | 3698 |
3686 template <class Traits> | 3699 template <class Traits> |
3687 int ParserBase<Traits>::ParseFormalParameterList( | 3700 int ParserBase<Traits>::ParseFormalParameterList( |
3688 FormalParameterScopeT* scope, bool* is_rest, | 3701 FormalParameterScopeT* scope, ExpressionListT initializers, |
| 3702 bool* has_parameter_expressions, bool* is_rest, |
3689 ExpressionClassifier* classifier, bool* ok) { | 3703 ExpressionClassifier* classifier, bool* ok) { |
3690 // FormalParameters[Yield,GeneratorParameter] : | 3704 // FormalParameters[Yield,GeneratorParameter] : |
3691 // [empty] | 3705 // [empty] |
3692 // FormalParameterList[?Yield, ?GeneratorParameter] | 3706 // FormalParameterList[?Yield, ?GeneratorParameter] |
3693 // | 3707 // |
3694 // FormalParameterList[Yield,GeneratorParameter] : | 3708 // FormalParameterList[Yield,GeneratorParameter] : |
3695 // FunctionRestParameter[?Yield] | 3709 // FunctionRestParameter[?Yield] |
3696 // FormalsList[?Yield, ?GeneratorParameter] | 3710 // FormalsList[?Yield, ?GeneratorParameter] |
3697 // FormalsList[?Yield, ?GeneratorParameter] , FunctionRestParameter[?Yield] | 3711 // FormalsList[?Yield, ?GeneratorParameter] , FunctionRestParameter[?Yield] |
3698 // | 3712 // |
3699 // FormalsList[Yield,GeneratorParameter] : | 3713 // FormalsList[Yield,GeneratorParameter] : |
3700 // FormalParameter[?Yield, ?GeneratorParameter] | 3714 // FormalParameter[?Yield, ?GeneratorParameter] |
3701 // FormalsList[?Yield, ?GeneratorParameter] , | 3715 // FormalsList[?Yield, ?GeneratorParameter] , |
3702 // FormalParameter[?Yield,?GeneratorParameter] | 3716 // FormalParameter[?Yield,?GeneratorParameter] |
3703 | 3717 |
3704 int parameter_count = 0; | 3718 int parameter_count = 0; |
3705 | 3719 |
3706 if (peek() != Token::RPAREN) { | 3720 if (peek() != Token::RPAREN) { |
3707 do { | 3721 do { |
| 3722 Scope* param_scope = NewScope(scope_, BLOCK_SCOPE); |
| 3723 BlockState param_state(&scope_, param_scope); |
| 3724 param_scope->set_start_position(peek_position()); |
3708 if (++parameter_count > Code::kMaxArguments) { | 3725 if (++parameter_count > Code::kMaxArguments) { |
3709 ReportMessage(MessageTemplate::kTooManyParameters); | 3726 ReportMessage(MessageTemplate::kTooManyParameters); |
3710 *ok = false; | 3727 *ok = false; |
3711 return -1; | 3728 return -1; |
3712 } | 3729 } |
| 3730 |
| 3731 int start_pos = peek_position(); |
3713 *is_rest = allow_harmony_rest_params() && Check(Token::ELLIPSIS); | 3732 *is_rest = allow_harmony_rest_params() && Check(Token::ELLIPSIS); |
3714 ParseFormalParameter(scope, *is_rest, classifier, ok); | 3733 ParseFormalParameter(scope, *is_rest, classifier, ok); |
3715 if (!*ok) return -1; | 3734 if (!*ok) return -1; |
| 3735 |
| 3736 // TODO(caitp, dslomov): set *has_parameter_expressions to true if |
| 3737 // formal parameter is an ObjectBindingPattern containing computed |
| 3738 // property keys |
| 3739 |
| 3740 ExpressionT initializer = this->EmptyExpression(); |
| 3741 if (allow_harmony_default_parameters() && Check(Token::ASSIGN)) { |
| 3742 // Default parameter initializer |
| 3743 static const bool accept_IN = true; |
| 3744 ExpressionClassifier classifier; |
| 3745 initializer = ParseAssignmentExpression(accept_IN, &classifier, ok); |
| 3746 if (!*ok) return -1; |
| 3747 *has_parameter_expressions = true; |
| 3748 |
| 3749 // A rest parameter cannot be initialized. |
| 3750 if (*is_rest) { |
| 3751 Scanner::Location loc(start_pos, scanner()->location().end_pos); |
| 3752 ReportMessageAt(loc, MessageTemplate::kBadRestParameterInitializer); |
| 3753 *ok = false; |
| 3754 return -1; |
| 3755 } |
| 3756 } |
| 3757 param_scope->set_end_position(scanner()->location().end_pos); |
| 3758 initializers->Add(initializer, zone()); |
3716 } while (!*is_rest && Check(Token::COMMA)); | 3759 } while (!*is_rest && Check(Token::COMMA)); |
3717 | 3760 |
3718 if (*is_rest && peek() == Token::COMMA) { | 3761 if (*is_rest && peek() == Token::COMMA) { |
3719 ReportMessageAt(scanner()->peek_location(), | 3762 ReportMessageAt(scanner()->peek_location(), |
3720 MessageTemplate::kParamAfterRest); | 3763 MessageTemplate::kParamAfterRest); |
3721 *ok = false; | 3764 *ok = false; |
3722 return -1; | 3765 return -1; |
3723 } | 3766 } |
3724 } | 3767 } |
3725 | 3768 |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4039 *ok = false; | 4082 *ok = false; |
4040 return; | 4083 return; |
4041 } | 4084 } |
4042 has_seen_constructor_ = true; | 4085 has_seen_constructor_ = true; |
4043 return; | 4086 return; |
4044 } | 4087 } |
4045 } | 4088 } |
4046 } } // v8::internal | 4089 } } // v8::internal |
4047 | 4090 |
4048 #endif // V8_PREPARSER_H | 4091 #endif // V8_PREPARSER_H |
OLD | NEW |