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
|
@Override
|
||||||
public boolean equals(Object object) {
|
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;
|
if(!(object instanceof FormalParameter))return false;
|
||||||
FormalParameter equals = (FormalParameter)object;
|
FormalParameter equals = (FormalParameter)object;
|
||||||
if((this.type==null)!=(equals.type == null))return false;
|
if((this.type==null)!=(equals.type == null))return false;
|
||||||
|
@ -54,9 +54,6 @@ public class PostDecExpr extends UnaryExpr
|
|||||||
super(offset,variableLength);
|
super(offset,variableLength);
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.attribute.expr.25994.declaration
|
|
||||||
public Expr expr;
|
|
||||||
// ino.end
|
|
||||||
// ino.attribute.parserlog.25997.declaration
|
// ino.attribute.parserlog.25997.declaration
|
||||||
protected static Logger parserlog = Logger.getLogger("parser");
|
protected static Logger parserlog = Logger.getLogger("parser");
|
||||||
// ino.end
|
// ino.end
|
||||||
@ -172,12 +169,6 @@ public class PostDecExpr extends UnaryExpr
|
|||||||
expr.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable);
|
expr.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
@ -60,9 +60,7 @@ public class PostIncExpr extends UnaryExpr
|
|||||||
super(offset,variableLength);
|
super(offset,variableLength);
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.attribute.expr.26028.declaration
|
|
||||||
public Expr expr;
|
|
||||||
// ino.end
|
|
||||||
// ino.attribute.parserlog.26031.declaration
|
// ino.attribute.parserlog.26031.declaration
|
||||||
protected static Logger parserlog = Logger.getLogger("parser");
|
protected static Logger parserlog = Logger.getLogger("parser");
|
||||||
// ino.end
|
// ino.end
|
||||||
@ -178,36 +176,6 @@ public class PostIncExpr extends UnaryExpr
|
|||||||
expr.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable);
|
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
|
@Override
|
||||||
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
||||||
JavaCodeResult ret = new JavaCodeResult();
|
JavaCodeResult ret = new JavaCodeResult();
|
||||||
|
@ -55,9 +55,6 @@ public class PreDecExpr extends UnaryExpr
|
|||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
// ino.attribute.expr.26062.declaration
|
|
||||||
public Expr expr;
|
|
||||||
// ino.end
|
|
||||||
// ino.attribute.parserlog.26065.declaration
|
// ino.attribute.parserlog.26065.declaration
|
||||||
protected static Logger parserlog = Logger.getLogger("parser");
|
protected static Logger parserlog = Logger.getLogger("parser");
|
||||||
// ino.end
|
// ino.end
|
||||||
@ -171,11 +168,7 @@ public class PreDecExpr extends UnaryExpr
|
|||||||
{
|
{
|
||||||
expr.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable);
|
expr.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable);
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
@Override
|
@Override
|
||||||
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
@ -54,9 +54,6 @@ public class PreIncExpr extends UnaryExpr
|
|||||||
super(offset,variableLength);
|
super(offset,variableLength);
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.attribute.expr.26096.declaration
|
|
||||||
public Expr expr;
|
|
||||||
// ino.end
|
|
||||||
// ino.attribute.parserlog.26099.declaration
|
// ino.attribute.parserlog.26099.declaration
|
||||||
protected static Logger parserlog = Logger.getLogger("parser");
|
protected static Logger parserlog = Logger.getLogger("parser");
|
||||||
// ino.end
|
// ino.end
|
||||||
@ -173,12 +170,6 @@ public class PreIncExpr extends UnaryExpr
|
|||||||
expr.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable);
|
expr.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
@ -3,10 +3,17 @@ package mycompiler.mystatement;
|
|||||||
// ino.end
|
// ino.end
|
||||||
// ino.module.UnaryExpr.8655.import
|
// ino.module.UnaryExpr.8655.import
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import typinferenz.ConstraintsSet;
|
||||||
|
import typinferenz.OderConstraint;
|
||||||
|
import typinferenz.UndConstraint;
|
||||||
|
import typinferenz.assumptions.TypeAssumptions;
|
||||||
import mycompiler.mybytecode.ClassFile;
|
import mycompiler.mybytecode.ClassFile;
|
||||||
import mycompiler.mybytecode.CodeAttribute;
|
import mycompiler.mybytecode.CodeAttribute;
|
||||||
import mycompiler.myexception.JVMCodeException;
|
import mycompiler.myexception.JVMCodeException;
|
||||||
// ino.end
|
// ino.end
|
||||||
|
import mycompiler.mytype.RefType;
|
||||||
|
import mycompiler.mytype.TypePlaceholder;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -16,6 +23,8 @@ public abstract class UnaryExpr extends Expr
|
|||||||
// ino.end
|
// ino.end
|
||||||
// ino.class.UnaryExpr.26298.body
|
// ino.class.UnaryExpr.26298.body
|
||||||
{
|
{
|
||||||
|
public Expr expr;
|
||||||
|
|
||||||
// ino.method.UnaryExpr.26302.definition
|
// ino.method.UnaryExpr.26302.definition
|
||||||
public UnaryExpr(int offset,int variableLength)
|
public UnaryExpr(int offset,int variableLength)
|
||||||
// ino.end
|
// ino.end
|
||||||
@ -29,5 +38,37 @@ public abstract class UnaryExpr extends Expr
|
|||||||
public abstract void codegen(ClassFile classfile, CodeAttribute code, Vector paralist)
|
public abstract void codegen(ClassFile classfile, CodeAttribute code, Vector paralist)
|
||||||
throws JVMCodeException;
|
throws JVMCodeException;
|
||||||
// ino.end
|
// 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
|
// ino.end
|
||||||
|
Loading…
Reference in New Issue
Block a user