Is there a simple way to find out the parent of an...
# compiler
a
Is there a simple way to find out the parent of an IrExpression i.e. the IrSimpleFunction (or IrFile etc...) that its being called from?
y
There's some IR visitor you're meant to use, something like
IrDeclarationParentVisitor
or something that keeps a stack of parent declarations in your state.
a
You mean this thing?
IrElementTransformerVoidWithContext
?
y
YEP that's the one. The "context" here is the parent stack
a
You mean the IrSymbol thing inside the Scope ?
y
I think? I believe IrSymbol has a way of getting the associated declaration
a
Ah, it's the
protected val currentDeclarationParent
that I'm going after. Thanks!