| 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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 typedef v8::internal::Zone Zone; | 356 typedef v8::internal::Zone Zone; |
| 357 | 357 |
| 358 typedef v8::internal::AstProperties AstProperties; | 358 typedef v8::internal::AstProperties AstProperties; |
| 359 typedef Vector<VariableProxy*> ParameterIdentifierVector; | 359 typedef Vector<VariableProxy*> ParameterIdentifierVector; |
| 360 | 360 |
| 361 // Return types for traversing functions. | 361 // Return types for traversing functions. |
| 362 typedef const AstRawString* Identifier; | 362 typedef const AstRawString* Identifier; |
| 363 typedef v8::internal::Expression* Expression; | 363 typedef v8::internal::Expression* Expression; |
| 364 typedef Yield* YieldExpression; | 364 typedef Yield* YieldExpression; |
| 365 typedef v8::internal::FunctionLiteral* FunctionLiteral; | 365 typedef v8::internal::FunctionLiteral* FunctionLiteral; |
| 366 typedef v8::internal::ClassLiteral* ClassLiteral; |
| 366 typedef v8::internal::Literal* Literal; | 367 typedef v8::internal::Literal* Literal; |
| 367 typedef ObjectLiteral::Property* ObjectLiteralProperty; | 368 typedef ObjectLiteral::Property* ObjectLiteralProperty; |
| 368 typedef ZoneList<v8::internal::Expression*>* ExpressionList; | 369 typedef ZoneList<v8::internal::Expression*>* ExpressionList; |
| 369 typedef ZoneList<ObjectLiteral::Property*>* PropertyList; | 370 typedef ZoneList<ObjectLiteral::Property*>* PropertyList; |
| 370 typedef ZoneList<v8::internal::Statement*>* StatementList; | 371 typedef ZoneList<v8::internal::Statement*>* StatementList; |
| 371 | 372 |
| 372 // For constructing objects returned by the traversing functions. | 373 // For constructing objects returned by the traversing functions. |
| 373 typedef AstNodeFactory<AstConstructionVisitor> Factory; | 374 typedef AstNodeFactory<AstConstructionVisitor> Factory; |
| 374 }; | 375 }; |
| 375 | 376 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 394 | 395 |
| 395 // Helper functions for recursive descent. | 396 // Helper functions for recursive descent. |
| 396 bool IsEvalOrArguments(const AstRawString* identifier) const; | 397 bool IsEvalOrArguments(const AstRawString* identifier) const; |
| 397 V8_INLINE bool IsFutureStrictReserved(const AstRawString* identifier) const; | 398 V8_INLINE bool IsFutureStrictReserved(const AstRawString* identifier) const; |
| 398 | 399 |
| 399 // Returns true if the expression is of type "this.foo". | 400 // Returns true if the expression is of type "this.foo". |
| 400 static bool IsThisProperty(Expression* expression); | 401 static bool IsThisProperty(Expression* expression); |
| 401 | 402 |
| 402 static bool IsIdentifier(Expression* expression); | 403 static bool IsIdentifier(Expression* expression); |
| 403 | 404 |
| 405 bool IsPrototype(const AstRawString* identifier) const; |
| 406 |
| 407 bool IsConstructor(const AstRawString* identifier) const; |
| 408 |
| 404 static const AstRawString* AsIdentifier(Expression* expression) { | 409 static const AstRawString* AsIdentifier(Expression* expression) { |
| 405 DCHECK(IsIdentifier(expression)); | 410 DCHECK(IsIdentifier(expression)); |
| 406 return expression->AsVariableProxy()->raw_name(); | 411 return expression->AsVariableProxy()->raw_name(); |
| 407 } | 412 } |
| 408 | 413 |
| 409 static bool IsBoilerplateProperty(ObjectLiteral::Property* property) { | 414 static bool IsBoilerplateProperty(ObjectLiteral::Property* property) { |
| 410 return ObjectLiteral::IsBoilerplateProperty(property); | 415 return ObjectLiteral::IsBoilerplateProperty(property); |
| 411 } | 416 } |
| 412 | 417 |
| 413 static bool IsArrayIndex(const AstRawString* string, uint32_t* index) { | 418 static bool IsArrayIndex(const AstRawString* string, uint32_t* index) { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 return NULL; | 516 return NULL; |
| 512 } | 517 } |
| 513 static Expression* EmptyExpression() { | 518 static Expression* EmptyExpression() { |
| 514 return NULL; | 519 return NULL; |
| 515 } | 520 } |
| 516 static Expression* EmptyArrowParamList() { return NULL; } | 521 static Expression* EmptyArrowParamList() { return NULL; } |
| 517 static Literal* EmptyLiteral() { | 522 static Literal* EmptyLiteral() { |
| 518 return NULL; | 523 return NULL; |
| 519 } | 524 } |
| 520 static ObjectLiteralProperty* EmptyObjectLiteralProperty() { return NULL; } | 525 static ObjectLiteralProperty* EmptyObjectLiteralProperty() { return NULL; } |
| 526 static FunctionLiteral* EmptyFunctionLiteral() { return NULL; } |
| 527 static ClassLiteral* EmptyClassLiteral() { return NULL; } |
| 521 | 528 |
| 522 // Used in error return values. | 529 // Used in error return values. |
| 523 static ZoneList<Expression*>* NullExpressionList() { | 530 static ZoneList<Expression*>* NullExpressionList() { |
| 524 return NULL; | 531 return NULL; |
| 525 } | 532 } |
| 526 | 533 |
| 527 // Non-NULL empty string. | 534 // Non-NULL empty string. |
| 528 V8_INLINE const AstRawString* EmptyIdentifierString(); | 535 V8_INLINE const AstRawString* EmptyIdentifierString(); |
| 529 | 536 |
| 530 // Odd-ball literal creators. | 537 // Odd-ball literal creators. |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 Module* ParseModulePath(bool* ok); | 705 Module* ParseModulePath(bool* ok); |
| 699 Module* ParseModuleVariable(bool* ok); | 706 Module* ParseModuleVariable(bool* ok); |
| 700 Module* ParseModuleUrl(bool* ok); | 707 Module* ParseModuleUrl(bool* ok); |
| 701 Module* ParseModuleSpecifier(bool* ok); | 708 Module* ParseModuleSpecifier(bool* ok); |
| 702 Block* ParseImportDeclaration(bool* ok); | 709 Block* ParseImportDeclaration(bool* ok); |
| 703 Statement* ParseExportDeclaration(bool* ok); | 710 Statement* ParseExportDeclaration(bool* ok); |
| 704 Statement* ParseBlockElement(ZoneList<const AstRawString*>* labels, bool* ok); | 711 Statement* ParseBlockElement(ZoneList<const AstRawString*>* labels, bool* ok); |
| 705 Statement* ParseStatement(ZoneList<const AstRawString*>* labels, bool* ok); | 712 Statement* ParseStatement(ZoneList<const AstRawString*>* labels, bool* ok); |
| 706 Statement* ParseFunctionDeclaration(ZoneList<const AstRawString*>* names, | 713 Statement* ParseFunctionDeclaration(ZoneList<const AstRawString*>* names, |
| 707 bool* ok); | 714 bool* ok); |
| 715 Statement* ParseClassDeclaration(ZoneList<const AstRawString*>* names, |
| 716 bool* ok); |
| 708 Statement* ParseNativeDeclaration(bool* ok); | 717 Statement* ParseNativeDeclaration(bool* ok); |
| 709 Block* ParseBlock(ZoneList<const AstRawString*>* labels, bool* ok); | 718 Block* ParseBlock(ZoneList<const AstRawString*>* labels, bool* ok); |
| 710 Block* ParseVariableStatement(VariableDeclarationContext var_context, | 719 Block* ParseVariableStatement(VariableDeclarationContext var_context, |
| 711 ZoneList<const AstRawString*>* names, | 720 ZoneList<const AstRawString*>* names, |
| 712 bool* ok); | 721 bool* ok); |
| 713 Block* ParseVariableDeclarations(VariableDeclarationContext var_context, | 722 Block* ParseVariableDeclarations(VariableDeclarationContext var_context, |
| 714 VariableDeclarationProperties* decl_props, | 723 VariableDeclarationProperties* decl_props, |
| 715 ZoneList<const AstRawString*>* names, | 724 ZoneList<const AstRawString*>* names, |
| 716 const AstRawString** out, | 725 const AstRawString** out, |
| 717 bool* ok); | 726 bool* ok); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 private: | 912 private: |
| 904 static const int kLiteralTypeSlot = 0; | 913 static const int kLiteralTypeSlot = 0; |
| 905 static const int kElementsSlot = 1; | 914 static const int kElementsSlot = 1; |
| 906 | 915 |
| 907 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 916 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
| 908 }; | 917 }; |
| 909 | 918 |
| 910 } } // namespace v8::internal | 919 } } // namespace v8::internal |
| 911 | 920 |
| 912 #endif // V8_PARSER_H_ | 921 #endif // V8_PARSER_H_ |
| OLD | NEW |