Hi, I'm looking into making an IR compiler plugin ...
# compiler
f
Hi, I'm looking into making an IR compiler plugin with 1.4.0, but I seem to be having an issue with my Transformer. For reference, my code is here: https://gist.github.com/FalseHonesty/c76cef82585b0f5f0052a01e54d520b3. The
lower
function in my Transformer class seems to be called correctly, but my two visitors never seem to be called. I attempted to debug what happens in the
lower
function, but execution gets passed to a class called
IRDeclarationBase
when visiting the
main
function, which is a class I can't find the source for. Nothing seems to be called after that. Does anyone have any ideas as to what I'm doing wrong?
s
Hey, did you try to dump IR (you can use
ir2stringWhole
) that this function gets converted into? Does it have
SetVariable
expression? You can also try to visit more generic call, I assume IR could have a bit different representation than you'd expect.
f
Ahh, I didn't know about the
ir2stringWhole
function, that's very handy. It turns out, it looks like this https://gist.github.com/FalseHonesty/cdb670fe4c640a5bfe8fd899de2b9a02, which now makes sense. Thank you so much! Also, do you happen to know if/how I could check if the class being instantiated by a
IrConstructorCall
extends a different class?
Nevermind, I found out how I believe 🙂