compile time evaluation of constant rangecheck

This commit is contained in:
Irmen de Jong
2025-03-01 13:45:11 +01:00
parent 41e963b04b
commit a6ba05d60c
@@ -1360,6 +1360,14 @@ class ContainmentCheck(var element: Expression,
return NumericLiteral.fromBoolean(exists, position)
}
}
is RangeExpression -> {
if(elementConst.type.isInteger) {
val intprogression = (iterable as RangeExpression).toConstantIntegerRange()
if (intprogression!=null) {
return NumericLiteral.fromBoolean(intprogression.contains(elementConst.number.toInt()), position)
}
}
}
else -> {}
}
}