diff --git a/src/mycompiler/myclass/FormalParameter.java b/src/mycompiler/myclass/FormalParameter.java index c3ef09f7..cef327a5 100755 --- a/src/mycompiler/myclass/FormalParameter.java +++ b/src/mycompiler/myclass/FormalParameter.java @@ -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; diff --git a/src/mycompiler/mystatement/PostDecExpr.java b/src/mycompiler/mystatement/PostDecExpr.java index 2e9a1094..91c0f37c 100755 --- a/src/mycompiler/mystatement/PostDecExpr.java +++ b/src/mycompiler/mystatement/PostDecExpr.java @@ -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 diff --git a/src/mycompiler/mystatement/PostIncExpr.java b/src/mycompiler/mystatement/PostIncExpr.java index 69d520b5..c17300d0 100755 --- a/src/mycompiler/mystatement/PostIncExpr.java +++ b/src/mycompiler/mystatement/PostIncExpr.java @@ -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 getNumericTypes(){ - Vector 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(); diff --git a/src/mycompiler/mystatement/PreDecExpr.java b/src/mycompiler/mystatement/PreDecExpr.java index 0576c46d..5f0c0718 100755 --- a/src/mycompiler/mystatement/PreDecExpr.java +++ b/src/mycompiler/mystatement/PreDecExpr.java @@ -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 diff --git a/src/mycompiler/mystatement/PreIncExpr.java b/src/mycompiler/mystatement/PreIncExpr.java index 839b154f..de1e4de5 100755 --- a/src/mycompiler/mystatement/PreIncExpr.java +++ b/src/mycompiler/mystatement/PreIncExpr.java @@ -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 diff --git a/src/mycompiler/mystatement/UnaryExpr.java b/src/mycompiler/mystatement/UnaryExpr.java index 6b990df1..86b32dd3 100755 --- a/src/mycompiler/mystatement/UnaryExpr.java +++ b/src/mycompiler/mystatement/UnaryExpr.java @@ -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 getNumericTypes(){ + Vector 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