Another possible JS related bug: I'm trying to ext...
# compiler
r
Another possible JS related bug: I'm trying to extract the value of a top level constant property (i.e.
const val prop = "..."
). I'm using
context.referenceProperties(name).single().owner.backingField!!.initalizer!!.expression as IrConst<String>
and it works fine on JVM, however on JS
backingField.expression
is
IrErrorExpressionImpl: Expression body is not deserialized yet
. I'll make an issue if this is indeed a bug, but wanted to check its not due to me miss-using something (should I just make an issue in the future?).
r
Hi, actually field initializer is considered to be private module data and shouldn’t be accessible.
r
Are there plans for a way to access const properties' values then? It seems like something that should be accessible.
r
I think yes at least constant properties seems like they could be accessible. But I definitely cannot promise that for general property.
BTW could you please create an YT issue about constant properties
When you say "field initializer is considered to be private module data", you mean that we won't be able to access initializers in already compiled code/other modules? I assume we will still be able to access field initializers for the code we are transforming?
r
Let me make it a bit clear. You have a full access to any currently compiling module data including any private/local declaration, initializer and so on. If we are talking about dependency in that case you have access only to its API “surface” which includes publicly accessible declarations and some exceptions (one of them going to be constant initializer)
👍 1