| 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_AST_AST_H_ | 5 #ifndef V8_AST_AST_H_ |
| 6 #define V8_AST_AST_H_ | 6 #define V8_AST_AST_H_ |
| 7 | 7 |
| 8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
| 9 #include "src/ast/ast-value-factory.h" | 9 #include "src/ast/ast-value-factory.h" |
| 10 #include "src/ast/modules.h" | 10 #include "src/ast/modules.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // tree. | 33 // tree. |
| 34 | 34 |
| 35 | 35 |
| 36 // ---------------------------------------------------------------------------- | 36 // ---------------------------------------------------------------------------- |
| 37 // Nodes of the abstract syntax tree. Only concrete classes are | 37 // Nodes of the abstract syntax tree. Only concrete classes are |
| 38 // enumerated here. | 38 // enumerated here. |
| 39 | 39 |
| 40 #define DECLARATION_NODE_LIST(V) \ | 40 #define DECLARATION_NODE_LIST(V) \ |
| 41 V(VariableDeclaration) \ | 41 V(VariableDeclaration) \ |
| 42 V(FunctionDeclaration) \ | 42 V(FunctionDeclaration) \ |
| 43 V(ImportDeclaration) \ | 43 V(ImportDeclaration) |
| 44 V(ExportDeclaration) | |
| 45 | 44 |
| 46 #define STATEMENT_NODE_LIST(V) \ | 45 #define STATEMENT_NODE_LIST(V) \ |
| 47 V(Block) \ | 46 V(Block) \ |
| 48 V(ExpressionStatement) \ | 47 V(ExpressionStatement) \ |
| 49 V(EmptyStatement) \ | 48 V(EmptyStatement) \ |
| 50 V(SloppyBlockFunctionStatement) \ | 49 V(SloppyBlockFunctionStatement) \ |
| 51 V(IfStatement) \ | 50 V(IfStatement) \ |
| 52 V(ContinueStatement) \ | 51 V(ContinueStatement) \ |
| 53 V(BreakStatement) \ | 52 V(BreakStatement) \ |
| 54 V(ReturnStatement) \ | 53 V(ReturnStatement) \ |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 : Declaration(zone, proxy, CONST, scope, pos), | 595 : Declaration(zone, proxy, CONST, scope, pos), |
| 597 import_name_(import_name), | 596 import_name_(import_name), |
| 598 module_specifier_(module_specifier) {} | 597 module_specifier_(module_specifier) {} |
| 599 | 598 |
| 600 private: | 599 private: |
| 601 const AstRawString* import_name_; | 600 const AstRawString* import_name_; |
| 602 const AstRawString* module_specifier_; | 601 const AstRawString* module_specifier_; |
| 603 }; | 602 }; |
| 604 | 603 |
| 605 | 604 |
| 606 class ExportDeclaration final : public Declaration { | |
| 607 public: | |
| 608 DECLARE_NODE_TYPE(ExportDeclaration) | |
| 609 | |
| 610 InitializationFlag initialization() const override { | |
| 611 return kCreatedInitialized; | |
| 612 } | |
| 613 | |
| 614 protected: | |
| 615 ExportDeclaration(Zone* zone, VariableProxy* proxy, Scope* scope, int pos) | |
| 616 : Declaration(zone, proxy, LET, scope, pos) {} | |
| 617 }; | |
| 618 | |
| 619 | |
| 620 class Module : public AstNode { | 605 class Module : public AstNode { |
| 621 public: | 606 public: |
| 622 ModuleDescriptor* descriptor() const { return descriptor_; } | 607 ModuleDescriptor* descriptor() const { return descriptor_; } |
| 623 Block* body() const { return body_; } | 608 Block* body() const { return body_; } |
| 624 | 609 |
| 625 protected: | 610 protected: |
| 626 Module(Zone* zone, int pos) | 611 Module(Zone* zone, int pos) |
| 627 : AstNode(pos), descriptor_(ModuleDescriptor::New(zone)), body_(NULL) {} | 612 : AstNode(pos), descriptor_(ModuleDescriptor::New(zone)), body_(NULL) {} |
| 628 Module(Zone* zone, ModuleDescriptor* descriptor, int pos, Block* body = NULL) | 613 Module(Zone* zone, ModuleDescriptor* descriptor, int pos, Block* body = NULL) |
| 629 : AstNode(pos), descriptor_(descriptor), body_(body) {} | 614 : AstNode(pos), descriptor_(descriptor), body_(body) {} |
| (...skipping 2480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3110 } | 3095 } |
| 3111 | 3096 |
| 3112 ImportDeclaration* NewImportDeclaration(VariableProxy* proxy, | 3097 ImportDeclaration* NewImportDeclaration(VariableProxy* proxy, |
| 3113 const AstRawString* import_name, | 3098 const AstRawString* import_name, |
| 3114 const AstRawString* module_specifier, | 3099 const AstRawString* module_specifier, |
| 3115 Scope* scope, int pos) { | 3100 Scope* scope, int pos) { |
| 3116 return new (parser_zone_) ImportDeclaration( | 3101 return new (parser_zone_) ImportDeclaration( |
| 3117 parser_zone_, proxy, import_name, module_specifier, scope, pos); | 3102 parser_zone_, proxy, import_name, module_specifier, scope, pos); |
| 3118 } | 3103 } |
| 3119 | 3104 |
| 3120 ExportDeclaration* NewExportDeclaration(VariableProxy* proxy, | |
| 3121 Scope* scope, | |
| 3122 int pos) { | |
| 3123 return new (parser_zone_) | |
| 3124 ExportDeclaration(parser_zone_, proxy, scope, pos); | |
| 3125 } | |
| 3126 | |
| 3127 Block* NewBlock(ZoneList<const AstRawString*>* labels, int capacity, | 3105 Block* NewBlock(ZoneList<const AstRawString*>* labels, int capacity, |
| 3128 bool ignore_completion_value, int pos) { | 3106 bool ignore_completion_value, int pos) { |
| 3129 return new (local_zone_) | 3107 return new (local_zone_) |
| 3130 Block(local_zone_, labels, capacity, ignore_completion_value, pos); | 3108 Block(local_zone_, labels, capacity, ignore_completion_value, pos); |
| 3131 } | 3109 } |
| 3132 | 3110 |
| 3133 #define STATEMENT_WITH_LABELS(NodeType) \ | 3111 #define STATEMENT_WITH_LABELS(NodeType) \ |
| 3134 NodeType* New##NodeType(ZoneList<const AstRawString*>* labels, int pos) { \ | 3112 NodeType* New##NodeType(ZoneList<const AstRawString*>* labels, int pos) { \ |
| 3135 return new (local_zone_) NodeType(local_zone_, labels, pos); \ | 3113 return new (local_zone_) NodeType(local_zone_, labels, pos); \ |
| 3136 } | 3114 } |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3579 : NULL; \ | 3557 : NULL; \ |
| 3580 } | 3558 } |
| 3581 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3559 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
| 3582 #undef DECLARE_NODE_FUNCTIONS | 3560 #undef DECLARE_NODE_FUNCTIONS |
| 3583 | 3561 |
| 3584 | 3562 |
| 3585 } // namespace internal | 3563 } // namespace internal |
| 3586 } // namespace v8 | 3564 } // namespace v8 |
| 3587 | 3565 |
| 3588 #endif // V8_AST_AST_H_ | 3566 #endif // V8_AST_AST_H_ |
| OLD | NEW |