calculate the "empty" ConstOperator

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@452 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 94da811de1
commit a2bee154c0
  1. 17
      jode/jode/expr/ConstantArrayOperator.java

@ -33,7 +33,22 @@ public class ConstantArrayOperator extends NoArgOperator {
values = new Expression[size];
argType = (type instanceof ArrayType)
? Type.tSubType(((ArrayType)type).getElementType()) : Type.tError;
empty = new ConstOperator(argType, "0");
Object emptyVal;
if (argType == type.tError || argType.isOfType(Type.tUObject))
emptyVal = null;
else if (argType.isOfType(Type.tBoolUInt))
emptyVal = new Integer(0);
else if (argType.isOfType(Type.tLong))
emptyVal = new Long(0);
else if (argType.isOfType(Type.tFloat))
emptyVal = new Float(0);
else if (argType.isOfType(Type.tDouble))
emptyVal = new Double(0);
else
throw new IllegalArgumentException("Illegal Type: "+argType);
empty = new ConstOperator(emptyVal);
empty.setType(argType);
empty.makeInitializer();
}

Loading…
Cancel
Save