forked from JavaTX/JavaCompilerCore
Methodenparameter können nun auch inferiert werden
This commit is contained in:
parent
75f9a74c44
commit
59106a7e7b
@ -3,6 +3,9 @@ package mycompiler.myclass;
|
|||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
// ino.module.FormalParameter.8561.import
|
// ino.module.FormalParameter.8561.import
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import mycompiler.SyntaxTreeNode;
|
||||||
import mycompiler.mybytecode.ClassFile;
|
import mycompiler.mybytecode.ClassFile;
|
||||||
import mycompiler.mybytecode.CodeAttribute;
|
import mycompiler.mybytecode.CodeAttribute;
|
||||||
import mycompiler.mytype.Type;
|
import mycompiler.mytype.Type;
|
||||||
@ -16,6 +19,8 @@ import org.apache.log4j.Logger;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||||
import typinferenz.JavaCodeResult;
|
import typinferenz.JavaCodeResult;
|
||||||
import typinferenz.ResultSet;
|
import typinferenz.ResultSet;
|
||||||
@ -23,7 +28,7 @@ import typinferenz.Typeable;
|
|||||||
import typinferenz.TypeInsertable;
|
import typinferenz.TypeInsertable;
|
||||||
|
|
||||||
// ino.class.FormalParameter.23391.declaration
|
// ino.class.FormalParameter.23391.declaration
|
||||||
public class FormalParameter implements ITypeReplacementListener, Typeable, TypeInsertable
|
public class FormalParameter extends SyntaxTreeNode implements ITypeReplacementListener, Typeable, TypeInsertable
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.class.FormalParameter.23391.body
|
// ino.class.FormalParameter.23391.body
|
||||||
{
|
{
|
||||||
@ -213,5 +218,20 @@ public class FormalParameter implements ITypeReplacementListener, Typeable, Type
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Vector<SyntaxTreeNode> getChildren() {
|
||||||
|
return new Vector<SyntaxTreeNode>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void parserPostProcessing(SyntaxTreeNode parent) {
|
||||||
|
super.parserPostProcessing(parent);
|
||||||
|
if(this.type==null)this.type = TypePlaceholder.fresh(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
@ -59,7 +59,7 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
|
|||||||
private Block block;
|
private Block block;
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.attribute.parameterlist.23491.declaration
|
// ino.attribute.parameterlist.23491.declaration
|
||||||
public ParameterList parameterlist = null;
|
public ParameterList parameterlist = new ParameterList();
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.attribute.exceptionlist.23494.declaration
|
// ino.attribute.exceptionlist.23494.declaration
|
||||||
private ExceptionList exceptionlist;
|
private ExceptionList exceptionlist;
|
||||||
@ -668,6 +668,9 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
|
|||||||
public Vector<SyntaxTreeNode> getChildren() {
|
public Vector<SyntaxTreeNode> getChildren() {
|
||||||
Vector<SyntaxTreeNode> ret = new Vector<SyntaxTreeNode>();
|
Vector<SyntaxTreeNode> ret = new Vector<SyntaxTreeNode>();
|
||||||
ret.add(this.block);
|
ret.add(this.block);
|
||||||
|
for(FormalParameter param : this.parameterlist){
|
||||||
|
ret.add(param);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,4 +58,16 @@ public class TypeInsertPoint {
|
|||||||
public TypeInsertable getInsertNode(){
|
public TypeInsertable getInsertNode(){
|
||||||
return this.point;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,4 +52,18 @@ public class TypeInsertSet {
|
|||||||
return null;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user