forked from JavaTX/JavaCompilerCore
Added Modifier to Method
This commit is contained in:
parent
7c3181c3f0
commit
d245aa7367
@ -233,9 +233,9 @@ public class SyntaxTreeGenerator{
|
||||
block = stmtGen.convert(body.block());
|
||||
}
|
||||
if(parentClass.equals(new JavaClassName(name))){
|
||||
return new Constructor(name, retType, modifiers, parameterList, block, gtvDeclarations, header.getStart(), fieldInitializations, superClass);
|
||||
return new Constructor(modifiers, name, retType, modifiers, parameterList, block, gtvDeclarations, header.getStart(), fieldInitializations, superClass);
|
||||
}else{
|
||||
return new Method(name, retType, modifiers, parameterList,block, gtvDeclarations, header.getStart());
|
||||
return new Method(modifiers, name, retType, modifiers, parameterList,block, gtvDeclarations, header.getStart());
|
||||
}
|
||||
}
|
||||
|
||||
@ -310,12 +310,15 @@ public class SyntaxTreeGenerator{
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.8.9
|
||||
*/
|
||||
private Constructor generateStandardConstructor(String className, JavaClassName parentClass, RefType superClass, GenericDeclarationList classGenerics, Token offset){
|
||||
RefType classType = ClassOrInterface.generateTypeOfClass(reg.getName(className), classGenerics, offset);
|
||||
int modifiers = 0;
|
||||
ParameterList params = new ParameterList(new ArrayList<>(), offset);
|
||||
Block block = new Block(new ArrayList<>(), offset);
|
||||
return new Constructor(className, classType, modifiers, params, block, classGenerics, offset, fieldInitializations, superClass);
|
||||
return new Constructor(Modifier.PUBLIC, className, classType, modifiers, params, block, classGenerics, offset, fieldInitializations, superClass);
|
||||
}
|
||||
|
||||
private RefType convert(Java8Parser.SuperclassContext superclass) {
|
||||
|
@ -14,9 +14,9 @@ public class Constructor extends Method {
|
||||
|
||||
|
||||
//TODO: Constructor braucht ein super-Statement
|
||||
public Constructor(String name, RefTypeOrTPHOrWildcardOrGeneric returnType, int modifiers, ParameterList parameterList, Block codeInsideConstructor,
|
||||
public Constructor(int modifier, String name, RefTypeOrTPHOrWildcardOrGeneric returnType, int modifiers, ParameterList parameterList, Block codeInsideConstructor,
|
||||
GenericDeclarationList gtvDeclarations, Token offset, List<Statement> fieldInitializations, RefType superClass) {
|
||||
super(name, returnType, modifiers, parameterList, prepareBlock(codeInsideConstructor,fieldInitializations, superClass), gtvDeclarations, offset);
|
||||
super(modifier, name, returnType, modifiers, parameterList, prepareBlock(codeInsideConstructor,fieldInitializations, superClass), gtvDeclarations, offset);
|
||||
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ public class Method extends Field implements IItemWithOffset, TypeScope
|
||||
private ExceptionList exceptionlist;
|
||||
private GenericDeclarationList generics;
|
||||
|
||||
public Method(String name, RefTypeOrTPHOrWildcardOrGeneric returnType, int modifiers, ParameterList parameterList, Block block,
|
||||
public Method(int modifier, String name, RefTypeOrTPHOrWildcardOrGeneric returnType, int modifiers, ParameterList parameterList, Block block,
|
||||
GenericDeclarationList gtvDeclarations, Token offset) {
|
||||
super(name, returnType, modifiers, offset);
|
||||
this.parameterlist = parameterList;
|
||||
|
@ -83,7 +83,7 @@ public class ASTFactory {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new de.dhbwstuttgart.syntaxtree.Constructor(name,returnType, modifier, parameterList, block, gtvDeclarations, offset, new ArrayList<>(),
|
||||
return new de.dhbwstuttgart.syntaxtree.Constructor(constructor.getModifiers(), name,returnType, modifier, parameterList, block, gtvDeclarations, offset, new ArrayList<>(),
|
||||
createType(inClass.getSuperclass()));
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ public class ASTFactory {
|
||||
Token offset = new NullToken();
|
||||
int modifier = jreMethod.getModifiers();
|
||||
|
||||
return new Method(name,returnType, modifier, parameterList, block, gtvDeclarations, offset);
|
||||
return new Method(jreMethod.getModifiers(), name,returnType, modifier, parameterList, block, gtvDeclarations, offset);
|
||||
}
|
||||
|
||||
public static GenericDeclarationList createGenerics(TypeVariable[] typeParameters, Class context, String methodName){
|
||||
|
Loading…
Reference in New Issue
Block a user