Skip to content

Commit 357171f

Browse files
committed
PR feedback, switched to getEmitScriptTarget/getEmitModuleKind
1 parent 8ec3932 commit 357171f

3 files changed

Lines changed: 5 additions & 21 deletions

File tree

src/compiler/comments.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,12 @@ namespace ts {
140140
function emitLeadingComments(range: TextRange, leadingComments: CommentRange[] = getLeadingCommentsToEmit(range)) {
141141
emitNewLineBeforeLeadingComments(currentLineMap, writer, range, leadingComments);
142142

143-
// Leading comments are emitted at /*leading comment1 */space/*leading comment*/space
143+
// Leading comments are emitted as `/*leading comment1 */space/*leading comment*/space`
144144
emitComments(currentText, currentLineMap, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment);
145145
}
146146

147147
function emitTrailingComments(range: TextRange, trailingComments = getTrailingCommentsToEmit(range)) {
148-
// trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/
148+
// Trailing comments are emitted as `space/*trailing comment1 */space/*trailing comment*/`
149149
emitComments(currentText, currentLineMap, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment);
150150
}
151151

@@ -182,7 +182,7 @@ namespace ts {
182182
// get the leading comments from detachedPos
183183
const pos = lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos;
184184
const leadingComments = getLeadingCommentRanges(currentText, pos);
185-
if (detachedCommentsInfo.length - 1) {
185+
if (detachedCommentsInfo.length > 1) {
186186
detachedCommentsInfo.pop();
187187
}
188188
else {

src/compiler/printer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ function __export(m) {
7676
})`;
7777

7878
const compilerOptions = host.getCompilerOptions();
79-
const languageVersion = getLanguageVersion(compilerOptions);
80-
const moduleKind = getModuleKind(compilerOptions);
79+
const languageVersion = getEmitScriptTarget(compilerOptions);
80+
const moduleKind = getEmitModuleKind(compilerOptions);
8181
const sourceMapDataList: SourceMapData[] = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined;
8282
const emitterDiagnostics = createDiagnosticCollection();
8383

src/compiler/utilities.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -102,22 +102,6 @@ namespace ts {
102102
return true;
103103
}
104104

105-
export function getLanguageVersion(compilerOptions: CompilerOptions) {
106-
return compilerOptions.target || ScriptTarget.ES3;
107-
}
108-
109-
export function getModuleKind(compilerOptions: CompilerOptions) {
110-
if (compilerOptions.module) {
111-
return compilerOptions.module;
112-
}
113-
114-
if (getLanguageVersion(compilerOptions) === ScriptTarget.ES6) {
115-
return ModuleKind.ES6;
116-
}
117-
118-
return ModuleKind.None;
119-
}
120-
121105
export function hasResolvedModule(sourceFile: SourceFile, moduleNameText: string): boolean {
122106
return sourceFile.resolvedModules && hasProperty(sourceFile.resolvedModules, moduleNameText);
123107
}

0 commit comments

Comments
 (0)