diff options
| author | Michael Williamson <mike@zwobble.org> | 2015-10-05 22:26:29 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2015-10-05 22:26:29 +0100 |
| commit | 166a205aeb4c595b40b8ffe4c7d745b13031e3b3 (patch) | |
| tree | aa493482f4ca312c1f23913ebc2f57b71d8aa590 /src/main/java/org/zwobble/couscous/ast/StatementNode.java | |
| parent | 44e4b877baea47c0465e1029bdbedc848381999f (diff) | |
Add support for static method calls to Python backend
Diffstat (limited to 'src/main/java/org/zwobble/couscous/ast/StatementNode.java')
| -rw-r--r-- | src/main/java/org/zwobble/couscous/ast/StatementNode.java | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/main/java/org/zwobble/couscous/ast/StatementNode.java b/src/main/java/org/zwobble/couscous/ast/StatementNode.java index 773420e..7a1b25b 100644 --- a/src/main/java/org/zwobble/couscous/ast/StatementNode.java +++ b/src/main/java/org/zwobble/couscous/ast/StatementNode.java @@ -1,7 +1,32 @@ package org.zwobble.couscous.ast; -import org.zwobble.couscous.ast.visitors.StatementNodeVisitor; +import org.zwobble.couscous.ast.visitors.NodeVisitor; +import org.zwobble.couscous.ast.visitors.StatementNodeMapper; -public interface StatementNode { - <T> T accept(StatementNodeVisitor<T> visitor); +public interface StatementNode extends Node { + <T> T accept(StatementNodeMapper<T> visitor); + + @Override + default void accept(NodeVisitor visitor) { + accept(new StatementNodeMapper<Void>() { + @Override + public Void visit(ReturnNode returnNode) { + visitor.visit(returnNode); + return null; + } + + @Override + public Void visit(ExpressionStatementNode expressionStatement) { + visitor.visit(expressionStatement); + return null; + } + + @Override + public Void visit( + LocalVariableDeclarationNode localVariableDeclaration) { + visitor.visit(localVariableDeclaration); + return null; + } + }); + } } |
