summaryrefslogtreecommitdiffstats
path: root/src/ast/types/FunctionType.java
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2024-06-30 11:45:57 +0000
committerGitHub <noreply@github.com>2024-06-30 11:45:57 +0000
commit8aa8b5834953cab15c0687608f4fafea2e6c61be (patch)
tree1835ae7c789136b4a6c44c12efd4247a0b96d893 /src/ast/types/FunctionType.java
parent7125bb27fedaafd5a56b5122e4251b182448ddac (diff)
parent06d7c8dee25c065b1a569337f34d3cd5e892a31d (diff)
Merge pull request #10 from boozec/check-semantics
Co-Authored-By: geno <gabriele.genovese2@studio.unibo.it> Co-Authored-By: L0P0P <grassoemanuele@live.com>
Diffstat (limited to 'src/ast/types/FunctionType.java')
-rw-r--r--src/ast/types/FunctionType.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/ast/types/FunctionType.java b/src/ast/types/FunctionType.java
new file mode 100644
index 0000000..5e6adaa
--- /dev/null
+++ b/src/ast/types/FunctionType.java
@@ -0,0 +1,29 @@
+package ast.types;
+
+/**
+ * A Function type.
+ */
+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;
+ }
+
+ // Return the length of the parameters
+ public int getParamNumber() {
+ return paramNumber;
+ }
+
+ public Type getReturnType() {
+ return returnType;
+ }
+
+ @Override
+ public String toPrint(String prefix) {
+ return prefix + "Function\n";
+ }
+}