mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
fix(isolated-declarations): method following an abstract method gets dropped (#4024)
close: #4019
This commit is contained in:
parent
7844734856
commit
05a047c17d
4 changed files with 19 additions and 2 deletions
|
|
@ -1298,6 +1298,12 @@ impl MethodDefinitionKind {
|
|||
}
|
||||
}
|
||||
|
||||
impl MethodDefinitionType {
|
||||
pub fn is_abstract(&self) -> bool {
|
||||
matches!(self, Self::TSAbstractMethodDefinition)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> PrivateIdentifier<'a> {
|
||||
pub fn new(span: Span, name: Atom<'a>) -> Self {
|
||||
Self { span, name }
|
||||
|
|
|
|||
|
|
@ -329,7 +329,7 @@ impl<'a> IsolatedDeclarations<'a> {
|
|||
match element {
|
||||
ClassElement::StaticBlock(_) => {}
|
||||
ClassElement::MethodDefinition(ref method) => {
|
||||
if method.value.body.is_none() {
|
||||
if !method.r#type.is_abstract() && method.value.body.is_none() {
|
||||
is_function_overloads = true;
|
||||
} else if is_function_overloads {
|
||||
// Skip implementation of function overloads
|
||||
|
|
|
|||
|
|
@ -6,4 +6,10 @@ export class Bar {
|
|||
public constructor(a: number = 0) {}
|
||||
}
|
||||
|
||||
export class Zoo { foo<F>(f: F): F { return f } }
|
||||
export class Zoo { foo<F>(f: F): F { return f } }
|
||||
|
||||
export abstract class Qux {
|
||||
abstract foo(): void;
|
||||
bar(): void {}
|
||||
baz(): void {}
|
||||
}
|
||||
|
|
@ -13,3 +13,8 @@ export declare class Bar {
|
|||
export declare class Zoo {
|
||||
foo<F>(f: F): F;
|
||||
}
|
||||
export declare abstract class Qux {
|
||||
abstract foo(): void;
|
||||
bar(): void;
|
||||
baz(): void;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue