use of soot.tagkit.FloatConstantValueTag in project robovm by robovm.
the class MethodCompiler method initializeClassFields.
private void initializeClassFields() {
for (SootField field : sootMethod.getDeclaringClass().getFields()) {
if (!field.isStatic()) {
continue;
}
for (Tag tag : field.getTags()) {
Value value = null;
if (tag instanceof DoubleConstantValueTag) {
DoubleConstantValueTag dtag = (DoubleConstantValueTag) tag;
value = new FloatingPointConstant(dtag.getDoubleValue());
} else if (tag instanceof FloatConstantValueTag) {
FloatConstantValueTag ftag = (FloatConstantValueTag) tag;
value = new FloatingPointConstant(ftag.getFloatValue());
} else if (tag instanceof IntegerConstantValueTag) {
IntegerConstantValueTag itag = (IntegerConstantValueTag) tag;
value = new IntegerConstant(itag.getIntValue());
IntegerType type = (IntegerType) getType(field.getType());
if (type.getBits() < 32) {
value = new ConstantTrunc((Constant) value, type);
}
} else if (tag instanceof LongConstantValueTag) {
LongConstantValueTag ltag = (LongConstantValueTag) tag;
value = new IntegerConstant(ltag.getLongValue());
} else if (tag instanceof StringConstantValueTag) {
String s = ((StringConstantValueTag) tag).getStringValue();
value = call(ldcString(s), env);
}
if (value != null) {
FunctionRef fn = FunctionBuilder.setter(field).ref();
call(fn, env, value);
}
}
}
}
Aggregations