PsiMethodCallExpression - checking parameter instance Follow
With a PsiMethodCallExpression, is there a way to find the expressions
used as parameters to that method call? Can you interrogate the
parameters instances to see if any of the objects is the same instance
(not just same type) as the containing class? In other words, I want to
identify whether the method call is using 'this' as a parameter as, for
example, here where I want to pinpoint the first addInstance but skip
the second:
class Test {
public void method() {
Utility.addInstance(this);
Utility.addInstance(new Test());
}
}
If there isn't a way from PsiMethodCallExpression, is there an alternative?
TIA,
Jon
Please sign in to leave a comment.
getArgumentList() contains PsiThisExpression
Jon Steelman wrote:
--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"
Thanks!
Maxim Mossienko wrote:
>> With a PsiMethodCallExpression, is there a way to find the expressions
>> used as parameters to that method call? Can you interrogate the
>> parameters instances to see if any of the objects is the same instance
>> (not just same type) as the containing class? In other words, I want
>> to identify whether the method call is using 'this' as a parameter as,
>> for example, here where I want to pinpoint the first addInstance but
>> skip the second:
>> class Test {
>> public void method() {
>> Utility.addInstance(this);
>> Utility.addInstance(new Test());
>> }
>> }
>> If there isn't a way from PsiMethodCallExpression, is there an
>> alternative?