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" // For CachedDataMode | 10 #include "src/compiler.h" // For CachedDataMode |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 Expression* GetIterator(Expression* iterable, AstNodeFactory* factory); | 555 Expression* GetIterator(Expression* iterable, AstNodeFactory* factory); |
556 ZoneList<v8::internal::Expression*>* NewExpressionList(int size, Zone* zone) { | 556 ZoneList<v8::internal::Expression*>* NewExpressionList(int size, Zone* zone) { |
557 return new(zone) ZoneList<v8::internal::Expression*>(size, zone); | 557 return new(zone) ZoneList<v8::internal::Expression*>(size, zone); |
558 } | 558 } |
559 ZoneList<ObjectLiteral::Property*>* NewPropertyList(int size, Zone* zone) { | 559 ZoneList<ObjectLiteral::Property*>* NewPropertyList(int size, Zone* zone) { |
560 return new(zone) ZoneList<ObjectLiteral::Property*>(size, zone); | 560 return new(zone) ZoneList<ObjectLiteral::Property*>(size, zone); |
561 } | 561 } |
562 ZoneList<v8::internal::Statement*>* NewStatementList(int size, Zone* zone) { | 562 ZoneList<v8::internal::Statement*>* NewStatementList(int size, Zone* zone) { |
563 return new(zone) ZoneList<v8::internal::Statement*>(size, zone); | 563 return new(zone) ZoneList<v8::internal::Statement*>(size, zone); |
564 } | 564 } |
565 V8_INLINE Scope* NewScope(Scope* parent_scope, ScopeType scope_type); | 565 V8_INLINE Scope* NewScope(Scope* parent_scope, ScopeType scope_type, |
| 566 FunctionKind kind = kNormalFunction); |
566 | 567 |
567 // Utility functions | 568 // Utility functions |
568 int DeclareArrowParametersFromExpression(Expression* expression, Scope* scope, | 569 int DeclareArrowParametersFromExpression(Expression* expression, Scope* scope, |
569 Scanner::Location* dupe_loc, | 570 Scanner::Location* dupe_loc, |
570 bool* ok); | 571 bool* ok); |
571 V8_INLINE AstValueFactory* ast_value_factory(); | 572 V8_INLINE AstValueFactory* ast_value_factory(); |
572 | 573 |
573 // Temporary glue; these functions will move to ParserBase. | 574 // Temporary glue; these functions will move to ParserBase. |
574 Expression* ParseV8Intrinsic(bool* ok); | 575 Expression* ParseV8Intrinsic(bool* ok); |
575 FunctionLiteral* ParseFunctionLiteral( | 576 FunctionLiteral* ParseFunctionLiteral( |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 VariableMode mode, | 850 VariableMode mode, |
850 Interface* interface); | 851 Interface* interface); |
851 void Declare(Declaration* declaration, bool resolve, bool* ok); | 852 void Declare(Declaration* declaration, bool resolve, bool* ok); |
852 | 853 |
853 bool TargetStackContainsLabel(const AstRawString* label); | 854 bool TargetStackContainsLabel(const AstRawString* label); |
854 BreakableStatement* LookupBreakTarget(const AstRawString* label, bool* ok); | 855 BreakableStatement* LookupBreakTarget(const AstRawString* label, bool* ok); |
855 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok); | 856 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok); |
856 | 857 |
857 // Factory methods. | 858 // Factory methods. |
858 | 859 |
859 Scope* NewScope(Scope* parent, ScopeType type); | 860 Scope* NewScope(Scope* parent, ScopeType type, |
| 861 FunctionKind kind = kNormalFunction); |
860 | 862 |
861 FunctionLiteral* DefaultConstructor(bool call_super, Scope* scope, int pos, | 863 FunctionLiteral* DefaultConstructor(bool call_super, Scope* scope, int pos, |
862 int end_pos); | 864 int end_pos); |
863 | 865 |
864 // Skip over a lazy function, either using cached data if we have it, or | 866 // Skip over a lazy function, either using cached data if we have it, or |
865 // by parsing the function with PreParser. Consumes the ending }. | 867 // by parsing the function with PreParser. Consumes the ending }. |
866 void SkipLazyFunctionBody(const AstRawString* function_name, | 868 void SkipLazyFunctionBody(const AstRawString* function_name, |
867 int* materialized_literal_count, | 869 int* materialized_literal_count, |
868 int* expected_property_count, | 870 int* expected_property_count, |
869 bool* ok); | 871 bool* ok); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 HistogramTimer* pre_parse_timer_; | 911 HistogramTimer* pre_parse_timer_; |
910 }; | 912 }; |
911 | 913 |
912 | 914 |
913 bool ParserTraits::IsFutureStrictReserved( | 915 bool ParserTraits::IsFutureStrictReserved( |
914 const AstRawString* identifier) const { | 916 const AstRawString* identifier) const { |
915 return parser_->scanner()->IdentifierIsFutureStrictReserved(identifier); | 917 return parser_->scanner()->IdentifierIsFutureStrictReserved(identifier); |
916 } | 918 } |
917 | 919 |
918 | 920 |
919 Scope* ParserTraits::NewScope(Scope* parent_scope, ScopeType scope_type) { | 921 Scope* ParserTraits::NewScope(Scope* parent_scope, ScopeType scope_type, |
920 return parser_->NewScope(parent_scope, scope_type); | 922 FunctionKind kind) { |
| 923 return parser_->NewScope(parent_scope, scope_type, kind); |
921 } | 924 } |
922 | 925 |
923 | 926 |
924 const AstRawString* ParserTraits::EmptyIdentifierString() { | 927 const AstRawString* ParserTraits::EmptyIdentifierString() { |
925 return parser_->ast_value_factory()->empty_string(); | 928 return parser_->ast_value_factory()->empty_string(); |
926 } | 929 } |
927 | 930 |
928 | 931 |
929 void ParserTraits::SkipLazyFunctionBody(const AstRawString* function_name, | 932 void ParserTraits::SkipLazyFunctionBody(const AstRawString* function_name, |
930 int* materialized_literal_count, | 933 int* materialized_literal_count, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 } | 1001 } |
999 | 1002 |
1000 | 1003 |
1001 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, | 1004 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, |
1002 int start, Expression* tag) { | 1005 int start, Expression* tag) { |
1003 return parser_->CloseTemplateLiteral(state, start, tag); | 1006 return parser_->CloseTemplateLiteral(state, start, tag); |
1004 } | 1007 } |
1005 } } // namespace v8::internal | 1008 } } // namespace v8::internal |
1006 | 1009 |
1007 #endif // V8_PARSER_H_ | 1010 #endif // V8_PARSER_H_ |
OLD | NEW |