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_H_ | 5 #ifndef V8_AST_H_ |
6 #define V8_AST_H_ | 6 #define V8_AST_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
11 #include "src/ast-value-factory.h" | 11 #include "src/ast-value-factory.h" |
12 #include "src/bailout-reason.h" | 12 #include "src/bailout-reason.h" |
13 #include "src/factory.h" | 13 #include "src/factory.h" |
14 #include "src/interface.h" | |
15 #include "src/isolate.h" | 14 #include "src/isolate.h" |
16 #include "src/jsregexp.h" | 15 #include "src/jsregexp.h" |
17 #include "src/list-inl.h" | 16 #include "src/list-inl.h" |
| 17 #include "src/modules.h" |
18 #include "src/runtime/runtime.h" | 18 #include "src/runtime/runtime.h" |
19 #include "src/small-pointer-list.h" | 19 #include "src/small-pointer-list.h" |
20 #include "src/smart-pointers.h" | 20 #include "src/smart-pointers.h" |
21 #include "src/token.h" | 21 #include "src/token.h" |
22 #include "src/types.h" | 22 #include "src/types.h" |
23 #include "src/utils.h" | 23 #include "src/utils.h" |
24 #include "src/variables.h" | 24 #include "src/variables.h" |
25 | 25 |
26 namespace v8 { | 26 namespace v8 { |
27 namespace internal { | 27 namespace internal { |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 } | 639 } |
640 | 640 |
641 protected: | 641 protected: |
642 ExportDeclaration(Zone* zone, VariableProxy* proxy, Scope* scope, int pos) | 642 ExportDeclaration(Zone* zone, VariableProxy* proxy, Scope* scope, int pos) |
643 : Declaration(zone, proxy, LET, scope, pos) {} | 643 : Declaration(zone, proxy, LET, scope, pos) {} |
644 }; | 644 }; |
645 | 645 |
646 | 646 |
647 class Module : public AstNode { | 647 class Module : public AstNode { |
648 public: | 648 public: |
649 Interface* interface() const { return interface_; } | 649 ModuleDescriptor* descriptor() const { return descriptor_; } |
650 Block* body() const { return body_; } | 650 Block* body() const { return body_; } |
651 | 651 |
652 protected: | 652 protected: |
653 Module(Zone* zone, int pos) | 653 Module(Zone* zone, int pos) |
654 : AstNode(pos), | 654 : AstNode(pos), descriptor_(ModuleDescriptor::New(zone)), body_(NULL) {} |
655 interface_(Interface::New(zone)), | 655 Module(Zone* zone, ModuleDescriptor* descriptor, int pos, Block* body = NULL) |
656 body_(NULL) {} | 656 : AstNode(pos), descriptor_(descriptor), body_(body) {} |
657 Module(Zone* zone, Interface* interface, int pos, Block* body = NULL) | |
658 : AstNode(pos), | |
659 interface_(interface), | |
660 body_(body) {} | |
661 | 657 |
662 private: | 658 private: |
663 Interface* interface_; | 659 ModuleDescriptor* descriptor_; |
664 Block* body_; | 660 Block* body_; |
665 }; | 661 }; |
666 | 662 |
667 | 663 |
668 class ModuleLiteral FINAL : public Module { | 664 class ModuleLiteral FINAL : public Module { |
669 public: | 665 public: |
670 DECLARE_NODE_TYPE(ModuleLiteral) | 666 DECLARE_NODE_TYPE(ModuleLiteral) |
671 | 667 |
672 protected: | 668 protected: |
673 ModuleLiteral(Zone* zone, Block* body, Interface* interface, int pos) | 669 ModuleLiteral(Zone* zone, Block* body, ModuleDescriptor* descriptor, int pos) |
674 : Module(zone, interface, pos, body) {} | 670 : Module(zone, descriptor, pos, body) {} |
675 }; | 671 }; |
676 | 672 |
677 | 673 |
678 class ModulePath FINAL : public Module { | 674 class ModulePath FINAL : public Module { |
679 public: | 675 public: |
680 DECLARE_NODE_TYPE(ModulePath) | 676 DECLARE_NODE_TYPE(ModulePath) |
681 | 677 |
682 Module* module() const { return module_; } | 678 Module* module() const { return module_; } |
683 Handle<String> name() const { return name_->string(); } | 679 Handle<String> name() const { return name_->string(); } |
684 | 680 |
(...skipping 2480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3165 int pos) { | 3161 int pos) { |
3166 return new (zone_) ImportDeclaration(zone_, proxy, module, scope, pos); | 3162 return new (zone_) ImportDeclaration(zone_, proxy, module, scope, pos); |
3167 } | 3163 } |
3168 | 3164 |
3169 ExportDeclaration* NewExportDeclaration(VariableProxy* proxy, | 3165 ExportDeclaration* NewExportDeclaration(VariableProxy* proxy, |
3170 Scope* scope, | 3166 Scope* scope, |
3171 int pos) { | 3167 int pos) { |
3172 return new (zone_) ExportDeclaration(zone_, proxy, scope, pos); | 3168 return new (zone_) ExportDeclaration(zone_, proxy, scope, pos); |
3173 } | 3169 } |
3174 | 3170 |
3175 ModuleLiteral* NewModuleLiteral(Block* body, Interface* interface, int pos) { | 3171 ModuleLiteral* NewModuleLiteral(Block* body, ModuleDescriptor* descriptor, |
3176 return new (zone_) ModuleLiteral(zone_, body, interface, pos); | 3172 int pos) { |
| 3173 return new (zone_) ModuleLiteral(zone_, body, descriptor, pos); |
3177 } | 3174 } |
3178 | 3175 |
3179 ModulePath* NewModulePath(Module* origin, const AstRawString* name, int pos) { | 3176 ModulePath* NewModulePath(Module* origin, const AstRawString* name, int pos) { |
3180 return new (zone_) ModulePath(zone_, origin, name, pos); | 3177 return new (zone_) ModulePath(zone_, origin, name, pos); |
3181 } | 3178 } |
3182 | 3179 |
3183 ModuleUrl* NewModuleUrl(Handle<String> url, int pos) { | 3180 ModuleUrl* NewModuleUrl(Handle<String> url, int pos) { |
3184 return new (zone_) ModuleUrl(zone_, url, pos); | 3181 return new (zone_) ModuleUrl(zone_, url, pos); |
3185 } | 3182 } |
3186 | 3183 |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3494 | 3491 |
3495 private: | 3492 private: |
3496 Zone* zone_; | 3493 Zone* zone_; |
3497 AstValueFactory* ast_value_factory_; | 3494 AstValueFactory* ast_value_factory_; |
3498 }; | 3495 }; |
3499 | 3496 |
3500 | 3497 |
3501 } } // namespace v8::internal | 3498 } } // namespace v8::internal |
3502 | 3499 |
3503 #endif // V8_AST_H_ | 3500 #endif // V8_AST_H_ |
OLD | NEW |