could `IrFunction.setReceiverParameter` be made p...
# compiler
z
could
IrFunction.setReceiverParameter
be made public somehow? It does a fairly non-trivial amount of work that would be useful, especially in migrating to the new API
d
cc @Wojciech Litewka
w
Hi, it could of course, but when would you need to call it yourself? This function is simply what `dispatch/extensionReceiverParameter`'s setter calls, if you are uncertain which receiver to set, you can just
(if (...) func.DRP else func.ERP) = ...
. (Just to be clear,
setReceiverParameter
is an implementation of the deprecated API. If made public, it would be marked as deprecated too.)
With the new API the way to replace or insert any parameter is via changing the
IrFunction.parameters
list. I know it is less convenient as it's
var List
, we might change it to
MutableList
in the future. It will also apply the same logic as
setReceiverParameter
. Btw. all of that logic is only needed to bridge the old API with the new one, it will be gone when the latter is gone.
z
I think the main concern is needing to update the indices of all the other parameters after them when inserting later
w
Actually not, indices in
IrValueParameter
are (and will be) updated automatically. You of course need to update argument list of calls, but that's not new, right?