Index: src/ast.h |
diff --git a/src/ast.h b/src/ast.h |
index 7a46ac930d4943f6ab4a90abdd428a2bd67dfd4b..1c849dfa0500aadca85b4ac320cc44d041a2bd6b 100644 |
--- a/src/ast.h |
+++ b/src/ast.h |
@@ -63,6 +63,8 @@ namespace internal { |
V(VariableDeclaration) \ |
V(FunctionDeclaration) \ |
V(ModuleDeclaration) \ |
+ V(ImportDeclaration) \ |
+ V(ExportDeclaration) \ |
#define MODULE_NODE_LIST(V) \ |
V(ModuleLiteral) \ |
@@ -544,6 +546,48 @@ class ModuleDeclaration: public Declaration { |
}; |
+class ImportDeclaration: public Declaration { |
+ public: |
+ DECLARE_NODE_TYPE(ImportDeclaration) |
+ |
+ Module* module() const { return module_; } |
+ virtual InitializationFlag initialization() const { |
+ return kCreatedInitialized; |
+ } |
+ |
+ protected: |
+ template<class> friend class AstNodeFactory; |
+ |
+ ImportDeclaration(VariableProxy* proxy, |
+ Module* module, |
+ Scope* scope) |
+ : Declaration(proxy, LET, scope), |
+ module_(module) { |
+ } |
+ |
+ private: |
+ Module* module_; |
+}; |
+ |
+ |
+class ExportDeclaration: public Declaration { |
+ public: |
+ DECLARE_NODE_TYPE(ExportDeclaration) |
+ |
+ virtual InitializationFlag initialization() const { |
+ return kCreatedInitialized; |
+ } |
+ |
+ protected: |
+ template<class> friend class AstNodeFactory; |
+ |
+ ExportDeclaration(VariableProxy* proxy, |
+ Scope* scope) |
+ : Declaration(proxy, LET, scope) { |
+ } |
+}; |
+ |
+ |
class Module: public AstNode { |
// TODO(rossberg): stuff to come... |
protected: |
@@ -2580,6 +2624,21 @@ class AstNodeFactory BASE_EMBEDDED { |
VISIT_AND_RETURN(ModuleDeclaration, decl) |
} |
+ ImportDeclaration* NewImportDeclaration(VariableProxy* proxy, |
+ Module* module, |
+ Scope* scope) { |
+ ImportDeclaration* decl = |
+ new(zone_) ImportDeclaration(proxy, module, scope); |
+ VISIT_AND_RETURN(ImportDeclaration, decl) |
+ } |
+ |
+ ExportDeclaration* NewExportDeclaration(VariableProxy* proxy, |
+ Scope* scope) { |
+ ExportDeclaration* decl = |
+ new(zone_) ExportDeclaration(proxy, scope); |
+ VISIT_AND_RETURN(ExportDeclaration, decl) |
+ } |
+ |
ModuleLiteral* NewModuleLiteral(Block* body) { |
ModuleLiteral* module = new(zone_) ModuleLiteral(body); |
VISIT_AND_RETURN(ModuleLiteral, module) |