Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement destructuring assignment (declaration works already) #106

Closed
kaleidawave opened this issue Jan 5, 2024 · 0 comments · Fixed by #127
Closed

Implement destructuring assignment (declaration works already) #106

kaleidawave opened this issue Jan 5, 2024 · 0 comments · Fixed by #127
Labels
bug Something isn't working checking Issues around checking good-first-issue PRs welcome 🙏

Comments

@kaleidawave
Copy link
Owner

While declaration destructuring is implemented (aka you can declare some variables where the LHS destructors the RHS value), the assignment part is not implemented

Assignable::ObjectDestructuring(_) => todo!(),
Assignable::ArrayDestructuring(_) => todo!(),

For

let array1 = [1, 2, 3];
let a = 0, b = 0;
[a, b] = array1;

a satisfies 1;
b satisfies "hello world";

to work. It should be very similar (but different as it is acting on intermediate level rather than AST) to the assign_fields function used for the declaration kind

fn assign_to_fields<T: crate::ReadFromFS>(

The implementation should be very similar to the current behaviour for assigning to a variable, however it needs to do the recursive assignment and get_property things from destructuring.

@kaleidawave kaleidawave added bug Something isn't working checking Issues around checking good-first-issue PRs welcome 🙏 labels Jan 5, 2024
lemueldls added a commit to lemueldls/ezno that referenced this issue Mar 26, 2024
@kaleidawave kaleidawave linked a pull request Mar 28, 2024 that will close this issue
kaleidawave added a commit that referenced this issue Apr 10, 2024
* Fixes #98 & #106
* Checks `this` type in functions
* Improves destructuring API
* Specification test 200

---------

Co-authored-by: Ben <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working checking Issues around checking good-first-issue PRs welcome 🙏
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant