forked from JavaTX/JavaCompilerCore
Constructor ist von Type Void
This commit is contained in:
parent
fab73a4d62
commit
77c06225a6
@ -13,9 +13,11 @@ import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
|
|||||||
|
|
||||||
public class ASTFactory {
|
public class ASTFactory {
|
||||||
public static Method createMethod(String name, Block block, Class parent) {
|
public static Method createMethod(String name, Block block, Class parent) {
|
||||||
|
block.parserPostProcessing(parent);
|
||||||
|
|
||||||
Method method = new Method(0);
|
Method method = new Method(0);
|
||||||
DeclId DImethod = new DeclId();
|
DeclId DImethod = new DeclId();
|
||||||
//DImethod.set_Name(withSignature); //todo: bytecode signatur?
|
DImethod.set_Name(name);
|
||||||
method.set_DeclId(DImethod);
|
method.set_DeclId(DImethod);
|
||||||
method.set_Block(block);
|
method.set_Block(block);
|
||||||
method.parserPostProcessing(parent);
|
method.parserPostProcessing(parent);
|
||||||
@ -23,7 +25,7 @@ public class ASTFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Method createEmptyMethod(String withSignature, Class parent) {
|
public static Method createEmptyMethod(String withSignature, Class parent) {
|
||||||
return ASTFactory.createMethod("", new Block(), parent);
|
return ASTFactory.createMethod(withSignature, new Block(), parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Constructor createEmptyConstructor(Class parent){
|
public static Constructor createEmptyConstructor(Class parent){
|
||||||
@ -35,19 +37,19 @@ public class ASTFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Constructor createConstructor(Class superClass, Block block){
|
public static Constructor createConstructor(Class superClass, Block block){
|
||||||
return new Constructor(ASTFactory.createMethod("<init>", block, superClass), superClass);
|
block.parserPostProcessing(superClass);
|
||||||
|
|
||||||
|
Method method = ASTFactory.createMethod("<init>", block, superClass);
|
||||||
|
method.setType(new de.dhbwstuttgart.syntaxtree.type.Void(block, 0));
|
||||||
|
|
||||||
|
return new Constructor(method, superClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Class createClass(String className, Class superClass) {
|
public static Class createClass(String className, Class superClass) {
|
||||||
// TODO bytecode createClass
|
// TODO bytecode createClass
|
||||||
Class generatedClass = new Class(className, 0);
|
Class generatedClass = new Class(className, 0);
|
||||||
Block konstruktorBlock = new Block();
|
generatedClass.addField(ASTFactory.createEmptyConstructor(superClass));
|
||||||
konstruktorBlock.setType(new de.dhbwstuttgart.syntaxtree.type.Void(konstruktorBlock, 0));
|
generatedClass.parserPostProcessing(superClass);
|
||||||
konstruktorBlock.statements.add(new SuperCall(konstruktorBlock));
|
|
||||||
Constructor standardKonstruktor = new Constructor(Method.createEmptyMethod(konstruktorBlock, className, superClass), superClass);
|
|
||||||
standardKonstruktor.parserPostProcessing(generatedClass);
|
|
||||||
|
|
||||||
generatedClass.addField(standardKonstruktor);
|
|
||||||
|
|
||||||
return generatedClass;
|
return generatedClass;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user