Chromium Code Reviews| Index: runtime/vm/ast.h |
| =================================================================== |
| --- runtime/vm/ast.h (revision 473) |
| +++ runtime/vm/ast.h (working copy) |
| @@ -38,8 +38,6 @@ |
| V(ArgumentListNode, "args") \ |
| V(ArrayNode, "array") \ |
| V(ClosureNode, "closure") \ |
| - V(ImplicitInstanceClosureNode, "implicit instance closure") \ |
| - V(ImplicitStaticClosureNode, "implicit static closure") \ |
| V(InstanceCallNode, "instance call") \ |
| V(StaticCallNode, "static call") \ |
| V(ClosureCallNode, "closure call") \ |
| @@ -363,75 +361,38 @@ |
| class ClosureNode : public AstNode { |
| public: |
| - ClosureNode(intptr_t token_index, const Function& function, LocalScope* scope) |
| - : AstNode(token_index), function_(function), scope_(scope) { |
| + ClosureNode(intptr_t token_index, |
| + const Function& function, |
| + AstNode* receiver, // Receiver is for implicit instance closures. |
| + LocalScope* scope) // Scope is for non implicit closures only. |
| + : AstNode(token_index), |
| + function_(function), |
| + receiver_(receiver), |
| + scope_(scope) { |
| ASSERT(function.IsZoneHandle()); |
| - ASSERT(function.IsNonImplicitClosureFunction()); |
| - ASSERT(scope_ != NULL); |
| + ASSERT((scope_ != NULL) || !function.IsNonImplicitClosureFunction()); |
| + ASSERT((receiver_ != NULL) || |
| + !function.IsImplicitInstanceClosureFunction()); |
|
siva
2011/10/17 19:03:39
I am wondering if this would be more readable as:
regis
2011/10/17 20:19:28
Done.
|
| } |
| const Function& function() const { return function_; } |
| + AstNode* receiver() const { return receiver_; } |
| LocalScope* scope() const { return scope_; } |
| - virtual void VisitChildren(AstNodeVisitor* visitor) const { } |
| - |
| - DECLARE_COMMON_NODE_FUNCTIONS(ClosureNode); |
| - |
| - private: |
| - const Function& function_; |
| - LocalScope* scope_; |
| - |
| - DISALLOW_IMPLICIT_CONSTRUCTORS(ClosureNode); |
| -}; |
| - |
| - |
| -class ImplicitStaticClosureNode : public AstNode { |
| - public: |
| - ImplicitStaticClosureNode(intptr_t token_index, const Function& function) |
| - : AstNode(token_index), function_(function) { |
| - ASSERT(function.IsZoneHandle()); |
| - ASSERT(function.IsImplicitStaticClosureFunction()); |
| - } |
| - |
| - const Function& function() const { return function_; } |
| - |
| - virtual void VisitChildren(AstNodeVisitor* visitor) const { } |
| - |
| - DECLARE_COMMON_NODE_FUNCTIONS(ImplicitStaticClosureNode); |
| - |
| - private: |
| - const Function& function_; |
| - |
| - DISALLOW_IMPLICIT_CONSTRUCTORS(ImplicitStaticClosureNode); |
| -}; |
| - |
| - |
| -class ImplicitInstanceClosureNode : public AstNode { |
| - public: |
| - ImplicitInstanceClosureNode(intptr_t token_index, |
| - const Function& function, |
| - AstNode* receiver) |
| - : AstNode(token_index), function_(function), receiver_(receiver) { |
| - ASSERT(function.IsZoneHandle()); |
| - ASSERT(function.IsImplicitInstanceClosureFunction()); |
| - } |
| - |
| - const Function& function() const { return function_; } |
| - AstNode* receiver() const { return receiver_; } |
| - |
| virtual void VisitChildren(AstNodeVisitor* visitor) const { |
| if (receiver() != NULL) { |
| receiver()->Visit(visitor); |
| } |
| } |
| - DECLARE_COMMON_NODE_FUNCTIONS(ImplicitInstanceClosureNode); |
| + DECLARE_COMMON_NODE_FUNCTIONS(ClosureNode); |
| private: |
| const Function& function_; |
| AstNode* receiver_; |
| + LocalScope* scope_; |
| - DISALLOW_IMPLICIT_CONSTRUCTORS(ImplicitInstanceClosureNode); |
| + DISALLOW_IMPLICIT_CONSTRUCTORS(ClosureNode); |
| }; |