From 06671f5aed68753435a762bc3be43e83094156d1 Mon Sep 17 00:00:00 2001 From: geno Date: Wed, 26 Jun 2024 14:53:05 +0200 Subject: exercise 1 completed 1.b now works 1.c implened error for "function takes N positional arguments but M were given" --- src/ast/types/FunctionType.java | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/ast/types/FunctionType.java (limited to 'src/ast/types/FunctionType.java') diff --git a/src/ast/types/FunctionType.java b/src/ast/types/FunctionType.java new file mode 100644 index 0000000..464bb9c --- /dev/null +++ b/src/ast/types/FunctionType.java @@ -0,0 +1,27 @@ +package ast.types; + +/** + * An tom type. TODO: do I need to use this one? + */ +public class FunctionType extends Type { + + private final int paramNumber; + private final Type returnType; + + public FunctionType(int paramNumber, Type returnType) { + this.paramNumber = paramNumber; + this.returnType = returnType; + } + + public int getParamNumber() { + return paramNumber; + } + + public Type getReturnType() { + return returnType; + } + + public String toPrint(String prefix) { + return prefix + "Atom\n"; + } +} -- cgit v1.2.3-71-g8e6c