forked from JavaTX/JavaCompilerCore
Bug im convert(Feld) gefixt
This commit is contained in:
parent
47f1f9ad54
commit
c480e25805
@ -10,6 +10,7 @@ import de.dhbwstuttgart.syntaxtree.factory.ASTFactory;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.*;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
import de.dhbwstuttgart.typecheck.*;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
@ -265,7 +266,12 @@ public class SyntaxTreeGenerator{
|
||||
for(Java8Parser.FieldModifierContext fieldModifierContext : fieldDeclarationContext.fieldModifier()){
|
||||
modifiers+=(convert(fieldModifierContext));
|
||||
}
|
||||
RefTypeOrTPHOrWildcardOrGeneric fieldType = TypeGenerator.convert(fieldDeclarationContext.unannType(), reg, generics);
|
||||
RefTypeOrTPHOrWildcardOrGeneric fieldType;
|
||||
if(fieldDeclarationContext.unannType() != null){
|
||||
fieldType = TypeGenerator.convert(fieldDeclarationContext.unannType(), reg, generics);
|
||||
}else{
|
||||
fieldType = TypePlaceholder.fresh(fieldDeclarationContext.getStart());
|
||||
}
|
||||
for(Java8Parser.VariableDeclaratorContext varCtx : fieldDeclarationContext.variableDeclaratorList().variableDeclarator()){
|
||||
String fieldName = convert(varCtx.variableDeclaratorId());
|
||||
if(varCtx.variableInitializer() != null){
|
||||
|
@ -10,6 +10,7 @@ import de.dhbwstuttgart.syntaxtree.factory.ASTFactory;
|
||||
import de.dhbwstuttgart.syntaxtree.type.GenericRefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
import de.dhbwstuttgart.typecheck.GenericTypeName;
|
||||
import de.dhbwstuttgart.typecheck.JavaClassName;
|
||||
import de.dhbwstuttgart.typecheck.JavaClassRegistry;
|
||||
|
@ -1,12 +1,10 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
import de.dhbwstuttgart.exceptions.TypeinferenceException;
|
||||
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation;
|
||||
import de.dhbwstuttgart.typeinference.constraints.Constraint;
|
||||
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.constraints.Pair;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
|
@ -10,7 +10,7 @@ class Methods {
|
||||
}
|
||||
|
||||
class Test {
|
||||
String f;
|
||||
f;
|
||||
add(){}
|
||||
add(b){}
|
||||
sub(b){}
|
||||
|
@ -16,7 +16,7 @@ public class JavaTXCompilerTest {
|
||||
@Test
|
||||
public void test() throws IOException, ClassNotFoundException {
|
||||
JavaTXCompiler compiler = new JavaTXCompiler();
|
||||
//compiler.parse(new File(rootDirectory+"Methods.jav"));
|
||||
compiler.parse(new File(rootDirectory+"Methods.jav"));
|
||||
compiler.parse(new File(rootDirectory+"Generics.jav"));
|
||||
compiler.typeInference();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user