Skip to content

Commit

Permalink
emit publish of exported values in variable declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
vladima committed Apr 10, 2015
1 parent 50496cc commit 83fcca8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/compiler/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2740,7 +2740,6 @@ var __param = this.__param || function(index, decorator) { return function (targ
}
else {
renameNonTopLevelLetAndConst(<Identifier>node.name);
emitModuleMemberName(node);

let initializer = node.initializer;
if (!initializer && languageVersion < ScriptTarget.ES6) {
Expand All @@ -2763,7 +2762,21 @@ var __param = this.__param || function(index, decorator) { return function (targ
}
}

let publishExportedValue =
currentFileIsEmittedAsSystemModule() && (getCombinedNodeFlags(node) & NodeFlags.Export) && isSourceFileLevelDeclaration(node);

if (publishExportedValue) {
write(`${exportFunctionForFile}("`);
emitNodeWithoutSourceMap(node.name);
write(`", `);
}

emitModuleMemberName(node);
emitOptional(" = ", initializer);

if (publishExportedValue) {
write(")")
}
}
}

Expand Down

1 comment on commit 83fcca8

@CyrusNajmabadi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.