diff --git a/src/main/java/de/dhbwstuttgart/syntaxtree/statement/Block.java b/src/main/java/de/dhbwstuttgart/syntaxtree/statement/Block.java index bc35364b..3cbcea38 100644 --- a/src/main/java/de/dhbwstuttgart/syntaxtree/statement/Block.java +++ b/src/main/java/de/dhbwstuttgart/syntaxtree/statement/Block.java @@ -1,12 +1,12 @@ package de.dhbwstuttgart.syntaxtree.statement; -import java.util.*; +import java.util.ArrayList; +import java.util.List; + +import org.antlr.v4.runtime.Token; import de.dhbwstuttgart.syntaxtree.StatementVisitor; import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; -import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation; -import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; -import org.antlr.v4.runtime.Token; public class Block extends Statement { public Block(List statements, Token offset) { diff --git a/src/main/java/de/dhbwstuttgart/syntaxtree/statement/InstanceOf.java b/src/main/java/de/dhbwstuttgart/syntaxtree/statement/InstanceOf.java index 7b9e0555..55d5e6da 100644 --- a/src/main/java/de/dhbwstuttgart/syntaxtree/statement/InstanceOf.java +++ b/src/main/java/de/dhbwstuttgart/syntaxtree/statement/InstanceOf.java @@ -7,26 +7,28 @@ import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; public class InstanceOf extends BinaryExpr { - private RefTypeOrTPHOrWildcardOrGeneric reftype; - private String name = null; + private Pattern pattern; public InstanceOf(Expression expr, RefTypeOrTPHOrWildcardOrGeneric reftype, Token offset) { super(BinaryExpr.Operator.INSTOF, TypePlaceholder.fresh(offset), expr, new LocalVar("", reftype, reftype.getOffset()), offset); - this.reftype = reftype; + this.pattern = new Pattern(null, reftype, offset); } public InstanceOf(Expression expr, Pattern pattern, Token offset) { super(BinaryExpr.Operator.INSTOF, TypePlaceholder.fresh(offset), expr, new LocalVar(pattern.getName(), pattern.getType(), pattern.getOffset()), offset); - this.reftype = pattern.getType(); - this.name = pattern.getName(); + this.pattern = pattern; } public RefTypeOrTPHOrWildcardOrGeneric getReftype() { - return reftype; + return pattern.getType(); } public String getName() { - return name; + return pattern.getName(); + } + + public Pattern gPattern() { + return pattern; } @Override diff --git a/src/test/java/syntaxtreegenerator/TestComplete.java b/src/test/java/syntaxtreegenerator/TestComplete.java index e60f01d8..9d538415 100644 --- a/src/test/java/syntaxtreegenerator/TestComplete.java +++ b/src/test/java/syntaxtreegenerator/TestComplete.java @@ -7,6 +7,9 @@ import static org.junit.Assert.fail; import java.io.File; import java.io.FileFilter; import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.ObjectOutputStream; +import java.util.ArrayList; import java.util.HashMap; import org.junit.BeforeClass; @@ -14,6 +17,7 @@ import org.junit.Test; import de.dhbwstuttgart.core.JavaTXCompiler; import de.dhbwstuttgart.exceptions.NotImplementedException; +import de.dhbwstuttgart.syntaxtree.SourceFile; import de.dhbwstuttgart.syntaxtree.visual.ASTPrinter; /**