summaryrefslogtreecommitdiff
path: root/src/ast/nodes/ExprListNode.java
diff options
context:
space:
mode:
authorgeno <gabriele.genovese2@studio.unibo.it>2024-06-28 12:23:28 +0200
committergeno <gabriele.genovese2@studio.unibo.it>2024-06-28 12:23:28 +0200
commit37665fb6d0bc1eb29396ae949354cf7d6f9d54ca (patch)
tree058204d723fb31b3b30bf8d141cf621c6f42c0c6 /src/ast/nodes/ExprListNode.java
parent1d5c4862e136419ab1ed3fcf8d8edaa0ee5fda10 (diff)
resolving all the comments santo made
Diffstat (limited to 'src/ast/nodes/ExprListNode.java')
-rw-r--r--src/ast/nodes/ExprListNode.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ast/nodes/ExprListNode.java b/src/ast/nodes/ExprListNode.java
index acdf679..800f4be 100644
--- a/src/ast/nodes/ExprListNode.java
+++ b/src/ast/nodes/ExprListNode.java
@@ -31,7 +31,14 @@ public class ExprListNode implements Node {
return exprs.size();
}
+ /**
+ * Returns the i-th expressions of `exprs` field. If the index is greater or
+ * equals than the size return `null`.
+ */
public Node getElem(int i) {
+ if (i >= this.exprs.size()) {
+ return null;
+ }
return exprs.get(i);
}
@@ -48,7 +55,7 @@ public class ExprListNode implements Node {
@Override
public String toPrint(String prefix) {
- String str = prefix + "Paramlist\n";
+ String str = prefix + "ExprList\n";
prefix += " ";
for (var param : exprs) {