Skip to content

Commit e7fe5d7

Browse files
committed
Adds non emit on non-initialized export
1 parent 0bf2288 commit e7fe5d7

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

src/compiler/emitter.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
139139
let exportEquals: ExportAssignment;
140140
let hasExportStars: boolean;
141141

142-
/** write emitted output to disk*/
142+
/** Write emitted output to disk */
143143
let writeEmittedFiles = writeJavaScriptFile;
144144

145145
let detachedCommentsInfo: { nodePos: number; detachedCommentEndPos: number }[];
@@ -3055,13 +3055,15 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
30553055
}
30563056

30573057
function emitVariableStatement(node: VariableStatement) {
3058-
let startIsEmitted = true;
3059-
if (!(node.flags & NodeFlags.Export)) {
3060-
startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList);
3058+
let startIsEmitted = false;
3059+
if (node.flags & NodeFlags.Export) {
3060+
if (isES6ExportedDeclaration(node)) {
3061+
// Exported ES6 module member
3062+
write("export ");
3063+
startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList);
3064+
}
30613065
}
3062-
else if (isES6ExportedDeclaration(node)) {
3063-
// Exported ES6 module member
3064-
write("export ");
3066+
else {
30653067
startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList);
30663068
}
30673069
if (startIsEmitted) {

0 commit comments

Comments
 (0)