CompareToNullExpression does not visitTransforms

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

CompareToNullExpression does not visitTransforms

Saravanan Palanichamy
Hello

I am running into an issue with the ClassCodeExpressionTransformer. Why does CompareToNullExpression not visit any expressions it owns? Should it not transform objectExpression? I am trying to change property access into my custom method calls and if a compare to null expression with property access is used as part of an if condition, it does not transform it

if (a.b == null) {
}

I am trying to change this to

if (a.get("b") == null) {}

The AST works out to a booleanexpression holding a CompareToNullExpression with a property expression. When I visit this AST with a transformer, it does not try to transform the property expression

Any help is appreciated

regards
Saravanan
Reply | Threaded
Open this post in threaded view
|

RE: CompareToNullExpression does not visitTransforms

Milles, Eric (TR Tech, Content & Ops)
Reply | Threaded
Open this post in threaded view
|

Re: RE: CompareToNullExpression does not visitTransforms

Saravanan Palanichamy


On 2020/09/08 14:59:46, "Milles, Eric (TR Technology)" <[hidden email]> wrote:
> https://github.com/apache/groovy/pull/1361 
>
Thank you Eric,

I'll give this a shot