smeup / jariko

a JAva virtual machine Rpg Interpreter written in KOtlin
Apache License 2.0
65 stars 11 forks source link

Refactor/ls24003753/function call to array access recursive #592

Closed dom-apuliasoft closed 1 month ago

dom-apuliasoft commented 1 month ago

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:

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:

Checklist: