Chromium Code Reviews| Index: src/ast.h |
| diff --git a/src/ast.h b/src/ast.h |
| index 5398775483ec7c9766922d27c6f7e024bc6f6b4e..609ccc5c5d6bee878b03dbb8538e1b4bb61aa59b 100644 |
| --- a/src/ast.h |
| +++ b/src/ast.h |
| @@ -41,6 +41,7 @@ |
| #include "token.h" |
| #include "utils.h" |
| #include "variables.h" |
| +#include "interface.h" |
| #include "zone-inl.h" |
| namespace v8 { |
| @@ -589,9 +590,15 @@ class ExportDeclaration: public Declaration { |
| class Module: public AstNode { |
| - // TODO(rossberg): stuff to come... |
| + public: |
| + Interface* interface() const { return interface_; } |
| + |
| protected: |
| - Module() {} |
| + Module() : interface_(Interface::NewModule()) {} |
| + explicit Module(Interface* interface) : interface_(interface) {} |
| + |
| + private: |
| + Interface* interface_; |
| }; |
| @@ -604,8 +611,9 @@ class ModuleLiteral: public Module { |
| protected: |
| template<class> friend class AstNodeFactory; |
| - explicit ModuleLiteral(Block* body) |
| - : body_(body) { |
| + explicit ModuleLiteral(Block* body, Interface* interface) |
|
Sven Panne
2012/03/08 08:55:00
Remove "explicit".
rossberg
2012/03/08 10:47:06
Done.
|
| + : Module(interface), |
| + body_(body) { |
| } |
| private: |
| @@ -622,9 +630,7 @@ class ModuleVariable: public Module { |
| protected: |
| template<class> friend class AstNodeFactory; |
| - explicit ModuleVariable(VariableProxy* proxy) |
| - : proxy_(proxy) { |
| - } |
| + inline explicit ModuleVariable(VariableProxy* proxy); |
| private: |
| VariableProxy* proxy_; |
| @@ -1451,6 +1457,8 @@ class VariableProxy: public Expression { |
| Variable* var() const { return var_; } |
| bool is_this() const { return is_this_; } |
| int position() const { return position_; } |
| + Interface* interface() const { return interface_; } |
| + |
| void MarkAsTrivial() { is_trivial_ = true; } |
| void MarkAsLValue() { is_lvalue_ = true; } |
| @@ -1466,7 +1474,8 @@ class VariableProxy: public Expression { |
| VariableProxy(Isolate* isolate, |
| Handle<String> name, |
| bool is_this, |
| - int position); |
| + int position, |
| + Interface* interface); |
| Handle<String> name_; |
| Variable* var_; // resolved variable, or NULL |
| @@ -1476,6 +1485,7 @@ class VariableProxy: public Expression { |
| // or with a increment/decrement operator. |
| bool is_lvalue_; |
| int position_; |
| + Interface* interface_; |
| }; |
| @@ -2506,6 +2516,15 @@ class RegExpEmpty: public RegExpTree { |
| // ---------------------------------------------------------------------------- |
| +// Out-of-line inline constructors. |
|
Sven Panne
2012/03/08 08:55:00
I guess this here for cyclic dependencies reasons,
rossberg
2012/03/08 10:47:06
Done.
|
| + |
| +inline ModuleVariable::ModuleVariable(VariableProxy* proxy) |
| + : Module(proxy->interface()), |
| + proxy_(proxy) { |
| +} |
| + |
| + |
| +// ---------------------------------------------------------------------------- |
| // Basic visitor |
| // - leaf node visitors are abstract. |
| @@ -2639,8 +2658,8 @@ class AstNodeFactory BASE_EMBEDDED { |
| VISIT_AND_RETURN(ExportDeclaration, decl) |
| } |
| - ModuleLiteral* NewModuleLiteral(Block* body) { |
| - ModuleLiteral* module = new(zone_) ModuleLiteral(body); |
| + ModuleLiteral* NewModuleLiteral(Block* body, Interface* interface) { |
| + ModuleLiteral* module = new(zone_) ModuleLiteral(body, interface); |
| VISIT_AND_RETURN(ModuleLiteral, module) |
| } |
| @@ -2796,9 +2815,11 @@ class AstNodeFactory BASE_EMBEDDED { |
| VariableProxy* NewVariableProxy(Handle<String> name, |
| bool is_this, |
| - int position = RelocInfo::kNoPosition) { |
| + int position = RelocInfo::kNoPosition, |
| + Interface* interface = |
| + Interface::NewValue()) { |
| VariableProxy* proxy = |
| - new(zone_) VariableProxy(isolate_, name, is_this, position); |
| + new(zone_) VariableProxy(isolate_, name, is_this, position, interface); |
| VISIT_AND_RETURN(VariableProxy, proxy) |
| } |