When calling a delegate constructor, I need to pas...
# compiler
a
When calling a delegate constructor, I need to pass arguments. It seems that this argument list needs to be a
FirResolvedArgumentList
which requires a
FirExpression
and a
FirValueParameter
. The latter I have but I'm unsure about the former. I'm accepting parameters that I'd like to reference. What expression should I use to reference a value parameter? I tried
buildSingleExpressionBlock
but that doesn't seem to be it
Alright, it seems the expression is generated using
toQualifiedAccess
. But I need to reference the delegate constructor's parameters but all I have is a
FirClassSymbol
which can give me a
FirValueParameterSymbol
but I need a
FirValueParameter
. Is there a sane way to convert between symbols and elements without using
.fir
?
j
You should avoid any
build*
and only use
create*
method except you don’t find any
create*
method
Why don’t you want to use
.fir
?
a
Because it's marked as
@SymbolInternals
j
I am using it everywhere, cc @dmitriy.novozhilov why is it marked as internal?
d
In Analysis API (IDE) mode there is no guarantee, that fir under the symbol you get from scope/provider will be resolved to the phase you are on right now So it's ok to access
symbol.fir
itself, but you can't rely on any data in it without calling lazy resolve (which is done under the hood when you use accessors on symbols)