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

The cli parameter --dump-ast Json panics #1920

Closed
raskad opened this issue Mar 12, 2022 · 2 comments
Closed

The cli parameter --dump-ast Json panics #1920

raskad opened this issue Mar 12, 2022 · 2 comments
Labels
ast Issue surrounding the abstract syntax tree bug Something isn't working cli Issues and PRs related to the Boa command line interface. E-Easy Easy good first issue Good for newcomers
Milestone

Comments

@raskad
Copy link
Member

raskad commented Mar 12, 2022

Describe the bug
Whey trying to output the AST with the cli parameter --dump-ast Json or --dump-ast JsonPretty boa panics.

To Reproduce

This JavaScript code reproduces the issue:
run the following code with cargo run -- --dump-ast Json

let a = 1

thread 'main' panicked at 'could not convert AST to a pretty JSON string: Error("can only flatten structs and maps (got a sequence)", line: 0, column: 0)', boa_cli/src/main.rs:181:30

Expected behavior
Print the AST in JSON format.

@raskad raskad added bug Something isn't working E-Easy Easy cli Issues and PRs related to the Boa command line interface. ast Issue surrounding the abstract syntax tree labels Mar 12, 2022
@Razican Razican added this to the v0.15.0 milestone Mar 14, 2022
@Razican Razican added the good first issue Good for newcomers label Mar 18, 2022
@hemantku
Copy link

Hi, My name is Vineet. I would work on this issue if this is still available

@bors bors bot closed this as completed in e73c3fd Mar 20, 2022
@raskad
Copy link
Member Author

raskad commented Mar 20, 2022

Hi @hemantku, thank you for your interest in contributing to boa!
(Un)fortunately this will already be fixed in #1959

I noticed, that we don't have many good first issues currently. If you do not find one that looks interesting to you, I recommend heading to our conformance page and checking out some currently failing tests, for which we do not have an issue open. That may be a good starting point if you want to help us improve our test coverage :)

Razican pushed a commit that referenced this issue Jun 8, 2022
Some of the fields in AST structs were both

1. Arrays
2. Marked as 'flatten'

This is illegal per serde docs (and doesn't really make sense).
The fix is to remove the attribute.

See: https://serde.rs/attr-flatten.html
Fixes: #1920

Co-authored-by: Taras Boiko <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ast Issue surrounding the abstract syntax tree bug Something isn't working cli Issues and PRs related to the Boa command line interface. E-Easy Easy good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants