https://kotlinlang.org logo
#compiler
Title
# compiler
j

Justin Tullgren

10/06/2023, 8:03 PM
Hi, to create a string primitive and insert it into the IR, is there a factory to use? IE
val stringVal = irFactory.irString("somestring")
?
j

Javier

10/06/2023, 8:29 PM
Maybe
toIrConst
j

Justin Tullgren

10/06/2023, 8:29 PM
hmm okay, lemme try
is that an extension on some class?
or do you have the import?
j

Javier

10/06/2023, 8:31 PM
Copy code
“foo”.toIrConst(irBuiltIns.stringType)
👌 1
Copy code
import org.jetbrains.kotlin.ir.interpreter.toIrConst
j

Justin Tullgren

10/06/2023, 8:34 PM
many thanks 🙏
🙂 1
this worked great! thanks!