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

Replace null in ArrayExpression and ArrayPattern with Null node #9857

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

fisker
Copy link
Member

@fisker fisker commented Dec 10, 2020

Description

Add a dummy node for null in array, so we can attach comments. This solution should work for other similar problem, like #9787 (comment) or for(;;);

Fixes #1013
Fixes #9299

Checklist

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory).
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

@fisker fisker marked this pull request as ready for review December 10, 2020 10:31
@@ -272,4 +277,36 @@ function includeShebang(ast, options) {
}
}

function replaceNullElements(node, ast, options) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment that explain motivation to introduce Null node or link to this PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Member

@sosukesuzuki sosukesuzuki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thorn0 Could you review?

@brodybits
Copy link
Contributor

brodybits commented Jan 8, 2021

This solution should work for other similar problem, like #9787 (comment) or for(;;);

Are these tracked somewhere?

By for(;;) do you mean something like for(/*a*/;;)?

And I thought of one more case:

call(foo,,/*a*/,/*b*/,bar)

@fisker
Copy link
Member Author

fisker commented Jan 13, 2021

By for(;;) do you mean something like for(/a/;;)?

Yes, opened an issue to track this #10046

@so1ve
Copy link
Contributor

so1ve commented Aug 3, 2023

🤔 Still blocked?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants