Array destructuring by romdotdog · Pull Request #2008 · AssemblyScript/assemblyscript · GitHub
Skip to content

Array destructuring - #2008

Closed
romdotdog wants to merge 60 commits into
AssemblyScript:mainfrom
romdotdog:array-destructuring
Closed

romdotdog wants to merge 60 commits into
AssemblyScript:mainfrom
romdotdog:array-destructuring

Conversation

@romdotdog

@romdotdog romdotdog commented Jul 26, 2021 •

Copy link
Copy Markdown
Contributor
  • I've read the contributing guidelines
  • I've added my name and email to the NOTICE file

This is a work in progress almost finished finished PR to hopefully implement array destructuring

@romdotdog
romdotdog marked this pull request as draft July 26, 2021 18:20
Comment thread src/compiler.ts Outdated
@romdotdog

Copy link
Copy Markdown
Contributor Author

@trusktr

trusktr commented Jul 28, 2021

Copy link
Copy Markdown
Member

🥳

@trusktr
trusktr requested review from MaxGraey and dcodeIO July 28, 2021 21:19
@romdotdog

Copy link
Copy Markdown
Contributor Author

Parser test parser/continue-on-error.ts was failing, now fixed

@romdotdog

romdotdog commented Aug 10, 2021 •

Copy link
Copy Markdown
Contributor Author

That's weird, it seems the features test failed because of the nvm GitHub action.
cc: @dcodeIO

please sync with main

@MaxGraey,
Are you talking to me? Is there any trouble with merging this? GitHub is telling me that there are no conflicts :)

@MaxGraey

Copy link
Copy Markdown
Member

Yeah, no need, that's why I hid that message. By the way, have you seen the other dcodeIO suggestions?
#2008 (comment)
#2008 (comment)

@romdotdog

Copy link
Copy Markdown
Contributor Author

Thank you! I completely missed those. I'll implement those tomorrow

@romdotdog
romdotdog requested a review from dcodeIO August 12, 2021 00:49
@MaxGraey

MaxGraey commented Aug 12, 2021 •

Copy link
Copy Markdown
Member

Could you also add destructing tests for typed and static arrays?

let arr = new Int32Array(3);
arr[0] = 1;
arr[1] = 2;
arr[2] = 3;
let [a, b, c] = arr;
assert(a == 1);
assert(b == 2);
assert(c == 3);

Comment thread tests/parser/array-destructuring.ts
@romdotdog

Copy link
Copy Markdown
Contributor Author

BTW, for the next PR I think I'm going to replace binding patterns with array literals for more flexible parsing and for normal assignments and declarations to have more similar code

@MaxGraey

Copy link
Copy Markdown
Member

@romdotdog It seems some tests have failed

Comment thread tests/parser/array-destructuring.ts Outdated
@dcodeIO

dcodeIO commented Aug 20, 2021

Copy link
Copy Markdown
Member

I like the idea of reusing array literal expressions here, would be cool if it could be done right away :)

@romdotdog

romdotdog commented Aug 20, 2021 •

Copy link
Copy Markdown
Contributor Author

I like the idea of reusing array literal expressions here, would be cool if it could be done right away :)

It's an "issue" that's only worth fixing when further developing array destructuring; I don't think this base PR is worth delaying more for something that can be included in the next PR, if that makes sense (:

@romdotdog

romdotdog commented Aug 21, 2021 •

Copy link
Copy Markdown
Contributor Author

BTW, I couldn't reproduce the failed compiler test on my machine.
Not to mention that it failed without me making any changes to the compiler test or the compiler itself.. Maybe someone could point me in the right direction?

EDIT: Thanks to MaxGraey, I was able to reproduce and make new fixtures after pulling from upstream.

@romdotdog

Copy link
Copy Markdown
Contributor Author

Had some extra time, pulled from upstream and squashed the resulting bugs.
I also removed the custom BindingPatternExpression and replaced it with array and object literals, as requested.

I hope this can be merged soon!

@romdotdog

romdotdog commented Nov 28, 2021 •

Copy link
Copy Markdown
Contributor Author

@romdotdog romdotdog closed this Nov 28, 2021
@trusktr trusktr mentioned this pull request Jun 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants