Skip to content

Replace stubbed panic!s with real implementations (3 TODOs) #9416

@Boshen

Description

@Boshen

Three todo!() sites were converted to panic!() in 71b870b to satisfy the new clippy::todo deny lint. They remain unimplemented — this issue tracks finishing them.

1. ImportStatus::_CommonJSWithoutExports

crates/rolldown/src/stages/link_stage/bind_imports_and_exports.rs:1065-1067

ImportStatus::_CommonJSWithoutExports => {
  panic!("`ImportStatus::_CommonJSWithoutExports` is not implemented yet")
}

The variant (defined at bind_imports_and_exports.rs:117-118) represents an import treated as CommonJS where the file is known to have no exports — esbuild parity. It is currently never constructed (note the _ prefix), so the panic is unreachable in practice.

2. ImportStatus::_Disabled

crates/rolldown/src/stages/link_stage/bind_imports_and_exports.rs:1068-1070

ImportStatus::_Disabled => {
  panic!("`ImportStatus::_Disabled` is not implemented yet")
}

Represents a module disabled via mapping to false in package.json's browser field (see bind_imports_and_exports.rs:120-121). Also never constructed today.

3. JSXMemberExpression::rewrite_ident_reference

crates/rolldown_ecmascript_utils/src/extensions/ast_ext/jsx.rs:55-57

fn rewrite_ident_reference(&mut self, _ident_ref: JSXMemberExpressionObject<'ast>) {
  panic!("`JSXMemberExpression::rewrite_ident_reference` is not implemented yet")
}

The sibling impl on JSXMemberExpressionObject (jsx.rs:19) does the actual rewrite. Callers in crates/rolldown/src/module_finalizers/impl_visit_mut.rs:597,602 only invoke it on .object (a JSXMemberExpressionObject), so the JSXMemberExpression impl appears to be dead — but as long as the trait advertises the method, the impl needs a real body (or the method should be moved off the trait).

Suggested resolution

For 1 & 2: decide whether to wire up the variants (constructing them in the appropriate import resolution paths) or remove them outright. For 3: either implement, or restructure the trait so JSXMemberExpression doesn't need to provide it.

Metadata

Metadata

Assignees

Type

Priority

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions