mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-12 03:20:56 -06:00
Emit modules that contain only const enums, if the preserveConstEnum flag is provided.
This commit is contained in:
parent
faf3413c40
commit
498a3274b8
@ -715,7 +715,7 @@ module ts {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function emitEnumDeclaration(node: EnumDeclaration) {
|
||||
if (resolver.isDeclarationVisible(node)) {
|
||||
emitJsDocComments(node);
|
||||
@ -3176,7 +3176,10 @@ module ts {
|
||||
}
|
||||
|
||||
function emitModuleDeclaration(node: ModuleDeclaration) {
|
||||
if (getModuleInstanceState(node) !== ModuleInstanceState.Instantiated) {
|
||||
var shouldEmit = getModuleInstanceState(node) === ModuleInstanceState.Instantiated ||
|
||||
(getModuleInstanceState(node) === ModuleInstanceState.ConstEnumOnly && compilerOptions.preserveConstEnums);
|
||||
|
||||
if (!shouldEmit) {
|
||||
return emitPinnedOrTripleSlashComments(node);
|
||||
}
|
||||
emitLeadingComments(node);
|
||||
@ -3558,7 +3561,7 @@ module ts {
|
||||
return leadingComments;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getLeadingCommentsToEmit(node: Node) {
|
||||
// Emit the leading comments only if the parent's pos doesn't match because parent should take care of emitting these comments
|
||||
if (node.parent.kind === SyntaxKind.SourceFile || node.pos !== node.parent.pos) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user