From 23b6f865aad683d7f3590c46aa4b74f0a030f6af Mon Sep 17 00:00:00 2001 From: bd-912 Date: Sun, 31 Mar 2024 23:04:35 -0600 Subject: Added argument+parameter storing for methods to SymbolTable --- st/MethodInstance.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'st/MethodInstance.java') diff --git a/st/MethodInstance.java b/st/MethodInstance.java index c0082af..11b233b 100644 --- a/st/MethodInstance.java +++ b/st/MethodInstance.java @@ -3,22 +3,29 @@ package st; import java.util.ArrayList; public class MethodInstance extends AbstractInstance { - private ArrayList args; // the list of arguments - private TypeEnum rtrn; // the returned type + private ArrayList args; // the list of arguments + private ArrayList lvars; // the list of local variables + private TypeEnum rtrn; // the returned type public MethodInstance(String name, TypeEnum rtrn) { super(name, TypeEnum.method); + this.lvars = new ArrayList<>(); this.args = new ArrayList<>(); this.rtrn = rtrn; } public String toString() { - return name + ":" + type + "[" + - this.rtrn + "]"; + return name + ":T[" + type + "]R[" + + this.rtrn + "]P[" + this.args.toString() + + "]V[" + this.lvars.toString() + "]"; } - public void add_argument(TypeEnum arg) { - this.args.add(arg); + public void set_args(ArrayList args) { + this.args = args; + } + + public void set_locals(ArrayList lvars) { + this.lvars = lvars; } } -- cgit v1.2.3