summaryrefslogtreecommitdiff
path: root/src/ast/nodes/ImportNode.java
diff options
context:
space:
mode:
authorgeno <gabriele.genovese2@studio.unibo.it>2024-06-30 13:36:37 +0200
committergeno <gabriele.genovese2@studio.unibo.it>2024-06-30 13:36:37 +0200
commitafff6a80cd58f7787efa1398f7c8cbdce8989323 (patch)
treee6021201d6e7049da640687c7ce61c898aaea4d8 /src/ast/nodes/ImportNode.java
parentaaa97e2e41c0aa17a6f99099dd39bb73a935fe02 (diff)
fixed warnings, better formatting, final added where possible
Diffstat (limited to 'src/ast/nodes/ImportNode.java')
-rw-r--r--src/ast/nodes/ImportNode.java19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/ast/nodes/ImportNode.java b/src/ast/nodes/ImportNode.java
index 900a909..7e95ee3 100644
--- a/src/ast/nodes/ImportNode.java
+++ b/src/ast/nodes/ImportNode.java
@@ -1,20 +1,20 @@
package ast.nodes;
+import ast.types.*;
import java.util.ArrayList;
-
import semanticanalysis.SemanticError;
import semanticanalysis.SymbolTable;
-import ast.types.*;
/**
* Node for the `import_stmt` statement of the grammar.
*/
public class ImportNode implements Node {
- private Node dottedName;
- private boolean isFrom;
- private boolean importAs;
- private boolean importAll;
- private ArrayList<String> names;
+
+ private final Node dottedName;
+ private final boolean isFrom;
+ private final boolean importAs;
+ private final boolean importAll;
+ private final ArrayList<String> names;
public ImportNode(Node dottedName, boolean isFrom, boolean importAs, boolean importAll,
ArrayList<String> names) {
@@ -27,7 +27,7 @@ public class ImportNode implements Node {
@Override
public ArrayList<SemanticError> checkSemantics(SymbolTable ST, int _nesting) {
- ArrayList<SemanticError> errors = new ArrayList<SemanticError>();
+ ArrayList<SemanticError> errors = new ArrayList();
if (isFrom) {
for (int i = 0; i < names.size(); ++i) {
@@ -75,8 +75,9 @@ public class ImportNode implements Node {
}
for (int i = 0; i < names.size(); ++i) {
- if (i == 0 && importAs)
+ if (i == 0 && importAs) {
continue;
+ }
str += prefix + names.get(i) + "\n";
}