mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 20:25:23 -06:00
Fix the trailing comment emit for module declaration
Fixes #8045 Fixes: - tests\cases\compiler\augmentedTypesClass3.ts - tests\cases\compiler\augmentedTypesModules.ts - tests\cases\compiler\commentsModules.ts
This commit is contained in:
parent
329a9fbab1
commit
7b07d3ce27
@ -117,6 +117,25 @@ namespace ts {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const node = range as Node;
|
||||
if (node.kind === SyntaxKind.VariableStatement &&
|
||||
node.original &&
|
||||
node.original.kind === SyntaxKind.ModuleDeclaration) {
|
||||
// Trailing comments for module declaration should be emitted with function closure instead of variable statement
|
||||
// /** Module comment*/
|
||||
// module m1 {
|
||||
// function foo4Export() {
|
||||
// }
|
||||
// } // trailing comment module
|
||||
// Should emit
|
||||
// /** Module comment*/
|
||||
// var m1;
|
||||
// (function (m1) {
|
||||
// function foo4Export() {
|
||||
// }
|
||||
// })(m1 || (m1 = {})); // trailing comment module
|
||||
return undefined;
|
||||
}
|
||||
return getTrailingCommentsOfPosition(range.end);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user