Skip to content

Incorrect AstKind for ImportBinding Symbols #2013

@Dunqing

Description

@Dunqing

https://oxc-project.github.io/oxc/playground/?code=3YCAAIDZgICAgICAgICFm8uTSqrl7ZqfoPUKV4Xs7evL4yxJGZbkMLzyZ8mg56yBMWVAxZNTVbs7SJ1mSSMtRRVbGt%2FF%2FS1i6V%2BIAa9qMVtTM%2BcpdiwXf39D0DCA

I am currently working on a case where I need to locate the AST node corresponding to baz in export { baz }. If baz is an ImportSpecifier, ImportDefaultSpecifier, or ImportNamespaceSpecifier, I need to check if its import_kind is type. If it is, I need to remove it.

However, I am encountering an issue. When I retrieve the kind from self.ctx.nodes().kind(self.ctx.symbols().get_declaration(symbol_id)), I am getting AstKind::ModuleDeclaration when I am expecting AstKind::ImportSpecifier.

To resolve this issue, it appears we need to modify the Binder implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions