assemblyscript
assemblyscript copied to clipboard
Implement Array Destructuring [WIP]
Per https://github.com/AssemblyScript/assemblyscript/issues/1473, Im stated to implement destructuring assignment. At this step, I will implement the array destructuring.
Please feel free to comment on the progress.
- [x] I've read the contributing guidelines
@dcodeIO May I ask for your help with passing a test here. The same wat
file array-destructuring.untouched.wat
is passing on my local machine but fail the diff in the CI. I run Node version 14.16.1
on a macOS 10.13.6
.
@MaxGraey @dcodeIO took me a while to get the tests to pass (needed to rebase - I guess the tests runs agains master merge not my current branch dah...).
I know you asked to use a local wasm
variable to cache the callable expresionRef
. Which I did, but during my experiments I implemented a local JS variable const _func = func(), a = _func[0]
similar to how TS transpiles to ES5.
I can revert back to use a local wasm
variable:
// part of "compileElementAccessExpression()" method in compilers.ts
let thisArg = this.compileExpressionMaybeCached(targetExpression, thisType, destructingKey); // Try to hit a cache result
Where compileExpressionMaybeCached
uses scopedDummyLocal
.
The only issues is that I got an error from the optimization test because "the Binaryen IR tree is not flat".
This PR has been automatically marked as stale because it has not had recent activity. It will be closed in one week if no further activity occurs. Thank you for your contributions!
This PR has been automatically closed due to lack of recent activity, but feel free to reopen it as long as you merge in the main branch afterwards.