In this commit: c5a07cd
I changed from storing the function parameters and local variables in the same data structure to be stored in two separate data structures.
I did this due to F#'s Unit type. Unit indicates no parameters, so when I compile to Wasm I drop it.
So a F# function with 1 Unit parameter becomes a Wasm function with no parameters.
When getting index, I didn't want to remove the Unit parameters, then count.
But this causes issues since Wasm index of params spans both params and locals.
So the following snippet:
let countTo (n) =
let mutable x = 0
while x < n do
x <- x + 1
x
We have the following variables:
- 1 function parameter - n
- 1 local variable - x
Since they're being stored separately, the index of x is turning 0.
I'm putting a temporary fix in place, but probably something I need to revisit.
In this commit: c5a07cd
I changed from storing the function parameters and local variables in the same data structure to be stored in two separate data structures.
I did this due to F#'s Unit type. Unit indicates no parameters, so when I compile to Wasm I drop it.
So a F# function with 1 Unit parameter becomes a Wasm function with no parameters.
When getting index, I didn't want to remove the Unit parameters, then count.
But this causes issues since Wasm index of params spans both params and locals.
So the following snippet:
We have the following variables:
Since they're being stored separately, the index of x is turning 0.
I'm putting a temporary fix in place, but probably something I need to revisit.