Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fully implement the spread operator #619

Closed
elasmojs opened this issue Aug 9, 2020 · 6 comments
Closed

Fully implement the spread operator #619

elasmojs opened this issue Aug 9, 2020 · 6 comments
Labels
E-Medium Medium difficulty problem execution Issues or PRs related to code execution good first issue Good for newcomers Hacktoberfest Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com parser Issues surrounding the parser

Comments

@elasmojs
Copy link
Contributor

elasmojs commented Aug 9, 2020

Hi

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

expected output: 6
got: undefined

thanks

@elasmojs elasmojs added the bug Something isn't working label Aug 9, 2020
@jasonwilliams jasonwilliams reopened this Sep 30, 2020
@jasonwilliams
Copy link
Member

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

@elasmojs
Copy link
Contributor Author

elasmojs commented Oct 2, 2020

@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

@Razican
Copy link
Member

Razican commented Oct 4, 2020

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

@Razican Razican changed the title Unexpected output in Spread syntax Fully implement the spread operator Oct 4, 2020
@Razican Razican added E-Medium Medium difficulty problem Hacktoberfest Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com good first issue Good for newcomers execution Issues or PRs related to code execution parser Issues surrounding the parser and removed bug Something isn't working labels Oct 4, 2020
@dvtkrlbs
Copy link

dvtkrlbs commented Oct 5, 2020

I can grab this issue

@dvtkrlbs
Copy link

dvtkrlbs commented Oct 5, 2020

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)

@croraf
Copy link
Contributor

croraf commented Oct 10, 2020

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 #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.

@dvtkrlbs dvtkrlbs removed their assignment Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-Medium Medium difficulty problem execution Issues or PRs related to code execution good first issue Good for newcomers Hacktoberfest Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com parser Issues surrounding the parser
Projects
None yet
Development

No branches or pull requests

6 participants