mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +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> {
|
impl<'a> PrivateIdentifier<'a> {
|
||||||
pub fn new(span: Span, name: Atom<'a>) -> Self {
|
pub fn new(span: Span, name: Atom<'a>) -> Self {
|
||||||
Self { span, name }
|
Self { span, name }
|
||||||
|
|
|
||||||
|
|
@ -329,7 +329,7 @@ impl<'a> IsolatedDeclarations<'a> {
|
||||||
match element {
|
match element {
|
||||||
ClassElement::StaticBlock(_) => {}
|
ClassElement::StaticBlock(_) => {}
|
||||||
ClassElement::MethodDefinition(ref method) => {
|
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;
|
is_function_overloads = true;
|
||||||
} else if is_function_overloads {
|
} else if is_function_overloads {
|
||||||
// Skip implementation of function overloads
|
// Skip implementation of function overloads
|
||||||
|
|
|
||||||
|
|
@ -7,3 +7,9 @@ export class Bar {
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
export declare class Zoo {
|
||||||
foo<F>(f: F): F;
|
foo<F>(f: F): F;
|
||||||
}
|
}
|
||||||
|
export declare abstract class Qux {
|
||||||
|
abstract foo(): void;
|
||||||
|
bar(): void;
|
||||||
|
baz(): void;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue