diff options
| author | geno <gabriele.genovese2@studio.unibo.it> | 2024-06-26 12:53:05 +0000 |
|---|---|---|
| committer | geno <gabriele.genovese2@studio.unibo.it> | 2024-06-26 12:53:05 +0000 |
| commit | 06671f5aed68753435a762bc3be43e83094156d1 (patch) | |
| tree | 56f251596cf57f6f13a7921e7dad6e795989329d /src/ast/types/FunctionType.java | |
| parent | e09358f3648445bbf9747f40497af6221d933a99 (diff) | |
exercise 1 completed
1.b now works
1.c implened error for "function takes N positional arguments but M were given"
Diffstat (limited to 'src/ast/types/FunctionType.java')
| -rw-r--r-- | src/ast/types/FunctionType.java | 27 |
1 files changed, 27 insertions, 0 deletions
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"; + } +} |
