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

Add assertions to ExportNamedDeclaration without from #13957

Merged
merged 4 commits into from Nov 16, 2021

Conversation

sosukesuzuki
Copy link
Member

@sosukesuzuki sosukesuzuki commented Nov 13, 2021

Q                       A
Fixed Issues? N/A
Patch: Bug Fix? Y
Tests Added + Pass? Yes
License MIT

Add assertions to ExportNamedDeclaration without from when importAssertions is enabled.

According to estree spec:

assertions must be an empty array when source is null.

@babel-bot
Copy link
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/49785/

@codesandbox-ci
Copy link

codesandbox-ci bot commented Nov 13, 2021

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 6cd651e:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@sosukesuzuki sosukesuzuki added PR: Bug Fix 🐛 A type of pull request used for our changelog categories pkg: parser Spec: Import Attributes labels Nov 13, 2021
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
@nicolo-ribaudo
Copy link
Member

Ok, it looks like it doesn't support it 😬

Copy link
Contributor

@JLHwung JLHwung left a comment

Choose a reason for hiding this comment

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

We can assign assertions immediately after we have parsed them:

if (expect) {
this.unexpected();
} else {
node.source = null;
Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, node.source = null is called in maybeParseExportNamedSpecifiers and maybeParseExportDeclaration. So we can remove this from here.

@nicolo-ribaudo nicolo-ribaudo merged commit 87fc2e7 into babel:main Nov 16, 2021
@sosukesuzuki sosukesuzuki deleted the compat-estree branch November 17, 2021 02:35
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Feb 16, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser PR: Bug Fix 🐛 A type of pull request used for our changelog categories Spec: Import Attributes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants