Change TIP creation
This commit is contained in:
parent
fc6040da39
commit
87d2edaaa6
@ -29,16 +29,6 @@ public class JavaTXCompiler {
|
|||||||
|
|
||||||
protected List<SourceFile> sourceFiles = new ArrayList<>();
|
protected List<SourceFile> sourceFiles = new ArrayList<>();
|
||||||
|
|
||||||
public List<TypeInsert> getTypeInserts(File forFile){
|
|
||||||
ResultSet result = typeInference();
|
|
||||||
for(SourceFile sf : sourceFiles){
|
|
||||||
if(sf.getFile().equals(forFile)){
|
|
||||||
return TypeInsertFactory.createTypeInsertPoints(sf, result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new DebugException("Die Datei "+forFile+" wurde nicht geparst");
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResultSet typeInference(){
|
public ResultSet typeInference(){
|
||||||
ConstraintSet<Pair> cons = new ConstraintSet<>();
|
ConstraintSet<Pair> cons = new ConstraintSet<>();
|
||||||
List<ClassOrInterface> allClasses = new ArrayList<>();
|
List<ClassOrInterface> allClasses = new ArrayList<>();
|
||||||
@ -82,8 +72,10 @@ public class JavaTXCompiler {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void parse(File sourceFile) throws IOException, ClassNotFoundException {
|
public SourceFile parse(File sourceFile) throws IOException, ClassNotFoundException {
|
||||||
sourceFiles.add(new JavaTXParser().parse(sourceFile));
|
SourceFile ret = new JavaTXParser().parse(sourceFile);
|
||||||
|
sourceFiles.add(ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
package typeinference;
|
package typeinference;
|
||||||
|
|
||||||
import de.dhbwstuttgart.core.JavaTXCompiler;
|
import de.dhbwstuttgart.core.JavaTXCompiler;
|
||||||
|
import de.dhbwstuttgart.exceptions.DebugException;
|
||||||
import de.dhbwstuttgart.parser.ClassNotFoundException;
|
import de.dhbwstuttgart.parser.ClassNotFoundException;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.SourceFile;
|
||||||
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||||
import de.dhbwstuttgart.syntaxtree.visual.ASTPrinter;
|
import de.dhbwstuttgart.syntaxtree.visual.ASTPrinter;
|
||||||
import de.dhbwstuttgart.syntaxtree.visual.ASTTypePrinter;
|
import de.dhbwstuttgart.syntaxtree.visual.ASTTypePrinter;
|
||||||
import de.dhbwstuttgart.syntaxtree.visual.OutputGenerator;
|
import de.dhbwstuttgart.syntaxtree.visual.OutputGenerator;
|
||||||
import de.dhbwstuttgart.typedeployment.TypeInsert;
|
import de.dhbwstuttgart.typedeployment.TypeInsert;
|
||||||
|
import de.dhbwstuttgart.typedeployment.TypeInsertFactory;
|
||||||
import de.dhbwstuttgart.typedeployment.TypeInsertPoint;
|
import de.dhbwstuttgart.typedeployment.TypeInsertPoint;
|
||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -30,8 +33,8 @@ public class JavaTXCompilerTest extends JavaTXCompiler {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test() throws IOException, ClassNotFoundException {
|
public void test() throws IOException, ClassNotFoundException {
|
||||||
filesToTest.add(new File(rootDirectory+"Faculty.jav"));
|
//filesToTest.add(new File(rootDirectory+"Faculty.jav"));
|
||||||
//filesToTest.add(new File(rootDirectory+"mathStruc.jav"));
|
filesToTest.add(new File(rootDirectory+"mathStruc.jav"));
|
||||||
//filesToTest.add(new File(rootDirectory+"Lambda.jav"));
|
//filesToTest.add(new File(rootDirectory+"Lambda.jav"));
|
||||||
//filesToTest.add(new File(rootDirectory+"Lambda2.jav"));
|
//filesToTest.add(new File(rootDirectory+"Lambda2.jav"));
|
||||||
//filesToTest.add(new File(rootDirectory+"Lambda3.jav"));
|
//filesToTest.add(new File(rootDirectory+"Lambda3.jav"));
|
||||||
@ -51,6 +54,16 @@ public class JavaTXCompilerTest extends JavaTXCompiler {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<TypeInsert> getTypeInserts(File forFile){
|
||||||
|
ResultSet result = typeInference();
|
||||||
|
for(SourceFile sf : sourceFiles){
|
||||||
|
if(sf.getFile().equals(forFile)){
|
||||||
|
return TypeInsertFactory.createTypeInsertPoints(sf, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new DebugException("Die Datei "+forFile+" wurde nicht geparst");
|
||||||
|
}
|
||||||
|
|
||||||
static String readFile(String path, Charset encoding)
|
static String readFile(String path, Charset encoding)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user