mirror of
https://github.com/irmen/prog8.git
synced 2026-04-26 20:17:57 +00:00
compile time evaluation of constant rangecheck
This commit is contained in:
@@ -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 -> {}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user