The locals property of FunctionInfo is an array where the elements are either parameters and/or names of the locals declared in the corresponding function.
For instance, the locals for f in the code snippet are p1 and p2; for g the values are g1 and g2
Currently, the plugin was implemented with the idea that locals only contain locally declared values and thus not parameters, which can thus result in out-of-range exceptions or in the display of redundant information in the variables view of the plugin.
The easiest fix, in my opinion, is to let the wat2wasm tool print alongside the local name also the index of that local name. Thanks to the index we could easily distinguish between the parameters and locals declared within the function. I made a PR for these changes in the tool.
The
locals
property ofFunctionInfo
is an array where the elements are either parameters and/or names of the locals declared in the corresponding function.For instance, the locals for f in the code snippet are p1 and p2; for g the values are g1 and g2
Currently, the plugin was implemented with the idea that locals only contain locally declared values and thus not parameters, which can thus result in out-of-range exceptions or in the display of redundant information in the
variables
view of the plugin.The easiest fix, in my opinion, is to let the
wat2wasm
tool print alongside the local name also the index of that local name. Thanks to the index we could easily distinguish between the parameters and locals declared within the function. I made a PR for these changes in the tool.