summaryrefslogtreecommitdiff
path: root/src/ast/nodes/TestlistCompNode.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/ast/nodes/TestlistCompNode.java')
-rw-r--r--src/ast/nodes/TestlistCompNode.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/ast/nodes/TestlistCompNode.java b/src/ast/nodes/TestlistCompNode.java
index 4ae77c9..244f4ef 100644
--- a/src/ast/nodes/TestlistCompNode.java
+++ b/src/ast/nodes/TestlistCompNode.java
@@ -10,8 +10,8 @@ import semanticanalysis.SymbolTable;
*/
public class TestlistCompNode implements Node {
- private final ArrayList<Node> exprs;
- private final CompForNode comp;
+ private ArrayList<Node> exprs;
+ private CompForNode comp;
public TestlistCompNode(ArrayList<Node> exprs, Node comp) {
this.exprs = exprs;
@@ -45,7 +45,14 @@ public class TestlistCompNode 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);
}