Siubaak / sval

A javascript interpreter written in javascript
https://jsbin.com/kehahiqono/edit?js,console
MIT License
379 stars 50 forks source link

bug: array destructured variable is not defined #94

Closed alsakhaev closed 10 months ago

alsakhaev commented 1 year ago

Array destructuring doesn't work. Test code:

[[1,2,3]].forEach(([a,b,c]) => console.log(a+b+c))

Received

ReferenceError: a is not defined
    at bt (https://unpkg.com/sval:1:102748)
    at Rt (https://unpkg.com/sval:1:113019)
    at Ir (https://unpkg.com/sval:1:147428)
    at https://unpkg.com/sval:1:148063
    at Array.forEach (<anonymous>)
    at CallExpression (https://unpkg.com/sval:1:108397)
    at Ft (https://unpkg.com/sval:1:114182)
    at ExpressionStatement (https://unpkg.com/sval:1:110193)
    at Ft (https://unpkg.com/sval:1:114182)
    at Program (https://unpkg.com/sval:1:114079)

Expected Result

6
alsakhaev commented 10 months ago

👍