diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-04-17 15:47:28 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-04-17 15:47:28 +0100 |
| commit | a5f76463dfc74d9b126f65416a51905a995c711d (patch) | |
| tree | b1f1970250c5d8fb080c5d2f888d411b95ea68be /src/main/java/org/zwobble/couscous/ast/ExceptionHandlerNode.java | |
| parent | ac60bfdc353f27253282224f5bc6b34b587643f0 (diff) | |
C# serializer: serialize try statements
Diffstat (limited to 'src/main/java/org/zwobble/couscous/ast/ExceptionHandlerNode.java')
| -rw-r--r-- | src/main/java/org/zwobble/couscous/ast/ExceptionHandlerNode.java | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/main/java/org/zwobble/couscous/ast/ExceptionHandlerNode.java b/src/main/java/org/zwobble/couscous/ast/ExceptionHandlerNode.java index a7e307b..5e80fcf 100644 --- a/src/main/java/org/zwobble/couscous/ast/ExceptionHandlerNode.java +++ b/src/main/java/org/zwobble/couscous/ast/ExceptionHandlerNode.java @@ -5,30 +5,38 @@ import org.zwobble.couscous.types.Type; import java.util.List; public class ExceptionHandlerNode { - public static ExceptionHandlerNode exceptionhandler(Type type, List<StatementNode> body) { - return new ExceptionHandlerNode(type, body); + public static ExceptionHandlerNode exceptionhandler(VariableDeclaration declaration, List<StatementNode> body) { + return new ExceptionHandlerNode(declaration, body); } - private final Type type; + private final VariableDeclaration declaration; private final List<StatementNode> body; - public ExceptionHandlerNode(Type type, List<StatementNode> body) { - this.type = type; + public ExceptionHandlerNode(VariableDeclaration declaration, List<StatementNode> body) { + this.declaration = declaration; this.body = body; } - public Type getExceptionType() { - return type; + public VariableDeclaration getDeclaration() { + return declaration; } public List<StatementNode> getBody() { return body; } + public Type getExceptionType() { + return declaration.getType(); + } + + public String getExceptionName() { + return declaration.getName(); + } + @Override public String toString() { return "ExceptionHandlerNode(" + - "type=" + type + + "declaration=" + declaration + ", body=" + body + ')'; } @@ -40,14 +48,14 @@ public class ExceptionHandlerNode { ExceptionHandlerNode that = (ExceptionHandlerNode) o; - if (!type.equals(that.type)) return false; + if (!declaration.equals(that.declaration)) return false; return body.equals(that.body); } @Override public int hashCode() { - int result = type.hashCode(); + int result = declaration.hashCode(); result = 31 * result + body.hashCode(); return result; } |
