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_PARSER_H_ | 5 #ifndef V8_PARSER_H_ |
6 #define V8_PARSER_H_ | 6 #define V8_PARSER_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/ast.h" | 9 #include "src/ast.h" |
10 #include "src/compiler.h" // TODO(titzer): remove this include dependency | 10 #include "src/compiler.h" // TODO(titzer): remove this include dependency |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 Scope* scope, Expression* params, const Scanner::Location& params_loc, | 766 Scope* scope, Expression* params, const Scanner::Location& params_loc, |
767 FormalParameterErrorLocations* error_locs, bool* is_rest, bool* ok); | 767 FormalParameterErrorLocations* error_locs, bool* is_rest, bool* ok); |
768 | 768 |
769 // Temporary glue; these functions will move to ParserBase. | 769 // Temporary glue; these functions will move to ParserBase. |
770 Expression* ParseV8Intrinsic(bool* ok); | 770 Expression* ParseV8Intrinsic(bool* ok); |
771 FunctionLiteral* ParseFunctionLiteral( | 771 FunctionLiteral* ParseFunctionLiteral( |
772 const AstRawString* name, Scanner::Location function_name_location, | 772 const AstRawString* name, Scanner::Location function_name_location, |
773 bool name_is_strict_reserved, FunctionKind kind, | 773 bool name_is_strict_reserved, FunctionKind kind, |
774 int function_token_position, FunctionLiteral::FunctionType type, | 774 int function_token_position, FunctionLiteral::FunctionType type, |
775 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); | 775 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); |
776 V8_INLINE void SkipLazyFunctionBody(int* materialized_literal_count, | 776 V8_INLINE void SkipLazyFunctionBody(const AstRawString* name, |
| 777 int* materialized_literal_count, |
777 int* expected_property_count, bool* ok); | 778 int* expected_property_count, bool* ok); |
778 V8_INLINE ZoneList<Statement*>* ParseEagerFunctionBody( | 779 V8_INLINE ZoneList<Statement*>* ParseEagerFunctionBody( |
779 const AstRawString* name, int pos, Variable* fvar, | 780 const AstRawString* name, int pos, Variable* fvar, |
780 Token::Value fvar_init_op, FunctionKind kind, bool* ok); | 781 Token::Value fvar_init_op, FunctionKind kind, bool* ok); |
781 | 782 |
782 ClassLiteral* ParseClassLiteral(const AstRawString* name, | 783 ClassLiteral* ParseClassLiteral(const AstRawString* name, |
783 Scanner::Location class_name_location, | 784 Scanner::Location class_name_location, |
784 bool name_is_strict_reserved, int pos, | 785 bool name_is_strict_reserved, int pos, |
785 bool* ok); | 786 bool* ok); |
786 | 787 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok); | 1018 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok); |
1018 | 1019 |
1019 void AddAssertIsConstruct(ZoneList<Statement*>* body, int pos); | 1020 void AddAssertIsConstruct(ZoneList<Statement*>* body, int pos); |
1020 | 1021 |
1021 // Factory methods. | 1022 // Factory methods. |
1022 FunctionLiteral* DefaultConstructor(bool call_super, Scope* scope, int pos, | 1023 FunctionLiteral* DefaultConstructor(bool call_super, Scope* scope, int pos, |
1023 int end_pos); | 1024 int end_pos); |
1024 | 1025 |
1025 // Skip over a lazy function, either using cached data if we have it, or | 1026 // Skip over a lazy function, either using cached data if we have it, or |
1026 // by parsing the function with PreParser. Consumes the ending }. | 1027 // by parsing the function with PreParser. Consumes the ending }. |
1027 void SkipLazyFunctionBody(int* materialized_literal_count, | 1028 void SkipLazyFunctionBody(const AstRawString* function_name, |
| 1029 int* materialized_literal_count, |
1028 int* expected_property_count, | 1030 int* expected_property_count, |
1029 bool* ok); | 1031 bool* ok); |
1030 | 1032 |
1031 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( | 1033 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( |
1032 SingletonLogger* logger); | 1034 SingletonLogger* logger); |
1033 | 1035 |
1034 // Consumes the ending }. | 1036 // Consumes the ending }. |
1035 ZoneList<Statement*>* ParseEagerFunctionBody( | 1037 ZoneList<Statement*>* ParseEagerFunctionBody( |
1036 const AstRawString* function_name, int pos, Variable* fvar, | 1038 const AstRawString* function_name, int pos, Variable* fvar, |
1037 Token::Value fvar_init_op, FunctionKind kind, bool* ok); | 1039 Token::Value fvar_init_op, FunctionKind kind, bool* ok); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 FunctionKind kind) { | 1084 FunctionKind kind) { |
1083 return parser_->NewScope(parent_scope, scope_type, kind); | 1085 return parser_->NewScope(parent_scope, scope_type, kind); |
1084 } | 1086 } |
1085 | 1087 |
1086 | 1088 |
1087 const AstRawString* ParserTraits::EmptyIdentifierString() { | 1089 const AstRawString* ParserTraits::EmptyIdentifierString() { |
1088 return parser_->ast_value_factory()->empty_string(); | 1090 return parser_->ast_value_factory()->empty_string(); |
1089 } | 1091 } |
1090 | 1092 |
1091 | 1093 |
1092 void ParserTraits::SkipLazyFunctionBody(int* materialized_literal_count, | 1094 void ParserTraits::SkipLazyFunctionBody(const AstRawString* function_name, |
| 1095 int* materialized_literal_count, |
1093 int* expected_property_count, | 1096 int* expected_property_count, |
1094 bool* ok) { | 1097 bool* ok) { |
1095 return parser_->SkipLazyFunctionBody( | 1098 return parser_->SkipLazyFunctionBody( |
1096 materialized_literal_count, expected_property_count, ok); | 1099 function_name, materialized_literal_count, expected_property_count, ok); |
1097 } | 1100 } |
1098 | 1101 |
1099 | 1102 |
1100 ZoneList<Statement*>* ParserTraits::ParseEagerFunctionBody( | 1103 ZoneList<Statement*>* ParserTraits::ParseEagerFunctionBody( |
1101 const AstRawString* name, int pos, Variable* fvar, | 1104 const AstRawString* name, int pos, Variable* fvar, |
1102 Token::Value fvar_init_op, FunctionKind kind, bool* ok) { | 1105 Token::Value fvar_init_op, FunctionKind kind, bool* ok) { |
1103 return parser_->ParseEagerFunctionBody(name, pos, fvar, fvar_init_op, kind, | 1106 return parser_->ParseEagerFunctionBody(name, pos, fvar, fvar_init_op, kind, |
1104 ok); | 1107 ok); |
1105 } | 1108 } |
1106 | 1109 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 } | 1177 } |
1175 | 1178 |
1176 | 1179 |
1177 Expression* ParserTraits::SpreadCallNew( | 1180 Expression* ParserTraits::SpreadCallNew( |
1178 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) { | 1181 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) { |
1179 return parser_->SpreadCallNew(function, args, pos); | 1182 return parser_->SpreadCallNew(function, args, pos); |
1180 } | 1183 } |
1181 } } // namespace v8::internal | 1184 } } // namespace v8::internal |
1182 | 1185 |
1183 #endif // V8_PARSER_H_ | 1186 #endif // V8_PARSER_H_ |
OLD | NEW |