mattmoore
05/27/2020, 12:29 AMKtCallExpression
node. Is KtCallExpression
is related in any way to KtCallableReferenceExpression
? I quickly put together a branch to add a meta matcher for String.callExpression
but noticed when I got to the KtPsiFactory
that there is no method there for creating a KtCallExpression
. Which leads me to believe this is not possible at the moment since PSI might not support it?
Example of what I'm talking about: https://github.com/arrow-kt/arrow-meta/compare/master...mattmoore:call-expressions?diff=unified#diff-2ab9610fb1adf0fd2d58e144d4097e56R122
Perhaps there's another way to hook into KtCallExpression
that I'm overlooking...Imran/Malic
05/27/2020, 3:51 PMKtCallExpression
:
Below you see two examples one in a KtDotQualifiedExpression and another as part of the KtProperty.
Most of the time, those are sub tree’s of different types of composite tree’s like KtExpression, KtProperty and others. What you could do if you want to create such a function is to use for instance createExpression
and dissect the KtCallExpression from the KtExpression if there is one.
But there are multiple variants to get those.
If you need help, feel free to ping me.Imran/Malic
05/27/2020, 3:52 PMImran/Malic
05/27/2020, 3:55 PMKtSimpleNameExpression
is created. One can do the same for this case https://github.com/JetBrains/kotlin/blob/66111eb9c6b63fa8f91be9fb30408e8a7be706f0/compiler/psi/src/org/jetbrains/kotlin/psi/KtPsiFactory.kt#L330
There are also other possibilities like traversalmattmoore
05/27/2020, 10:14 PMcreateExpression
working. To your point about whether I need this yet for the problem I'm working on (a plugin to implement pattern matching) I think I realize I may not need to hook on KtCallExpression
just yet. Using the other types that are already implemented might be sufficient for now.Imran/Malic
05/27/2020, 10:19 PMmattmoore
05/28/2020, 3:30 AMKtCallExpression
may actually be what I need. I created a WIP PR as I still need to look into some further details and how they affect pattern matching. https://github.com/arrow-kt/arrow-meta/pull/648Imran/Malic
05/28/2020, 5:42 AM