From 59106a7e7b69675a30c2547fe9f6acdcbc1ade6b Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Tue, 18 Mar 2014 13:38:47 +0100 Subject: [PATCH] =?UTF-8?q?Methodenparameter=20k=C3=B6nnen=20nun=20auch=20?= =?UTF-8?q?inferiert=20werden?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mycompiler/myclass/FormalParameter.java | 22 ++++++++++++++++++++- src/mycompiler/myclass/Method.java | 5 ++++- src/typinferenz/TypeInsertPoint.java | 12 +++++++++++ src/typinferenz/TypeInsertSet.java | 14 +++++++++++++ 4 files changed, 51 insertions(+), 2 deletions(-) diff --git a/src/mycompiler/myclass/FormalParameter.java b/src/mycompiler/myclass/FormalParameter.java index 2244e00e..11430ccf 100755 --- a/src/mycompiler/myclass/FormalParameter.java +++ b/src/mycompiler/myclass/FormalParameter.java @@ -3,6 +3,9 @@ package mycompiler.myclass; // ino.end // ino.module.FormalParameter.8561.import +import java.util.Vector; + +import mycompiler.SyntaxTreeNode; import mycompiler.mybytecode.ClassFile; import mycompiler.mybytecode.CodeAttribute; import mycompiler.mytype.Type; @@ -16,6 +19,8 @@ import org.apache.log4j.Logger; + + import sun.reflect.generics.reflectiveObjects.NotImplementedException; import typinferenz.JavaCodeResult; import typinferenz.ResultSet; @@ -23,7 +28,7 @@ import typinferenz.Typeable; import typinferenz.TypeInsertable; // ino.class.FormalParameter.23391.declaration -public class FormalParameter implements ITypeReplacementListener, Typeable, TypeInsertable +public class FormalParameter extends SyntaxTreeNode implements ITypeReplacementListener, Typeable, TypeInsertable // ino.end // ino.class.FormalParameter.23391.body { @@ -213,5 +218,20 @@ public class FormalParameter implements ITypeReplacementListener, Typeable, Type } + + @Override + public Vector getChildren() { + return new Vector(); + } + + + + @Override + public void parserPostProcessing(SyntaxTreeNode parent) { + super.parserPostProcessing(parent); + if(this.type==null)this.type = TypePlaceholder.fresh(this); + } + + } // ino.end diff --git a/src/mycompiler/myclass/Method.java b/src/mycompiler/myclass/Method.java index 76562ccb..7de29dc7 100755 --- a/src/mycompiler/myclass/Method.java +++ b/src/mycompiler/myclass/Method.java @@ -59,7 +59,7 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable private Block block; // ino.end // ino.attribute.parameterlist.23491.declaration - public ParameterList parameterlist = null; + public ParameterList parameterlist = new ParameterList(); // ino.end // ino.attribute.exceptionlist.23494.declaration private ExceptionList exceptionlist; @@ -668,6 +668,9 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable public Vector getChildren() { Vector ret = new Vector(); ret.add(this.block); + for(FormalParameter param : this.parameterlist){ + ret.add(param); + } return ret; } diff --git a/src/typinferenz/TypeInsertPoint.java b/src/typinferenz/TypeInsertPoint.java index a8ec615c..5c3ee19c 100644 --- a/src/typinferenz/TypeInsertPoint.java +++ b/src/typinferenz/TypeInsertPoint.java @@ -58,4 +58,16 @@ public class TypeInsertPoint { public TypeInsertable getInsertNode(){ return this.point; } + + @Override + public boolean equals(Object obj){ + if(! (obj instanceof TypeInsertPoint))return false; + TypeInsertPoint equals = (TypeInsertPoint) obj; + if(!(equals.point.equals(this.point)))return false; + if(!(equals.tph.equals(this.tph)))return false; + if(!(equals.resultSet.equals(this.resultSet)))return false; + if(!(equals.type.equals(this.type)))return false; + + return true; + } } diff --git a/src/typinferenz/TypeInsertSet.java b/src/typinferenz/TypeInsertSet.java index 77ee8706..2b26de0e 100644 --- a/src/typinferenz/TypeInsertSet.java +++ b/src/typinferenz/TypeInsertSet.java @@ -52,4 +52,18 @@ public class TypeInsertSet { return null; } + @Override + public boolean equals(Object obj){ + if(! (obj instanceof TypeInsertSet))return false; + TypeInsertSet equals = (TypeInsertSet) obj; + for(TypeInsertPoint point : points){ + //Jeder TypeInsertPoint muss auch in equals vorkommen: + if(!equals.points.contains(point))return false; + //... aber nicht öfter als 1x : + if(equals.points.lastIndexOf(point)!=equals.points.indexOf(point))return false; + } + + return true; + } + }