Given two arrays $A and $B and an index $X, if $B contains values that can be used as indices themselves, accessing an item of $A during an access of $B should be valid. For instance:
$A($X) should be valid
$A($B($X)) should be valid as well, but it wasn't
This used to happen because the inner expression $B($X) was detected as a function call when contained in another array access.
To make it work FunctionCall to ArrayAccessExpr rewriting process was refactored in order to allow for recursive rewriting when the index itself is a FunctionCall that needs to be rewritten.
Related to:
589
Checklist:
[x] If this feature involves RPGLE fixes or improvements, they are well-described in the summary.
[x] There are tests regarding this feature
[x] RPGLE code used for tests is easily understandable and includes comments that clarify the purpose of this feature.
[x] The code follows the Kotlin conventions (run ./gradlew ktlintCheck)
[x] The code passes all tests (run ./gradlew check)
[ ] There is a specific documentation in the docs directory
Description
Given two arrays
$A
and$B
and an index$X
, if$B
contains values that can be used as indices themselves, accessing an item of$A
during an access of$B
should be valid. For instance:$A($X)
should be valid$A($B($X))
should be valid as well, but it wasn'tThis used to happen because the inner expression
$B($X)
was detected as a function call when contained in another array access.To make it work
FunctionCall
toArrayAccessExpr
rewriting process was refactored in order to allow for recursive rewriting when theindex
itself is aFunctionCall
that needs to be rewritten.Related to:
589
Checklist:
./gradlew ktlintCheck
)./gradlew check
)docs
directory