summaryrefslogtreecommitdiff
path: root/src/ast/nodes/ArglistNode.java
diff options
context:
space:
mode:
authorEmanuele Grasso <96300448+L0P0P@users.noreply.github.com>2024-07-14 18:48:09 +0200
committerGitHub <noreply@github.com>2024-07-14 18:48:09 +0200
commitce49d20a5fe3726e1800bc495a25c7617212abf4 (patch)
tree5a1a79efa79e7bf6dcf3d3151aec2edf6a47b3e7 /src/ast/nodes/ArglistNode.java
parent57599a42b863cc48050c137de2ec108aa1d59a44 (diff)
Reaching definition analysis (#17)
Co-authored-by: Santo Cariotti <santo@dcariotti.me> Co-authored-by: geno <gabriele.genovese2@studio.unibo.it> Co-authored-by: geno <gabrigeno@gmail.com>
Diffstat (limited to 'src/ast/nodes/ArglistNode.java')
-rw-r--r--src/ast/nodes/ArglistNode.java20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/ast/nodes/ArglistNode.java b/src/ast/nodes/ArglistNode.java
index 5da7e2c..4b7b292 100644
--- a/src/ast/nodes/ArglistNode.java
+++ b/src/ast/nodes/ArglistNode.java
@@ -1,6 +1,7 @@
package ast.nodes;
import ast.types.*;
+
import java.util.ArrayList;
import java.util.Arrays;
import semanticanalysis.SemanticError;
@@ -27,7 +28,6 @@ public class ArglistNode implements Node {
String argName = argExpr.getId();
errors.addAll(arg.checkSemantics(ST, _nesting, ft));
- // TODO: check IntType for params
if (argName != null) {
if (Arrays.asList(bif).contains(argName)) {
continue;
@@ -66,12 +66,26 @@ public class ArglistNode implements Node {
}
@Override
- public String toPrint(String prefix) {
+ public String printAST(String prefix) {
String str = prefix + "ArglistNode\n";
prefix += " ";
for (Node arg : arguments) {
- str += arg.toPrint(prefix);
+ str += arg.printAST(prefix);
+ }
+
+ return str;
+ }
+
+ @Override
+ public String toPrint(String prefix) {
+ String str = prefix;
+ str += arguments.get(0).toPrint("");
+
+ if (arguments.size() > 1) {
+ for (int i = 1; i < arguments.size(); i++) {
+ str += ", " + arguments.get(i).toPrint("");
+ }
}
return str;