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(const AstRawString* name, | 776 V8_INLINE void SkipLazyFunctionBody(int* materialized_literal_count, |
777 int* materialized_literal_count, | |
778 int* expected_property_count, bool* ok); | 777 int* expected_property_count, bool* ok); |
779 V8_INLINE ZoneList<Statement*>* ParseEagerFunctionBody( | 778 V8_INLINE ZoneList<Statement*>* ParseEagerFunctionBody( |
780 const AstRawString* name, int pos, Variable* fvar, | 779 const AstRawString* name, int pos, Variable* fvar, |
781 Token::Value fvar_init_op, FunctionKind kind, bool* ok); | 780 Token::Value fvar_init_op, FunctionKind kind, bool* ok); |
782 | 781 |
783 ClassLiteral* ParseClassLiteral(const AstRawString* name, | 782 ClassLiteral* ParseClassLiteral(const AstRawString* name, |
784 Scanner::Location class_name_location, | 783 Scanner::Location class_name_location, |
785 bool name_is_strict_reserved, int pos, | 784 bool name_is_strict_reserved, int pos, |
786 bool* ok); | 785 bool* ok); |
787 | 786 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok); | 1017 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok); |
1019 | 1018 |
1020 void AddAssertIsConstruct(ZoneList<Statement*>* body, int pos); | 1019 void AddAssertIsConstruct(ZoneList<Statement*>* body, int pos); |
1021 | 1020 |
1022 // Factory methods. | 1021 // Factory methods. |
1023 FunctionLiteral* DefaultConstructor(bool call_super, Scope* scope, int pos, | 1022 FunctionLiteral* DefaultConstructor(bool call_super, Scope* scope, int pos, |
1024 int end_pos); | 1023 int end_pos); |
1025 | 1024 |
1026 // Skip over a lazy function, either using cached data if we have it, or | 1025 // Skip over a lazy function, either using cached data if we have it, or |
1027 // by parsing the function with PreParser. Consumes the ending }. | 1026 // by parsing the function with PreParser. Consumes the ending }. |
1028 void SkipLazyFunctionBody(const AstRawString* function_name, | 1027 void SkipLazyFunctionBody(int* materialized_literal_count, |
1029 int* materialized_literal_count, | |
1030 int* expected_property_count, | 1028 int* expected_property_count, |
1031 bool* ok); | 1029 bool* ok); |
1032 | 1030 |
1033 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( | 1031 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( |
1034 SingletonLogger* logger); | 1032 SingletonLogger* logger); |
1035 | 1033 |
1036 // Consumes the ending }. | 1034 // Consumes the ending }. |
1037 ZoneList<Statement*>* ParseEagerFunctionBody( | 1035 ZoneList<Statement*>* ParseEagerFunctionBody( |
1038 const AstRawString* function_name, int pos, Variable* fvar, | 1036 const AstRawString* function_name, int pos, Variable* fvar, |
1039 Token::Value fvar_init_op, FunctionKind kind, bool* ok); | 1037 Token::Value fvar_init_op, FunctionKind kind, bool* ok); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 FunctionKind kind) { | 1082 FunctionKind kind) { |
1085 return parser_->NewScope(parent_scope, scope_type, kind); | 1083 return parser_->NewScope(parent_scope, scope_type, kind); |
1086 } | 1084 } |
1087 | 1085 |
1088 | 1086 |
1089 const AstRawString* ParserTraits::EmptyIdentifierString() { | 1087 const AstRawString* ParserTraits::EmptyIdentifierString() { |
1090 return parser_->ast_value_factory()->empty_string(); | 1088 return parser_->ast_value_factory()->empty_string(); |
1091 } | 1089 } |
1092 | 1090 |
1093 | 1091 |
1094 void ParserTraits::SkipLazyFunctionBody(const AstRawString* function_name, | 1092 void ParserTraits::SkipLazyFunctionBody(int* materialized_literal_count, |
1095 int* materialized_literal_count, | |
1096 int* expected_property_count, | 1093 int* expected_property_count, |
1097 bool* ok) { | 1094 bool* ok) { |
1098 return parser_->SkipLazyFunctionBody( | 1095 return parser_->SkipLazyFunctionBody( |
1099 function_name, materialized_literal_count, expected_property_count, ok); | 1096 materialized_literal_count, expected_property_count, ok); |
1100 } | 1097 } |
1101 | 1098 |
1102 | 1099 |
1103 ZoneList<Statement*>* ParserTraits::ParseEagerFunctionBody( | 1100 ZoneList<Statement*>* ParserTraits::ParseEagerFunctionBody( |
1104 const AstRawString* name, int pos, Variable* fvar, | 1101 const AstRawString* name, int pos, Variable* fvar, |
1105 Token::Value fvar_init_op, FunctionKind kind, bool* ok) { | 1102 Token::Value fvar_init_op, FunctionKind kind, bool* ok) { |
1106 return parser_->ParseEagerFunctionBody(name, pos, fvar, fvar_init_op, kind, | 1103 return parser_->ParseEagerFunctionBody(name, pos, fvar, fvar_init_op, kind, |
1107 ok); | 1104 ok); |
1108 } | 1105 } |
1109 | 1106 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 } | 1174 } |
1178 | 1175 |
1179 | 1176 |
1180 Expression* ParserTraits::SpreadCallNew( | 1177 Expression* ParserTraits::SpreadCallNew( |
1181 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) { | 1178 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) { |
1182 return parser_->SpreadCallNew(function, args, pos); | 1179 return parser_->SpreadCallNew(function, args, pos); |
1183 } | 1180 } |
1184 } } // namespace v8::internal | 1181 } } // namespace v8::internal |
1185 | 1182 |
1186 #endif // V8_PARSER_H_ | 1183 #endif // V8_PARSER_H_ |
OLD | NEW |