1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-12-21 14:30:21 +00:00

Fixed constant inlining inside constant value lists.

This commit is contained in:
Jesper Gravgaard 2017-12-25 20:53:52 +01:00
parent e314794f0b
commit bd3c26b5ec

View File

@ -107,6 +107,22 @@ public class VariableReplacer {
} }
return new ConstantBinary(aliasLeft, constantBinary.getOperator(), aliasRight); return new ConstantBinary(aliasLeft, constantBinary.getOperator(), aliasRight);
} }
} else if(rValue instanceof ConstantArray) {
ConstantArray constantArray = (ConstantArray) rValue;
ArrayList<ConstantValue> replacementList = new ArrayList<>();
boolean any = false;
for (ConstantValue elemValue : constantArray.getElements()) {
RValue elemReplacement = getReplacement(elemValue);
if(elemReplacement!=null) {
replacementList.add((ConstantValue) elemReplacement);
any = true;
} else{
replacementList.add(elemValue);
}
}
if(any) {
return new ConstantArray(replacementList, constantArray.getElementType());
}
} }
// No replacement found - return null // No replacement found - return null