| 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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 class Parser; | 351 class Parser; |
| 352 class SingletonLogger; | 352 class SingletonLogger; |
| 353 | 353 |
| 354 class ParserTraits { | 354 class ParserTraits { |
| 355 public: | 355 public: |
| 356 struct Type { | 356 struct Type { |
| 357 // TODO(marja): To be removed. The Traits object should contain all the data | 357 // TODO(marja): To be removed. The Traits object should contain all the data |
| 358 // it needs. | 358 // it needs. |
| 359 typedef v8::internal::Parser* Parser; | 359 typedef v8::internal::Parser* Parser; |
| 360 | 360 |
| 361 // Used by FunctionState and BlockState. | |
| 362 typedef v8::internal::Scope Scope; | |
| 363 typedef v8::internal::Scope* ScopePtr; | |
| 364 inline static Scope* ptr_to_scope(ScopePtr scope) { return scope; } | |
| 365 | |
| 366 typedef Variable GeneratorVariable; | 361 typedef Variable GeneratorVariable; |
| 367 | 362 |
| 368 typedef v8::internal::AstProperties AstProperties; | 363 typedef v8::internal::AstProperties AstProperties; |
| 369 typedef Vector<VariableProxy*> ParameterIdentifierVector; | 364 typedef Vector<VariableProxy*> ParameterIdentifierVector; |
| 370 | 365 |
| 371 // Return types for traversing functions. | 366 // Return types for traversing functions. |
| 372 typedef const AstRawString* Identifier; | 367 typedef const AstRawString* Identifier; |
| 373 typedef v8::internal::Expression* Expression; | 368 typedef v8::internal::Expression* Expression; |
| 374 typedef Yield* YieldExpression; | 369 typedef Yield* YieldExpression; |
| 375 typedef v8::internal::FunctionLiteral* FunctionLiteral; | 370 typedef v8::internal::FunctionLiteral* FunctionLiteral; |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 VariableProxy* NewUnresolved(const AstRawString* name, | 834 VariableProxy* NewUnresolved(const AstRawString* name, |
| 840 VariableMode mode, | 835 VariableMode mode, |
| 841 Interface* interface); | 836 Interface* interface); |
| 842 void Declare(Declaration* declaration, bool resolve, bool* ok); | 837 void Declare(Declaration* declaration, bool resolve, bool* ok); |
| 843 | 838 |
| 844 bool TargetStackContainsLabel(const AstRawString* label); | 839 bool TargetStackContainsLabel(const AstRawString* label); |
| 845 BreakableStatement* LookupBreakTarget(const AstRawString* label, bool* ok); | 840 BreakableStatement* LookupBreakTarget(const AstRawString* label, bool* ok); |
| 846 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok); | 841 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok); |
| 847 | 842 |
| 848 // Factory methods. | 843 // Factory methods. |
| 849 | |
| 850 Scope* NewScope(Scope* parent, ScopeType type, | |
| 851 FunctionKind kind = kNormalFunction); | |
| 852 | |
| 853 FunctionLiteral* DefaultConstructor(bool call_super, Scope* scope, int pos, | 844 FunctionLiteral* DefaultConstructor(bool call_super, Scope* scope, int pos, |
| 854 int end_pos); | 845 int end_pos); |
| 855 | 846 |
| 856 // Skip over a lazy function, either using cached data if we have it, or | 847 // Skip over a lazy function, either using cached data if we have it, or |
| 857 // by parsing the function with PreParser. Consumes the ending }. | 848 // by parsing the function with PreParser. Consumes the ending }. |
| 858 void SkipLazyFunctionBody(const AstRawString* function_name, | 849 void SkipLazyFunctionBody(const AstRawString* function_name, |
| 859 int* materialized_literal_count, | 850 int* materialized_literal_count, |
| 860 int* expected_property_count, | 851 int* expected_property_count, |
| 861 bool* ok); | 852 bool* ok); |
| 862 | 853 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 } | 978 } |
| 988 | 979 |
| 989 | 980 |
| 990 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, | 981 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, |
| 991 int start, Expression* tag) { | 982 int start, Expression* tag) { |
| 992 return parser_->CloseTemplateLiteral(state, start, tag); | 983 return parser_->CloseTemplateLiteral(state, start, tag); |
| 993 } | 984 } |
| 994 } } // namespace v8::internal | 985 } } // namespace v8::internal |
| 995 | 986 |
| 996 #endif // V8_PARSER_H_ | 987 #endif // V8_PARSER_H_ |
| OLD | NEW |