From e7fe5d78a31f72a7013345c2e1e1165b489b4dd4 Mon Sep 17 00:00:00 2001 From: Tingan Ho Date: Wed, 13 May 2015 10:58:12 +0800 Subject: [PATCH] Adds non emit on non-initialized export --- src/compiler/emitter.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 6d5146a6801..7d482d4dd60 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -139,7 +139,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { let exportEquals: ExportAssignment; let hasExportStars: boolean; - /** write emitted output to disk*/ + /** Write emitted output to disk */ let writeEmittedFiles = writeJavaScriptFile; let detachedCommentsInfo: { nodePos: number; detachedCommentEndPos: number }[]; @@ -3055,13 +3055,15 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { } function emitVariableStatement(node: VariableStatement) { - let startIsEmitted = true; - if (!(node.flags & NodeFlags.Export)) { - startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + let startIsEmitted = false; + if (node.flags & NodeFlags.Export) { + if (isES6ExportedDeclaration(node)) { + // Exported ES6 module member + write("export "); + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } } - else if (isES6ExportedDeclaration(node)) { - // Exported ES6 module member - write("export "); + else { startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); } if (startIsEmitted) {