forked from JavaTX/JavaCompilerCore
Idea to resolve the problem with initial fields.
This commit is contained in:
parent
cca2da8018
commit
7f05966093
@ -5,7 +5,7 @@ import de.dhbwstuttgart.syntaxtree.*;
|
||||
import de.dhbwstuttgart.syntaxtree.modifier.*;
|
||||
import de.dhbwstuttgart.syntaxtree.modifier.fieldModifier.*;
|
||||
import de.dhbwstuttgart.syntaxtree.modifier.methodModifier.MethodModifier;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Block;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.*;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
@ -198,21 +198,25 @@ public class SyntaxTreeGenerator{
|
||||
List<Field> ret = new ArrayList<>();
|
||||
List<FieldModifier> modifiers = new ArrayList<>();
|
||||
for(Java8Parser.FieldModifierContext fieldModifierContext : fieldDeclarationContext.fieldModifier()){
|
||||
//TODO
|
||||
modifiers.add(convert(fieldModifierContext));
|
||||
}
|
||||
RefTypeOrTPH fieldType = convert(fieldDeclarationContext.unannType());
|
||||
for(Java8Parser.VariableDeclaratorContext varCtx : fieldDeclarationContext.variableDeclaratorList().variableDeclarator()){
|
||||
String fieldName = varCtx.variableDeclaratorId().getText();
|
||||
if(varCtx.variableInitializer() != null){
|
||||
//Feld mit Initialwert
|
||||
//TODO
|
||||
}else{
|
||||
//Feld ohne Initialwert
|
||||
initializeField(fieldDeclarationContext);
|
||||
}
|
||||
else{
|
||||
ret.add(new Field(fieldName,fieldType,modifiers,varCtx.getStart()));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Initialize a field by creating implicit constructor.
|
||||
private void initializeField(Java8Parser.FieldDeclarationContext ctx){
|
||||
//TODO
|
||||
}
|
||||
|
||||
private RefTypeOrTPH convert(Java8Parser.UnannTypeContext unannTypeContext) {
|
||||
if(unannTypeContext.unannPrimitiveType()!=null){
|
||||
|
Loading…
Reference in New Issue
Block a user