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 static Method createMethod(String name, Block block, Class parent) {
|
||||
block.parserPostProcessing(parent);
|
||||
|
||||
Method method = new Method(0);
|
||||
DeclId DImethod = new DeclId();
|
||||
//DImethod.set_Name(withSignature); //todo: bytecode signatur?
|
||||
DImethod.set_Name(name);
|
||||
method.set_DeclId(DImethod);
|
||||
method.set_Block(block);
|
||||
method.parserPostProcessing(parent);
|
||||
@ -23,7 +25,7 @@ public class ASTFactory {
|
||||
}
|
||||
|
||||
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){
|
||||
@ -35,19 +37,19 @@ public class ASTFactory {
|
||||
}
|
||||
|
||||
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) {
|
||||
// TODO bytecode createClass
|
||||
Class generatedClass = new Class(className, 0);
|
||||
Block konstruktorBlock = new Block();
|
||||
konstruktorBlock.setType(new de.dhbwstuttgart.syntaxtree.type.Void(konstruktorBlock, 0));
|
||||
konstruktorBlock.statements.add(new SuperCall(konstruktorBlock));
|
||||
Constructor standardKonstruktor = new Constructor(Method.createEmptyMethod(konstruktorBlock, className, superClass), superClass);
|
||||
standardKonstruktor.parserPostProcessing(generatedClass);
|
||||
|
||||
generatedClass.addField(standardKonstruktor);
|
||||
Class generatedClass = new Class(className, 0);
|
||||
generatedClass.addField(ASTFactory.createEmptyConstructor(superClass));
|
||||
generatedClass.parserPostProcessing(superClass);
|
||||
|
||||
return generatedClass;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user