summaryrefslogtreecommitdiff
path: root/src/ast/nodes/ParamlistNode.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/ast/nodes/ParamlistNode.java')
-rw-r--r--src/ast/nodes/ParamlistNode.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/ast/nodes/ParamlistNode.java b/src/ast/nodes/ParamlistNode.java
index 144eb13..cf75d08 100644
--- a/src/ast/nodes/ParamlistNode.java
+++ b/src/ast/nodes/ParamlistNode.java
@@ -1,16 +1,16 @@
package ast.nodes;
+import ast.types.*;
import java.util.ArrayList;
-
import semanticanalysis.SemanticError;
import semanticanalysis.SymbolTable;
-import ast.types.*;
/**
* Node for the `param_list` statement of the grammar.
*/
public class ParamlistNode implements Node {
- private ArrayList<Node> params;
+
+ private final ArrayList<Node> params;
public ParamlistNode(ArrayList<Node> _params) {
params = _params;
@@ -18,7 +18,7 @@ public class ParamlistNode implements Node {
@Override
public ArrayList<SemanticError> checkSemantics(SymbolTable ST, int _nesting) {
- ArrayList<SemanticError> errors = new ArrayList<SemanticError>();
+ ArrayList<SemanticError> errors = new ArrayList();
for (var param : params) {
errors.addAll(param.checkSemantics(ST, _nesting));
@@ -27,6 +27,10 @@ public class ParamlistNode implements Node {
return errors;
}
+ public int getParamNumber() {
+ return params.size();
+ }
+
@Override
public Type typeCheck() {
return new VoidType();