Chachako
01/05/2022, 3:20 PMConstantExpressionEvaluator
in the frontend. Is there something similar in the backend?rnett
01/05/2022, 6:47 PMIrConst.value
? Is what you're trying to access not an IrConst
?Chachako
01/05/2022, 8:13 PMCompileTimeValue
calls to an expression as constant
val a = "abc"
val b = a + ".bb"
the example above will be automatically evaluated as <http://abc.bb|abc.bb>
Chachako
01/05/2022, 8:17 PMYoussef Shoaib [MOD]
01/06/2022, 10:17 AM"abc" + ".bb"
, but then you need an extra check to inline an IrConcat into one string if all of its arguments are IrConstChachako
01/06/2022, 7:02 PMYoussef Shoaib [MOD]
01/06/2022, 7:17 PMYoussef Shoaib [MOD]
01/06/2022, 7:20 PMChachako
01/06/2022, 7:37 PMdmitriy.novozhilov
01/07/2022, 12:49 PMChachako
01/07/2022, 1:08 PMinterpret
method in this class and there is a IrConstTransfomer
. Can you briefly summarize what they will do? I will be grateful!dmitriy.novozhilov
01/07/2022, 1:31 PMinterpret
gets some expression and evaluates it to some constant expression if it can
Assume following code:
fun pow(x: Int, p: Int): Int {
var res = 1
for (_ in 1..p) {
res *= x
}
return res
}
fun test() {
val x = pow(2, 10) // (1)
}
If you pass IrCall
for pow(2, 10)
it will return IrConstExpression(1024)
dmitriy.novozhilov
01/07/2022, 1:33 PM@Ivan Kylchik
for specific detailsChachako
01/07/2022, 2:35 PMrnett
01/07/2022, 5:34 PMdmitriy.novozhilov
01/07/2022, 6:45 PMYoussef Shoaib [MOD]
01/08/2022, 11:09 PMdmitriy.novozhilov
01/09/2022, 10:22 AMIt's better to ask @Ivan Kylchik for specific details
Ivan Kylchik
01/09/2022, 1:26 PM