From 77c06225a6b3cb8e83fe381b16b0c22bdcbc5c80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6dter?= Date: Fri, 23 Oct 2015 10:56:56 +0200 Subject: [PATCH] Constructor ist von Type Void --- .../syntaxtree/factory/ASTFactory.java | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/de/dhbwstuttgart/syntaxtree/factory/ASTFactory.java b/src/de/dhbwstuttgart/syntaxtree/factory/ASTFactory.java index a129c8d2..557ff35b 100644 --- a/src/de/dhbwstuttgart/syntaxtree/factory/ASTFactory.java +++ b/src/de/dhbwstuttgart/syntaxtree/factory/ASTFactory.java @@ -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("", block, superClass), superClass); + block.parserPostProcessing(superClass); + + Method method = ASTFactory.createMethod("", 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; }