AdaCore / libadalang

Ada semantic analysis library.
https://www.adacore.com
Other
147 stars 42 forks source link

Add a new property to query the kind of a CallExpr #926

Closed thvnx closed 2 years ago

thvnx commented 2 years ago

Add a new property CallExpr.kind to query the kind of a CallExpr (call, array slice, array index, or type conversion). It returns a CallExprKind enum value.

TN: UC22-030

thvnx commented 2 years ago

More general comment: It is said in the original ticket that this work could allow removing some duplicated logic. Could you find any opportunities to do so?

Actually, not really. I just simplified Name.is_constant property but I didn't find any other place where it would be beneficial to call Name.kind. I could move the code for is_call, or is_array_slice here and call kind where they are used, not sure it worth the effort though.

Roldak commented 2 years ago

I could move the code for is_call, or is_array_slice here and call kind where they are used, not sure it worth the effort though.

I don't think it's a good idea either. Let's leave it like that then, thanks for investigating!