mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-18 17:27:54 -05:00
correctly merge const enum only and instantiated modules
This commit is contained in:
@@ -322,13 +322,14 @@ module ts {
|
||||
}
|
||||
else {
|
||||
bindDeclaration(node, SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes, /*isBlockScopeContainer*/ true);
|
||||
if (state === ModuleInstanceState.ConstEnumOnly) {
|
||||
// mark value module as module that contains only enums
|
||||
node.symbol.constEnumOnlyModule = true;
|
||||
let currentModuleIsConstEnumOnly = state === ModuleInstanceState.ConstEnumOnly;
|
||||
if (node.symbol.constEnumOnlyModule === undefined) {
|
||||
// non-merged case - use the current state
|
||||
node.symbol.constEnumOnlyModule = currentModuleIsConstEnumOnly;
|
||||
}
|
||||
else if (node.symbol.constEnumOnlyModule) {
|
||||
// const only value module was merged with instantiated module - reset flag
|
||||
node.symbol.constEnumOnlyModule = false;
|
||||
else {
|
||||
// merged case: module is const enum only if all its pieces are non-instantiated or const enum
|
||||
node.symbol.constEnumOnlyModule = node.symbol.constEnumOnlyModule && currentModuleIsConstEnumOnly;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user