From 12093f2fc7b4f27236c728e2fadb5afc30bda407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6dter?= Date: Tue, 27 Oct 2015 13:27:00 +0100 Subject: [PATCH] Signatur ist das gleiche wie Description --- .../dhbwstuttgart/syntaxtree/FormalParameter.java | 2 +- .../syntaxtree/factory/ASTFactory.java | 14 +++++++++++--- src/de/dhbwstuttgart/syntaxtree/type/RefType.java | 4 ++-- test/bytecode/types/Test.java | 12 ------------ 4 files changed, 14 insertions(+), 18 deletions(-) delete mode 100644 test/bytecode/types/Test.java diff --git a/src/de/dhbwstuttgart/syntaxtree/FormalParameter.java b/src/de/dhbwstuttgart/syntaxtree/FormalParameter.java index e410bd57..ddb325d7 100755 --- a/src/de/dhbwstuttgart/syntaxtree/FormalParameter.java +++ b/src/de/dhbwstuttgart/syntaxtree/FormalParameter.java @@ -236,7 +236,7 @@ public class FormalParameter extends SyntaxTreeNode implements Typeable, TypeIns public String getDescription() { String ret = ""; if(this.getType() != null && !(this.getType() instanceof TypePlaceholder)){ - ret += this.getType().getName() + " "; + ret += this.getType().getBytecodeSignature(null); } return ret+this.getIdentifier(); } diff --git a/src/de/dhbwstuttgart/syntaxtree/factory/ASTFactory.java b/src/de/dhbwstuttgart/syntaxtree/factory/ASTFactory.java index 060ea12c..db782e91 100644 --- a/src/de/dhbwstuttgart/syntaxtree/factory/ASTFactory.java +++ b/src/de/dhbwstuttgart/syntaxtree/factory/ASTFactory.java @@ -4,7 +4,9 @@ import de.dhbwstuttgart.bytecode.ClassGenerator; import de.dhbwstuttgart.syntaxtree.Class; import de.dhbwstuttgart.syntaxtree.Constructor; import de.dhbwstuttgart.syntaxtree.Method; +import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode; import de.dhbwstuttgart.syntaxtree.misc.DeclId; +import de.dhbwstuttgart.syntaxtree.misc.UsedId; import de.dhbwstuttgart.syntaxtree.statement.Block; import de.dhbwstuttgart.syntaxtree.statement.SuperCall; import de.dhbwstuttgart.typeinference.Menge; @@ -45,11 +47,17 @@ public class ASTFactory { return new Constructor(method, superClass); } - public static Class createClass(String className, Class superClass) { + public static Class createClass(String className, String superClass, Class parent) { // TODO bytecode createClass Class generatedClass = new Class(className, 0); - generatedClass.addField(ASTFactory.createEmptyConstructor(superClass)); - generatedClass.parserPostProcessing(superClass); + generatedClass.addField(ASTFactory.createEmptyConstructor(parent)); + + if(superClass != null){ + generatedClass.superclassid = UsedId.createFromQualifiedName(superClass, 0); + } + + //TODO bytecode parserPostProcressing ist die SuperKlasse oder eine Sourcefile? + generatedClass.parserPostProcessing(parent); return generatedClass; } diff --git a/src/de/dhbwstuttgart/syntaxtree/type/RefType.java b/src/de/dhbwstuttgart/syntaxtree/type/RefType.java index 3fe126b4..117c5b9e 100755 --- a/src/de/dhbwstuttgart/syntaxtree/type/RefType.java +++ b/src/de/dhbwstuttgart/syntaxtree/type/RefType.java @@ -852,8 +852,8 @@ public class RefType extends ObjectType implements IMatchable String combinedType = getCombinedType(cg); if(!combinedType.equals(getName().toString())){ // TODO bytecode statt getParentClass die eigene Class?!?! - Class classObject = ASTFactory.createClass(getName().toString(), ASTFactory.createObjectClass()); - Class generatedClass = ASTFactory.createClass(getCombinedType(cg), classObject); + Class classObject = ASTFactory.createClass(getName().toString(), null, ASTFactory.createObjectClass()); + Class generatedClass = ASTFactory.createClass(getCombinedType(cg), getName().toString(), classObject); cg.addExtraClass(generatedClass.genByteCode(new TypeinferenceResultSet(generatedClass, new Menge<>(), new ResultSet())).getByteCode()); } diff --git a/test/bytecode/types/Test.java b/test/bytecode/types/Test.java deleted file mode 100644 index 78235be2..00000000 --- a/test/bytecode/types/Test.java +++ /dev/null @@ -1,12 +0,0 @@ -import java.util.Vector; - -public class Test { - - public static void main(String[] args) { - Overloading o = new Overloading(); - Vector stringVector = new Vector(); - - o.method(stringVector); - } - -}