mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
fix(codegen): print jsdoc comments for TSEnumMembers (#6007)
closes #6006 Boshen/Dunqing please feel free to take over this PR. it's a bit outside what i normally work on. 🙂
This commit is contained in:
parent
5ae3f364e9
commit
4a99372c14
3 changed files with 65 additions and 2 deletions
|
|
@ -3551,6 +3551,7 @@ impl<'a> Gen for TSEnumDeclaration<'a> {
|
||||||
|
|
||||||
impl<'a> Gen for TSEnumMember<'a> {
|
impl<'a> Gen for TSEnumMember<'a> {
|
||||||
fn gen(&self, p: &mut Codegen, ctx: Context) {
|
fn gen(&self, p: &mut Codegen, ctx: Context) {
|
||||||
|
p.print_leading_comments(self.span.start);
|
||||||
match &self.id {
|
match &self.id {
|
||||||
TSEnumMemberName::StaticIdentifier(decl) => decl.print(p, ctx),
|
TSEnumMemberName::StaticIdentifier(decl) => decl.print(p, ctx),
|
||||||
TSEnumMemberName::StaticStringLiteral(decl) => decl.print(p, ctx),
|
TSEnumMemberName::StaticStringLiteral(decl) => decl.print(p, ctx),
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,28 @@ this.Book = function(title) {
|
||||||
/** The title of the book. */
|
/** The title of the book. */
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
",
|
// https://github.com/oxc-project/oxc/issues/6006
|
||||||
|
export enum DefinitionKind {
|
||||||
|
/**
|
||||||
|
* Definition is a referenced variable.
|
||||||
|
*
|
||||||
|
* @example defineSomething(foo)
|
||||||
|
*/
|
||||||
|
Reference = 'Reference',
|
||||||
|
/**
|
||||||
|
* Definition is a `ObjectExpression`.
|
||||||
|
*
|
||||||
|
* @example defineSomething({ ... })
|
||||||
|
*/
|
||||||
|
Object = 'Object',
|
||||||
|
/**
|
||||||
|
* Definition is TypeScript interface.
|
||||||
|
*
|
||||||
|
* @example defineSomething<{ ... }>()
|
||||||
|
*/
|
||||||
|
TS = 'TS',
|
||||||
|
}
|
||||||
|
",
|
||||||
];
|
];
|
||||||
|
|
||||||
snapshot("jsodc", &cases);
|
snapshot("jsodc", &cases);
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,27 @@ this.Book = function(title) {
|
||||||
/** The title of the book. */
|
/** The title of the book. */
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
// https://github.com/oxc-project/oxc/issues/6006
|
||||||
|
export enum DefinitionKind {
|
||||||
|
/**
|
||||||
|
* Definition is a referenced variable.
|
||||||
|
*
|
||||||
|
* @example defineSomething(foo)
|
||||||
|
*/
|
||||||
|
Reference = 'Reference',
|
||||||
|
/**
|
||||||
|
* Definition is a `ObjectExpression`.
|
||||||
|
*
|
||||||
|
* @example defineSomething({ ... })
|
||||||
|
*/
|
||||||
|
Object = 'Object',
|
||||||
|
/**
|
||||||
|
* Definition is TypeScript interface.
|
||||||
|
*
|
||||||
|
* @example defineSomething<{ ... }>()
|
||||||
|
*/
|
||||||
|
TS = 'TS',
|
||||||
|
}
|
||||||
|
|
||||||
----------
|
----------
|
||||||
/** This is a description of the foo function. */
|
/** This is a description of the foo function. */
|
||||||
|
|
@ -119,3 +140,23 @@ this.Book = function(title) {
|
||||||
/** The title of the book. */
|
/** The title of the book. */
|
||||||
this.title = title;
|
this.title = title;
|
||||||
};
|
};
|
||||||
|
export enum DefinitionKind {
|
||||||
|
/**
|
||||||
|
* Definition is a referenced variable.
|
||||||
|
*
|
||||||
|
* @example defineSomething(foo)
|
||||||
|
*/
|
||||||
|
Reference = 'Reference',
|
||||||
|
/**
|
||||||
|
* Definition is a `ObjectExpression`.
|
||||||
|
*
|
||||||
|
* @example defineSomething({ ... })
|
||||||
|
*/
|
||||||
|
Object = 'Object',
|
||||||
|
/**
|
||||||
|
* Definition is TypeScript interface.
|
||||||
|
*
|
||||||
|
* @example defineSomething<{ ... }>()
|
||||||
|
*/
|
||||||
|
TS = 'TS',
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue