-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Fix printing BigIntLiterals/DecimalLiterals with compact option #12424
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
Conversation
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/33642/ |
| const raw = this.getPossibleRaw(node); | ||
| if (!this.format.minified && raw != null) { | ||
| this.token(raw); | ||
| this.word(raw); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicolo-ribaudo @JLHwung we could also use this.number here if clearer (though there's logic in there for handling integer tokens), thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe let's add a comment explaining that we use word instead of number to avoid that additional logic?
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 84fb9a1:
|
JLHwung
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could add a compact: true test runner for @babel/generator, like we did for estree in @babel/parser. Essentially we shall enforce the following idempotent invariance:
generate(ast, { compact: true }) === generate(parse(generate(ast, { compact: true })), { compact: true })|
@JLHwung yeah been thinking of doing this for a while, will take a look |
Uh oh!
There was an error while loading. Please reload this page.