-
Notifications
You must be signed in to change notification settings - Fork 347
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
Local identifier from an import specifier is ignored #1171
Comments
Workaround - force specifiers.unshift(b.importSpecifier(
b.identifier('load'), b.identifier('$loadMessages$')))
+ specifiers[0].original = null I wonder why it works or what it breaks. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When printing a modified AST, after removing one import specifier and inserting another one with different imported and local specifiers, the local identifier is ignored.
Original statement:
Desired statement:
Obtained statement:
The imported identifier
load
is missing.Details
Let us remove the
parse
specifier and insertload as $loadMessages$
:Result:
The imported identifier
load
was not included in the printed code.When omitting the removal of
parse
:let { specifiers } = ast.program.body[0] - specifiers.splice(0, 1)
The new import specifier becomes complete:
It appears, that if the count of import specifiers does not change, the presence of imported and local identifiers is not checked. If original import specifiers did not contain different imported and local identifiers, the newly inserted ones at the position of previous ones will be printed with local identifiers only.
The text was updated successfully, but these errors were encountered: