Fehler in TypeStmt beheben
This commit is contained in:
parent
201a0978bc
commit
f81496fe1f
9
src/de/dhbwstuttgart/core/CompilationEnvironment.java
Normal file
9
src/de/dhbwstuttgart/core/CompilationEnvironment.java
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
package de.dhbwstuttgart.core;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stellt die Java-Environment dar
|
||||||
|
* Speichert alle Typen, Klassen aus den benutzen SourceFiles und Librarys
|
||||||
|
*/
|
||||||
|
public class CompilationEnvironment {
|
||||||
|
|
||||||
|
}
|
@ -22,7 +22,11 @@ import java.util.stream.Collectors;
|
|||||||
public class JavaTXCompiler {
|
public class JavaTXCompiler {
|
||||||
|
|
||||||
protected List<SourceFile> sourceFiles = new ArrayList<>();
|
protected List<SourceFile> sourceFiles = new ArrayList<>();
|
||||||
|
/*
|
||||||
|
public JavaTXCompiler(List<File> sourceFiles){
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
public List<ResultSet> typeInference(){
|
public List<ResultSet> typeInference(){
|
||||||
List<ClassOrInterface> allClasses = new ArrayList<>();
|
List<ClassOrInterface> allClasses = new ArrayList<>();
|
||||||
for(SourceFile sf : sourceFiles){
|
for(SourceFile sf : sourceFiles){
|
||||||
|
@ -210,7 +210,7 @@ public class SyntaxTreeGenerator{
|
|||||||
String name = header.methodDeclarator().Identifier().getText();
|
String name = header.methodDeclarator().Identifier().getText();
|
||||||
GenericDeclarationList gtvDeclarations = new GenericDeclarationList(new ArrayList<>(), header.getStart());
|
GenericDeclarationList gtvDeclarations = new GenericDeclarationList(new ArrayList<>(), header.getStart());
|
||||||
if(header.typeParameters() != null){
|
if(header.typeParameters() != null){
|
||||||
gtvDeclarations = TypeGenerator.convert(header.typeParameters(), parentClass, name,reg, localGenerics);
|
gtvDeclarations = TypeGenerator.convert(header.typeParameters(), parentClass, name, reg, localGenerics);
|
||||||
}else{
|
}else{
|
||||||
gtvDeclarations = new GenericDeclarationList(new ArrayList<>(), header.getStart());
|
gtvDeclarations = new GenericDeclarationList(new ArrayList<>(), header.getStart());
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,7 @@ class Resolver implements ResultSetVisitor {
|
|||||||
resultPair.accept(this);
|
resultPair.accept(this);
|
||||||
}
|
}
|
||||||
if(resolved==null){//TPH kommt nicht im Result vor:
|
if(resolved==null){//TPH kommt nicht im Result vor:
|
||||||
|
resolved = tph;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ResolvedType(resolved, additionalTPHs);//resolved;
|
return new ResolvedType(resolved, additionalTPHs);//resolved;
|
||||||
|
@ -260,6 +260,7 @@ public class TYPEStmt implements StatementVisitor{
|
|||||||
protected Set<Pair> generateParameterConstraints(MethodCall foMethod, MethodAssumption assumption, TypeInferenceBlockInformation info) {
|
protected Set<Pair> generateParameterConstraints(MethodCall foMethod, MethodAssumption assumption, TypeInferenceBlockInformation info) {
|
||||||
Set<Pair> ret = new HashSet<>();
|
Set<Pair> ret = new HashSet<>();
|
||||||
for(int i = 0;i<foMethod.arglist.getArguments().size();i++){
|
for(int i = 0;i<foMethod.arglist.getArguments().size();i++){
|
||||||
|
foMethod.arglist.getArguments().get(i).accept(this);
|
||||||
ret.add(ConstraintsFactory.createPair(foMethod.arglist.getArguments().get(i).getType(),
|
ret.add(ConstraintsFactory.createPair(foMethod.arglist.getArguments().get(i).getType(),
|
||||||
assumption.getArgTypes().get(i), PairOperator.SMALLERDOT, info));
|
assumption.getArgTypes().get(i), PairOperator.SMALLERDOT, info));
|
||||||
}
|
}
|
||||||
@ -293,7 +294,7 @@ public class TYPEStmt implements StatementVisitor{
|
|||||||
return getMethods(name, arglist.getArguments().size(), info);
|
return getMethods(name, arglist.getArguments().size(), info);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static List<RefTypeOrTPHOrWildcardOrGeneric> convertParams(ParameterList parameterList, TypeInferenceBlockInformation info){
|
protected static List<RefTypeOrTPHOrWildcardOrGeneric> convertParams(ParameterList parameterList, TypeInferenceBlockInformation info){
|
||||||
List<RefTypeOrTPHOrWildcardOrGeneric> params = new ArrayList<>();
|
List<RefTypeOrTPHOrWildcardOrGeneric> params = new ArrayList<>();
|
||||||
for(FormalParameter fp : parameterList.getFormalparalist()){
|
for(FormalParameter fp : parameterList.getFormalparalist()){
|
||||||
params.add(info.checkGTV(fp.getType()));
|
params.add(info.checkGTV(fp.getType()));
|
||||||
|
@ -47,7 +47,6 @@ public class JavaTXCompilerTest extends JavaTXCompiler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static String readFile(String path, Charset encoding)
|
static String readFile(String path, Charset encoding)
|
||||||
|
Loading…
Reference in New Issue
Block a user