Hi, say I wanted to transform a property (or funct...
# arrow
j
Hi, say I wanted to transform a property (or function) using kotlin-meta. Can I also find and transform all the places in a project where said property is used? (Like refactoring would do)
Copy code
property(ctx, { ... }) { prop: KtProperty ->

    // now where is this property used?

    Transform.replace(
        replacing = prop,
        newDeclaration = ...
    )
}
r
Not in that case because use site information or call resolution requires analysis to be completed and those transformations happen before that. You can do it in the backend IR though inspecting the Module files and creating your own call graph. Additionaly Transform.replace is going to disappear because it does not provide a way for the IDE to recognize the transformations nor there is one possible at the moment. We are waiting for FIR to stabilize and hoping it would provide a frontend compiler api.
j
Thanks! I'll look into that 😀