From 37665fb6d0bc1eb29396ae949354cf7d6f9d54ca Mon Sep 17 00:00:00 2001 From: geno Date: Fri, 28 Jun 2024 12:23:28 +0200 Subject: resolving all the comments santo made --- src/ast/nodes/TestlistCompNode.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/ast/nodes/TestlistCompNode.java') 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 exprs; - private final CompForNode comp; + private ArrayList exprs; + private CompForNode comp; public TestlistCompNode(ArrayList 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); } -- cgit v1.2.3-18-g5258