fix(isolated-declarations): missing print comments in class's private method (#5931)

This commit is contained in:
Dunqing 2024-09-20 15:12:01 +00:00
parent 8780c5440f
commit 0f96b59990
3 changed files with 39 additions and 1 deletions

View file

@ -152,6 +152,7 @@ impl<'a> IsolatedDeclarations<'a> {
fn create_class_property(
&self,
r#type: PropertyDefinitionType,
span: Span,
key: PropertyKey<'a>,
r#static: bool,
r#override: bool,
@ -159,7 +160,7 @@ impl<'a> IsolatedDeclarations<'a> {
) -> ClassElement<'a> {
self.ast.class_element_property_definition(
r#type,
SPAN,
span,
self.ast.vec(),
key,
None,
@ -216,6 +217,7 @@ impl<'a> IsolatedDeclarations<'a> {
};
self.create_class_property(
r#type,
method.span,
// SAFETY: `ast.copy` is unsound! We need to fix.
unsafe { self.ast.copy(&method.key) },
method.r#static,

View file

@ -20,11 +20,29 @@ export abstract class Qux {
}
export class Baz {
/**
* Just a comment
*/
readonly prop1 = 'some string';
/**
* Just a comment
*/
prop2 = 'another string';
/**
* Just a comment
*/
private prop3 = 'yet another string';
/**
* Just a comment
*/
private prop4(): void {}
/**
* Just a comment
*/
private static prop5 = 'yet another string';
/**
* Just a comment
*/
private static prop6(): void {}
}

View file

@ -20,11 +20,29 @@ export declare abstract class Qux {
baz(): void;
}
export declare class Baz {
/**
* Just a comment
*/
readonly prop1 = "some string";
/**
* Just a comment
*/
prop2: string;
/**
* Just a comment
*/
private prop3;
/**
* Just a comment
*/
private prop4;
/**
* Just a comment
*/
private static prop5;
/**
* Just a comment
*/
private static prop6;
}
export declare class Boo {