mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
fix(isolated-declarations): private constructor reaching unreachable (#3921)
fix: #3917
This commit is contained in:
parent
59ce38bb85
commit
27f0531aac
3 changed files with 20 additions and 4 deletions
|
|
@ -202,7 +202,7 @@ impl<'a> IsolatedDeclarations<'a> {
|
||||||
self.transform_accessibility(method.accessibility),
|
self.transform_accessibility(method.accessibility),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
MethodDefinitionKind::Get => {
|
MethodDefinitionKind::Get | MethodDefinitionKind::Constructor => {
|
||||||
let params = self.ast.formal_parameters(
|
let params = self.ast.formal_parameters(
|
||||||
SPAN,
|
SPAN,
|
||||||
FormalParameterKind::Signature,
|
FormalParameterKind::Signature,
|
||||||
|
|
@ -221,9 +221,6 @@ impl<'a> IsolatedDeclarations<'a> {
|
||||||
);
|
);
|
||||||
self.transform_class_method_definition(method, params, None)
|
self.transform_class_method_definition(method, params, None)
|
||||||
}
|
}
|
||||||
MethodDefinitionKind::Constructor => {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
7
crates/oxc_isolated_declarations/tests/fixtures/class.ts
vendored
Normal file
7
crates/oxc_isolated_declarations/tests/fixtures/class.ts
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
export class Foo {
|
||||||
|
private constructor(a: number = 0) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Bar {
|
||||||
|
public constructor(a: number = 0) {}
|
||||||
|
}
|
||||||
12
crates/oxc_isolated_declarations/tests/snapshots/class.snap
Normal file
12
crates/oxc_isolated_declarations/tests/snapshots/class.snap
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
---
|
||||||
|
source: crates/oxc_isolated_declarations/tests/mod.rs
|
||||||
|
input_file: crates/oxc_isolated_declarations/tests/fixtures/class.ts
|
||||||
|
---
|
||||||
|
==================== .D.TS ====================
|
||||||
|
|
||||||
|
export declare class Foo {
|
||||||
|
private constructor();
|
||||||
|
}
|
||||||
|
export declare class Bar {
|
||||||
|
constructor(a?: number);
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue