diff --git a/src/compiler/comments.ts b/src/compiler/comments.ts index 2b51e937fad..b93b144bf01 100644 --- a/src/compiler/comments.ts +++ b/src/compiler/comments.ts @@ -140,12 +140,12 @@ namespace ts { function emitLeadingComments(range: TextRange, leadingComments: CommentRange[] = getLeadingCommentsToEmit(range)) { emitNewLineBeforeLeadingComments(currentLineMap, writer, range, leadingComments); - // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space + // Leading comments are emitted as `/*leading comment1 */space/*leading comment*/space` emitComments(currentText, currentLineMap, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); } function emitTrailingComments(range: TextRange, trailingComments = getTrailingCommentsToEmit(range)) { - // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ + // Trailing comments are emitted as `space/*trailing comment1 */space/*trailing comment*/` emitComments(currentText, currentLineMap, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment); } @@ -182,7 +182,7 @@ namespace ts { // get the leading comments from detachedPos const pos = lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos; const leadingComments = getLeadingCommentRanges(currentText, pos); - if (detachedCommentsInfo.length - 1) { + if (detachedCommentsInfo.length > 1) { detachedCommentsInfo.pop(); } else { diff --git a/src/compiler/printer.ts b/src/compiler/printer.ts index 0a707e335d1..84388d4fd88 100644 --- a/src/compiler/printer.ts +++ b/src/compiler/printer.ts @@ -76,8 +76,8 @@ function __export(m) { })`; const compilerOptions = host.getCompilerOptions(); - const languageVersion = getLanguageVersion(compilerOptions); - const moduleKind = getModuleKind(compilerOptions); + const languageVersion = getEmitScriptTarget(compilerOptions); + const moduleKind = getEmitModuleKind(compilerOptions); const sourceMapDataList: SourceMapData[] = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; const emitterDiagnostics = createDiagnosticCollection(); diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index d8025b8d1b9..7026cafb065 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -102,22 +102,6 @@ namespace ts { return true; } - export function getLanguageVersion(compilerOptions: CompilerOptions) { - return compilerOptions.target || ScriptTarget.ES3; - } - - export function getModuleKind(compilerOptions: CompilerOptions) { - if (compilerOptions.module) { - return compilerOptions.module; - } - - if (getLanguageVersion(compilerOptions) === ScriptTarget.ES6) { - return ModuleKind.ES6; - } - - return ModuleKind.None; - } - export function hasResolvedModule(sourceFile: SourceFile, moduleNameText: string): boolean { return sourceFile.resolvedModules && hasProperty(sourceFile.resolvedModules, moduleNameText); }