mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-16 15:44:16 -06:00
emit publish of exported values in destructuring
This commit is contained in:
parent
7bced68210
commit
8c80792fe2
@ -2588,14 +2588,35 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
}
|
||||
|
||||
renameNonTopLevelLetAndConst(name);
|
||||
if (name.parent && (name.parent.kind === SyntaxKind.VariableDeclaration || name.parent.kind === SyntaxKind.BindingElement)) {
|
||||
|
||||
const isVariableDeclarationOrBindingElement =
|
||||
name.parent && (name.parent.kind === SyntaxKind.VariableDeclaration || name.parent.kind === SyntaxKind.BindingElement);
|
||||
|
||||
let emitPublishOfExportedValue = false;
|
||||
if (currentFileIsEmittedAsSystemModule() && !nodeIsSynthesized(name)) {
|
||||
let nodeToCheck = isVariableDeclarationOrBindingElement ? name.parent : resolver.getReferencedValueDeclaration(name);
|
||||
emitPublishOfExportedValue = nodeToCheck && (getCombinedNodeFlags(nodeToCheck) & NodeFlags.Export) && isSourceFileLevelDeclaration(nodeToCheck);
|
||||
}
|
||||
|
||||
if (emitPublishOfExportedValue) {
|
||||
write(`${exportFunctionForFile}("`);
|
||||
emitNodeWithoutSourceMap(name);
|
||||
write(`", `);
|
||||
}
|
||||
|
||||
if (isVariableDeclarationOrBindingElement) {
|
||||
emitModuleMemberName(<Declaration>name.parent);
|
||||
}
|
||||
else {
|
||||
emit(name);
|
||||
}
|
||||
|
||||
write(" = ");
|
||||
emit(value);
|
||||
|
||||
if (emitPublishOfExportedValue) {
|
||||
write(")");
|
||||
}
|
||||
}
|
||||
|
||||
function ensureIdentifier(expr: Expression): Expression {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user