dop251 / goja

ECMAScript/JavaScript engine in pure Go
MIT License
5.65k stars 381 forks source link

Parser: "recursive" destructuring not working as expected #614

Closed sukus21 closed 2 months ago

sukus21 commented 2 months ago

First of all, thank you SO much for making this. I had just begun making a modified version of the otto parser myself, in order to parse ES6+ features, before I took another look online. This is an amazing piece of work, and is immensely helpful! That being said, I have run into an issue.

I am in the process of writing a JS deminifyer/deobfuscator, and came across a langauge feature, that goja doesn't support. The issue has to do with destructuring arrays within destructured arrays. Below is the specific example I ran into:

// Code from (what I think is) a matrix math function
var [
    [o, a = o, l = a],
    [h, /* issue occurs here */ u = h, c = u] = [0, 0, 0],
    [d, f = d, p = f] = [h, u, c],
    [g, m = g, y = m] = [o, a, l],
] = [/* array values */];
dop251 commented 2 months ago

Thanks for reporting!