From 9aea618525aa9ff8bf96a063e8ca6d5912fd242b Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Sat, 26 Apr 2014 19:33:26 +0200 Subject: [PATCH] =?UTF-8?q?SyntaxTreeNode=20wird=20zum=20ermitteln=20der?= =?UTF-8?q?=20TIPs=20zus=C3=A4tzlich=20durchlaufen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mycompiler/SyntaxTreeNode.java | 10 ++++++++++ src/mycompiler/myclass/Class.java | 3 +++ src/mycompiler/myclass/FormalParameter.java | 8 ++++++++ src/mycompiler/myclass/Method.java | 2 -- .../TypeinferenceResultSet.java | 13 +++++++++++++ 5 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/mycompiler/SyntaxTreeNode.java b/src/mycompiler/SyntaxTreeNode.java index f2c58bf6a..41883c624 100644 --- a/src/mycompiler/SyntaxTreeNode.java +++ b/src/mycompiler/SyntaxTreeNode.java @@ -2,6 +2,8 @@ package mycompiler; import java.util.Vector; +import typinferenz.ResultSet; +import typinferenz.TypeInsertPoint; import typinferenz.exceptions.DebugException; import typinferenz.exceptions.TypeinferenceException; import mycompiler.myclass.Class; @@ -57,4 +59,12 @@ public abstract class SyntaxTreeNode { if(!this.getParent().equals(equal.getParent()))return false; //auch das Elternelement überprüfen. return true; } + + public Vector> getTypeInsertPoints(ResultSet result) { + Vector> ret = new Vector>(); + for(SyntaxTreeNode node : this.getChildren()){ + ret.addAll(node.getTypeInsertPoints(result)); + } + return ret; + } } diff --git a/src/mycompiler/myclass/Class.java b/src/mycompiler/myclass/Class.java index 97692dac1..d6386369b 100755 --- a/src/mycompiler/myclass/Class.java +++ b/src/mycompiler/myclass/Class.java @@ -62,11 +62,13 @@ import org.apache.log4j.Logger; + import sun.reflect.generics.reflectiveObjects.NotImplementedException; import typinferenz.ConstraintsSet; import typinferenz.JavaCodeResult; import typinferenz.OderConstraint; import typinferenz.ResultSet; +import typinferenz.TypeInsertPoint; import typinferenz.Typeable; import typinferenz.UndConstraint; import typinferenz.FunN; @@ -1358,5 +1360,6 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit // TODO Auto-generated method stub return 0; } + } // ino.end diff --git a/src/mycompiler/myclass/FormalParameter.java b/src/mycompiler/myclass/FormalParameter.java index d9c787b79..4271a3276 100755 --- a/src/mycompiler/myclass/FormalParameter.java +++ b/src/mycompiler/myclass/FormalParameter.java @@ -277,6 +277,14 @@ public class FormalParameter extends SyntaxTreeNode implements ITypeReplacementL return this.declid; } + @Override + public Vector> getTypeInsertPoints(ResultSet result) { + Vector> ret = super.getTypeInsertPoints(result); + if(this.getType() instanceof TypePlaceholder){ + ret.add(((TypePlaceholder)this.getType()).getTypeInsertPoints(result)); + } + return ret; + } } // ino.end diff --git a/src/mycompiler/myclass/Method.java b/src/mycompiler/myclass/Method.java index 35d220a8d..e3def173f 100755 --- a/src/mycompiler/myclass/Method.java +++ b/src/mycompiler/myclass/Method.java @@ -748,8 +748,6 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable public void setGenericParameter(Vector params) { this.genericMethodParameters = params; } - - } // ino.end diff --git a/src/mycompiler/mytypereconstruction/TypeinferenceResultSet.java b/src/mycompiler/mytypereconstruction/TypeinferenceResultSet.java index ba1dd17c9..cefe7af16 100755 --- a/src/mycompiler/mytypereconstruction/TypeinferenceResultSet.java +++ b/src/mycompiler/mytypereconstruction/TypeinferenceResultSet.java @@ -115,6 +115,19 @@ public class TypeinferenceResultSet */ public Vector getTypeInsertionPoints(){ Vector ret = new Vector(); + //TODO: Eigentlich sollten die TypeInsertPoints von den Elementen im Syntaxbaum erstellt werden. Momentan wird beides parallel eingesetzt + Vector> TISets = this.ownerOfResultSet.getTypeInsertPoints(this.unifiedConstraints); + for(Vector TIPs : TISets){ + TypeInsertSet toAdd = new TypeInsertSet(); + for(int i = 0; i