forked from JavaTX/JavaCompilerCore
Merge branch 'master' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into bytecode2
This commit is contained in:
commit
9918e78f97
@ -233,9 +233,9 @@ public class SyntaxTreeGenerator{
|
|||||||
block = stmtGen.convert(body.block());
|
block = stmtGen.convert(body.block());
|
||||||
}
|
}
|
||||||
if(parentClass.equals(new JavaClassName(name))){
|
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{
|
}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;
|
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){
|
private Constructor generateStandardConstructor(String className, JavaClassName parentClass, RefType superClass, GenericDeclarationList classGenerics, Token offset){
|
||||||
RefType classType = ClassOrInterface.generateTypeOfClass(reg.getName(className), classGenerics, offset);
|
RefType classType = ClassOrInterface.generateTypeOfClass(reg.getName(className), classGenerics, offset);
|
||||||
int modifiers = 0;
|
int modifiers = 0;
|
||||||
ParameterList params = new ParameterList(new ArrayList<>(), offset);
|
ParameterList params = new ParameterList(new ArrayList<>(), offset);
|
||||||
Block block = new Block(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) {
|
private RefType convert(Java8Parser.SuperclassContext superclass) {
|
||||||
|
@ -14,9 +14,9 @@ public class Constructor extends Method {
|
|||||||
|
|
||||||
|
|
||||||
//TODO: Constructor braucht ein super-Statement
|
//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) {
|
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 ExceptionList exceptionlist;
|
||||||
private GenericDeclarationList generics;
|
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) {
|
GenericDeclarationList gtvDeclarations, Token offset) {
|
||||||
super(name, returnType, modifiers, offset);
|
super(name, returnType, modifiers, offset);
|
||||||
this.parameterlist = parameterList;
|
this.parameterlist = parameterList;
|
||||||
|
@ -83,7 +83,7 @@ public class ASTFactory {
|
|||||||
return null;
|
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()));
|
createType(inClass.getSuperclass()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ public class ASTFactory {
|
|||||||
Token offset = new NullToken();
|
Token offset = new NullToken();
|
||||||
int modifier = jreMethod.getModifiers();
|
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){
|
public static GenericDeclarationList createGenerics(TypeVariable[] typeParameters, Class context, String methodName){
|
||||||
|
Loading…
Reference in New Issue
Block a user