forked from JavaTX/JavaCompilerCore
UnaryExpr verändert
This commit is contained in:
parent
25d61b703b
commit
55d40d14ad
@ -60,7 +60,7 @@ public class FormalParameter extends SyntaxTreeNode implements ITypeReplacementL
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if(!super.equals(object))return false;
|
||||
//if(!super.equals(object))return false; //Nicht die Position im SyntaxBaum prüfen.
|
||||
if(!(object instanceof FormalParameter))return false;
|
||||
FormalParameter equals = (FormalParameter)object;
|
||||
if((this.type==null)!=(equals.type == null))return false;
|
||||
|
@ -54,9 +54,6 @@ public class PostDecExpr extends UnaryExpr
|
||||
super(offset,variableLength);
|
||||
}
|
||||
// ino.end
|
||||
// ino.attribute.expr.25994.declaration
|
||||
public Expr expr;
|
||||
// ino.end
|
||||
// ino.attribute.parserlog.25997.declaration
|
||||
protected static Logger parserlog = Logger.getLogger("parser");
|
||||
// ino.end
|
||||
@ -172,12 +169,6 @@ public class PostDecExpr extends UnaryExpr
|
||||
expr.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
||||
// TODO Auto-generated method stub
|
||||
|
@ -60,9 +60,7 @@ public class PostIncExpr extends UnaryExpr
|
||||
super(offset,variableLength);
|
||||
}
|
||||
// ino.end
|
||||
// ino.attribute.expr.26028.declaration
|
||||
public Expr expr;
|
||||
// ino.end
|
||||
|
||||
// ino.attribute.parserlog.26031.declaration
|
||||
protected static Logger parserlog = Logger.getLogger("parser");
|
||||
// ino.end
|
||||
@ -178,36 +176,6 @@ public class PostIncExpr extends UnaryExpr
|
||||
expr.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable);
|
||||
}
|
||||
|
||||
private Vector<RefType> getNumericTypes(){
|
||||
Vector<RefType> ret = new Vector<>();
|
||||
ret.add(new RefType("Integer",-1));
|
||||
ret.add(new RefType("Long",-1));
|
||||
ret.add(new RefType("Double",-1));
|
||||
return ret ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
||||
if(this.getType() == null)this.setType(TypePlaceholder.fresh(this));
|
||||
ConstraintsSet ret = new ConstraintsSet();
|
||||
OderConstraint oderConstraint = new OderConstraint();
|
||||
ret.add(this.expr.TYPEExpr(assumptions));
|
||||
for(RefType t : getNumericTypes()){
|
||||
UndConstraint undConstraint = new UndConstraint();
|
||||
undConstraint.addConstraint(this.getType(), t);
|
||||
undConstraint.addConstraint(this.expr.getType(), t);
|
||||
|
||||
oderConstraint.addConstraint(undConstraint);
|
||||
}
|
||||
ret.add(oderConstraint);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstraintsSet TYPEStmt(TypeAssumptions assumptions) {
|
||||
return this.TYPEExpr(assumptions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
||||
JavaCodeResult ret = new JavaCodeResult();
|
||||
|
@ -55,9 +55,6 @@ public class PreDecExpr extends UnaryExpr
|
||||
}
|
||||
// ino.end
|
||||
|
||||
// ino.attribute.expr.26062.declaration
|
||||
public Expr expr;
|
||||
// ino.end
|
||||
// ino.attribute.parserlog.26065.declaration
|
||||
protected static Logger parserlog = Logger.getLogger("parser");
|
||||
// ino.end
|
||||
@ -171,11 +168,7 @@ public class PreDecExpr extends UnaryExpr
|
||||
{
|
||||
expr.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable);
|
||||
}
|
||||
@Override
|
||||
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
||||
// TODO Auto-generated method stub
|
||||
|
@ -54,9 +54,6 @@ public class PreIncExpr extends UnaryExpr
|
||||
super(offset,variableLength);
|
||||
}
|
||||
// ino.end
|
||||
// ino.attribute.expr.26096.declaration
|
||||
public Expr expr;
|
||||
// ino.end
|
||||
// ino.attribute.parserlog.26099.declaration
|
||||
protected static Logger parserlog = Logger.getLogger("parser");
|
||||
// ino.end
|
||||
@ -173,12 +170,6 @@ public class PreIncExpr extends UnaryExpr
|
||||
expr.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
||||
// TODO Auto-generated method stub
|
||||
|
@ -3,10 +3,17 @@ package mycompiler.mystatement;
|
||||
// ino.end
|
||||
// ino.module.UnaryExpr.8655.import
|
||||
import java.util.Vector;
|
||||
|
||||
import typinferenz.ConstraintsSet;
|
||||
import typinferenz.OderConstraint;
|
||||
import typinferenz.UndConstraint;
|
||||
import typinferenz.assumptions.TypeAssumptions;
|
||||
import mycompiler.mybytecode.ClassFile;
|
||||
import mycompiler.mybytecode.CodeAttribute;
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
// ino.end
|
||||
import mycompiler.mytype.RefType;
|
||||
import mycompiler.mytype.TypePlaceholder;
|
||||
|
||||
|
||||
|
||||
@ -16,7 +23,9 @@ public abstract class UnaryExpr extends Expr
|
||||
// ino.end
|
||||
// ino.class.UnaryExpr.26298.body
|
||||
{
|
||||
// ino.method.UnaryExpr.26302.definition
|
||||
public Expr expr;
|
||||
|
||||
// ino.method.UnaryExpr.26302.definition
|
||||
public UnaryExpr(int offset,int variableLength)
|
||||
// ino.end
|
||||
// ino.method.UnaryExpr.26302.body
|
||||
@ -29,5 +38,37 @@ public abstract class UnaryExpr extends Expr
|
||||
public abstract void codegen(ClassFile classfile, CodeAttribute code, Vector paralist)
|
||||
throws JVMCodeException;
|
||||
// ino.end
|
||||
|
||||
private Vector<RefType> getNumericTypes(){
|
||||
Vector<RefType> ret = new Vector<>();
|
||||
ret.add(new RefType("Integer",-1));
|
||||
ret.add(new RefType("Long",-1));
|
||||
ret.add(new RefType("Double",-1));
|
||||
return ret ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
||||
if(this.getType() == null)this.setType(TypePlaceholder.fresh(this));
|
||||
ConstraintsSet ret = new ConstraintsSet();
|
||||
OderConstraint oderConstraint = new OderConstraint();
|
||||
ret.add(this.expr.TYPEExpr(assumptions));
|
||||
for(RefType t : getNumericTypes()){
|
||||
UndConstraint undConstraint = new UndConstraint();
|
||||
undConstraint.addConstraint(this.getType(), t);
|
||||
undConstraint.addConstraint(this.expr.getType(), t);
|
||||
|
||||
oderConstraint.addConstraint(undConstraint);
|
||||
}
|
||||
ret.add(oderConstraint);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstraintsSet TYPEStmt(TypeAssumptions assumptions) {
|
||||
return this.TYPEExpr(assumptions);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// ino.end
|
||||
|
Loading…
Reference in New Issue
Block a user