assemblyscript icon indicating copy to clipboard operation
assemblyscript copied to clipboard

Implement Array Destructuring [WIP]

Open bnbarak opened this issue 3 years ago • 2 comments

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

bnbarak avatar Apr 06 '21 15:04 bnbarak

@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.

bnbarak avatar Apr 12 '21 20:04 bnbarak

@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".

bnbarak avatar Apr 19 '21 19:04 bnbarak

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!

github-actions[bot] avatar Nov 26 '23 23:11 github-actions[bot]

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.

github-actions[bot] avatar Dec 04 '23 23:12 github-actions[bot]