summaryrefslogtreecommitdiff
path: root/src/ast/nodes/ExprListNode.java
diff options
context:
space:
mode:
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) {