When transforming an assignment expression, how do...
# compiler
c
When transforming an assignment expression, how do the different `source`s in the transformed
FirStatement
map to each element of the original assignment expression? Given
MyClass().foo = 2
, I want people to be able to ctrl+click on
foo
to link to
MyClass#foo: String
, and ctrl+click on
=
to link to
MyClass#set-foo(Int)
. The attached screenshot is what I'm returning from the
FirAssignmentAltererExtension
, with
variableAssignment: FirVariableAssignment
and
targetProperty: FirPropertySymbol
. I can only identify those two
source
positions to modify: the call's source and the callee's source. Setting it up like shown makes both
foo
and the
=
link to the same place.
I know the sources' values can affect the original expression, because either setting the callee reference's source to
variableAssignment.source
or making them fake elements makes the property not have any link. I've tried different permutations of the two to no effect, so I'm wondering if there's any way to add extra metadata or something.