PR feedback, switched to getEmitScriptTarget/getEmitModuleKind

This commit is contained in:
Ron Buckton 2016-02-16 16:12:00 -08:00
parent 8ec393244b
commit 357171fb7c
3 changed files with 5 additions and 21 deletions

View file

@ -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 {

View file

@ -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();

View file

@ -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);
}