Boa: Fully implement the spread operator

Created on 9 Aug 2020  路  6Comments  路  Source: boa-dev/boa

Hi

console.log(sum.apply(null, numbers));

expected output: 6
got: undefined

thanks

good first issue Hacktoberfest parser execution E-Medium

Most helpful comment

I can grab this issue

All 6 comments

@elasmojs could you add more information?
I don't see spread syntax being used here?

@jasonwilliams it is directly from the MDN javascript docs, I have use the first demo example in the link below, hope it helps
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax

The spread operator is not implemented afaik. It just returns the element once.

I can grab this issue

Can i get some guidance on this. I can see that we parse a Spread object. But if i understand correctly the spec defines different behaviour on spreads depending on the context (in function calls, array inits, object inits). I think i need to divide Spread object and change the parsing logic to make them 3 different AST objects. But i am not sure about this.

Also i think debugging.md is a bit outdated it can can dump ast (you need to pass an argument) but it cant find --dump-tokens flag. I can refactor it (and maybe use pico_args for that since clap slows down compile times a lot)

Spread operator is implemented for the arrays, it was partially working before in a wrong implementation, so I did a fix to make a more proper implementation in https://github.com/boa-dev/boa/pull/811.

Can a member of boa adjust the title so it correctly describes what is done here, because also the initial issue comment is completely unclear. And even better would be to close this and open a new issue with correct description and examples.

Was this page helpful?
0 / 5 - 0 ratings