While declaration destructuring is implemented (aka you can declare some variables where the LHS destructors the RHS value), the assignment part is not implemented
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
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.
While declaration destructuring is implemented (aka you can declare some variables where the LHS destructors the RHS value), the assignment part is not implemented
https://github.com/kaleidawave/ezno/blob/7eb3a31b02f7fd9a2e6055951948c250fd4e8719/checker/src/context/environment.rs#L412-L413
For
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 kindhttps://github.com/kaleidawave/ezno/blob/7eb3a31b02f7fd9a2e6055951948c250fd4e8719/checker/src/synthesis/variables.rs#L198
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.