Index: src/ast.h |
diff --git a/src/ast.h b/src/ast.h |
index 802ac65962501dfa47db0f43f4e4de95c984a145..c83c490b099f9c64642fcc08110ebff1bd6f12a8 100644 |
--- a/src/ast.h |
+++ b/src/ast.h |
@@ -75,6 +75,7 @@ namespace internal { |
#define STATEMENT_NODE_LIST(V) \ |
V(Block) \ |
+ V(ModuleStatement) \ |
V(ExpressionStatement) \ |
V(EmptyStatement) \ |
V(IfStatement) \ |
@@ -522,7 +523,7 @@ class ModuleDeclaration: public Declaration { |
ModuleDeclaration(VariableProxy* proxy, |
Module* module, |
Scope* scope) |
- : Declaration(proxy, LET, scope), |
+ : Declaration(proxy, MODULE, scope), |
module_(module) { |
} |
@@ -645,6 +646,25 @@ class ModuleUrl: public Module { |
}; |
+class ModuleStatement: public Statement { |
+ public: |
+ DECLARE_NODE_TYPE(ModuleStatement) |
+ |
+ VariableProxy* proxy() const { return proxy_; } |
+ Block* body() const { return body_; } |
+ |
+ protected: |
+ ModuleStatement(VariableProxy* proxy, Block* body) |
+ : proxy_(proxy), |
+ body_(body) { |
+ } |
+ |
+ private: |
+ VariableProxy* proxy_; |
+ Block* body_; |
+}; |
+ |
+ |
class IterationStatement: public BreakableStatement { |
public: |
// Type testing & conversion. |
@@ -1417,7 +1437,7 @@ class VariableProxy: public Expression { |
void MarkAsTrivial() { is_trivial_ = true; } |
void MarkAsLValue() { is_lvalue_ = true; } |
- // Bind this proxy to the variable var. |
+ // Bind this proxy to the variable var. Interfaces must match. |
void BindTo(Variable* var); |
protected: |
@@ -2647,6 +2667,11 @@ class AstNodeFactory BASE_EMBEDDED { |
STATEMENT_WITH_LABELS(SwitchStatement) |
#undef STATEMENT_WITH_LABELS |
+ ModuleStatement* NewModuleStatement(VariableProxy* proxy, Block* body) { |
+ ModuleStatement* stmt = new(zone_) ModuleStatement(proxy, body); |
+ VISIT_AND_RETURN(ModuleStatement, stmt) |
+ } |
+ |
ExpressionStatement* NewExpressionStatement(Expression* expression) { |
ExpressionStatement* stmt = new(zone_) ExpressionStatement(expression); |
VISIT_AND_RETURN(ExpressionStatement, stmt) |