diff options
| author | Geno <48206120+gabrielegenovese@users.noreply.github.com> | 2024-07-11 10:57:56 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-11 10:57:56 +0000 |
| commit | b50c7e99603e9f85d82d700d62c16c4fcef88715 (patch) | |
| tree | 5052206f06e0426a43599cb236652614db04d22e /src/ast/types/FunctionType.java | |
| parent | f0692ff5f9e39cbd1c203e9d5abebf55a3d0f6fc (diff) | |
Code generation (#20)
Co-authored-by: geno <gabrigeno@gmail>
Co-authored-by: Santo Cariotti <santo@dcariotti.me>
Diffstat (limited to 'src/ast/types/FunctionType.java')
| -rw-r--r-- | src/ast/types/FunctionType.java | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/ast/types/FunctionType.java b/src/ast/types/FunctionType.java index 5e6adaa..1a04bb6 100644 --- a/src/ast/types/FunctionType.java +++ b/src/ast/types/FunctionType.java @@ -7,13 +7,25 @@ public class FunctionType extends Type { private final int paramNumber; private final Type returnType; + private final String label; + private int localvarNum; - public FunctionType(int paramNumber, Type returnType) { + public FunctionType(int paramNumber, Type returnType, String label) { this.paramNumber = paramNumber; this.returnType = returnType; + this.label = label; + this.localvarNum = 0; } - // Return the length of the parameters + public void addLocalVar() { + localvarNum++; + } + + public int getLocalvarNum() { + return localvarNum; + } + + // Return the number of the parameters public int getParamNumber() { return paramNumber; } @@ -22,8 +34,17 @@ public class FunctionType extends Type { return returnType; } + public String getLabel() { + return label; + } + @Override public String toPrint(String prefix) { return prefix + "Function\n"; } + + @Override + public String toString() { + return "NP: " + paramNumber + " RT: " + returnType + " L: " + label; + } } |
