diff --git a/Jakefile.js b/Jakefile.js index b13e2cfacf9..0c764758240 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -727,6 +727,7 @@ function runTestsAndWriteOutput(file) { var tapNotOk = /^not\sok/; var tapComment = /^#/; var typeError = /^\s+TypeError:/; + var debugError = /^\s+Error:\sDebug\sFailure\./; var progress = new ProgressBar("Running tests..."); var expectedTestCount = 0; var testCount = 0; @@ -734,6 +735,7 @@ function runTestsAndWriteOutput(file) { var successCount = 0; var comments = []; var typeErrorCount = 0; + var debugErrorCount = 0; ex.addListener("stdout", function (output) { var m = tapRange.exec(output); @@ -757,6 +759,9 @@ function runTestsAndWriteOutput(file) { else if (typeError.test(output)) { typeErrorCount++; } + else if (debugError.test(output)) { + debugErrorCount++; + } return; } @@ -806,6 +811,10 @@ function runTestsAndWriteOutput(file) { console.log("# type errors: %s", typeErrorCount); } + if (debugErrorCount) { + console.log("# debug errors: %s", debugErrorCount); + } + deleteTemporaryProjectOutput(); if (beep) process.stdout.write("\u0007"); fail("Process exited with code " + status); diff --git a/src/compiler/transformers/module/es6.ts b/src/compiler/transformers/module/es6.ts index 63b147b6e60..f513ac36dbb 100644 --- a/src/compiler/transformers/module/es6.ts +++ b/src/compiler/transformers/module/es6.ts @@ -4,9 +4,35 @@ /*@internal*/ namespace ts { export function transformES6Module(context: TransformationContext) { + const compilerOptions = context.getCompilerOptions(); + const resolver = context.getEmitResolver(); + + let currentSourceFile: SourceFile; + return transformSourceFile; function transformSourceFile(node: SourceFile) { + if (isExternalModule(node) || compilerOptions.isolatedModules) { + currentSourceFile = node; + return visitEachChild(node, visitor, context); + } + return node; + } + + function visitor(node: Node) { + switch (node.kind) { + case SyntaxKind.ImportDeclaration: + return visitImportDeclaration(node); + } + + return node; + } + + function visitImportDeclaration(node: ImportDeclaration) { + if (node.importClause && !resolver.isReferencedAliasDeclaration(node.importClause, /*checkChildren*/ true)) { + return undefined; + } + return node; } } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 18a95bc5ff0..aedd44fcb6a 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -3405,6 +3405,7 @@ namespace ts { || kind === SyntaxKind.TypeAliasDeclaration || kind === SyntaxKind.EnumDeclaration || kind === SyntaxKind.ModuleDeclaration + || kind === SyntaxKind.ImportDeclaration || kind === SyntaxKind.ImportEqualsDeclaration || kind === SyntaxKind.ExportDeclaration || kind === SyntaxKind.ExportAssignment;