toshok/echojs

support destructuring assignments

toshok opened this issue · 1 comments

e.g.:

let a,b;
[a,b] = [1,2];
({a,b} = {a:"hello", b:"goodbye"});

The version of esprima we're using doesn't parse them yet, and we also don't support them. We'll need to introduce a fresh binding for the rhs to desugar things properly, so we'll end up with something like this for the above:

let a,b;
let destruct_tmp01, destruct_tmp02;
destruct_tmp01 = [1,2],a=destruct_tmp01[0],b=destruct_tmp01[1];
destruct_tmp02 = {a:"hello", b:"goodbye"}, a=destruct_tmp02.a, b=destruct_tmp02.b;

this is fixed