From 166a205aeb4c595b40b8ffe4c7d745b13031e3b3 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Mon, 5 Oct 2015 22:26:29 +0100 Subject: Add support for static method calls to Python backend --- .../org/zwobble/couscous/ast/StatementNode.java | 31 +++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'src/main/java/org/zwobble/couscous/ast/StatementNode.java') 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 accept(StatementNodeVisitor visitor); +public interface StatementNode extends Node { + T accept(StatementNodeMapper visitor); + + @Override + default void accept(NodeVisitor visitor) { + accept(new StatementNodeMapper() { + @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; + } + }); + } } -- cgit v1.2.3