Ensure harness doesn't force or eagerly computes target, stop using raw target elsewhere (#57526)

This commit is contained in:
Jake Bailey
2024-02-26 11:32:18 -08:00
committed by GitHub
parent 455f06eb50
commit 4df884c773
167 changed files with 10479 additions and 2838 deletions
+3 -2
View File
@@ -144,6 +144,7 @@ import {
getEmitFlags,
getEmitHelpers,
getEmitModuleKind,
getEmitScriptTarget,
getExternalHelpersModuleName,
getExternalModuleName,
getIdentifierTypeArguments,
@@ -856,8 +857,8 @@ export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFi
removeComments: compilerOptions.removeComments,
newLine: compilerOptions.newLine,
noEmitHelpers: compilerOptions.noEmitHelpers,
module: compilerOptions.module,
target: compilerOptions.target,
module: getEmitModuleKind(compilerOptions),
target: getEmitScriptTarget(compilerOptions),
sourceMap: compilerOptions.sourceMap,
inlineSourceMap: compilerOptions.inlineSourceMap,
inlineSources: compilerOptions.inlineSources,
-1
View File
@@ -257,7 +257,6 @@ export function compileFiles(host: fakes.CompilerHost, rootFiles: string[] | und
}
// establish defaults (aligns with old harness)
if (compilerOptions.target === undefined && compilerOptions.module !== ts.ModuleKind.Node16 && compilerOptions.module !== ts.ModuleKind.NodeNext) compilerOptions.target = ts.ScriptTarget.ES3;
if (compilerOptions.newLine === undefined) compilerOptions.newLine = ts.NewLineKind.CarriageReturnLineFeed;
if (compilerOptions.skipDefaultLibCheck === undefined) compilerOptions.skipDefaultLibCheck = true;
if (compilerOptions.noErrorTruncation === undefined) compilerOptions.noErrorTruncation = true;
-1
View File
@@ -380,7 +380,6 @@ export namespace Compiler {
symlinks?: vfs.FileSet,
): compiler.CompilationResult {
const options: ts.CompilerOptions & HarnessOptions = compilerOptions ? ts.cloneCompilerOptions(compilerOptions) : { noResolve: false };
options.target = ts.getEmitScriptTarget(options);
options.newLine = options.newLine || ts.NewLineKind.CarriageReturnLineFeed;
options.noErrorTruncation = true;
options.skipDefaultLibCheck = typeof options.skipDefaultLibCheck === "undefined" ? true : options.skipDefaultLibCheck;
+2 -1
View File
@@ -22,6 +22,7 @@ import {
GetAccessorDeclaration,
getEffectiveReturnTypeNode,
getEffectiveTypeAnnotationNode,
getEmitScriptTarget,
getLanguageVariant,
getLeadingCommentRanges,
getNameOfDeclaration,
@@ -350,7 +351,7 @@ export function provideInlayHints(context: InlayHintsContext): InlayHint[] {
}
function leadingCommentsContainsParameterName(node: Node, name: string) {
if (!isIdentifierText(name, compilerOptions.target, getLanguageVariant(file.scriptKind))) {
if (!isIdentifierText(name, getEmitScriptTarget(compilerOptions), getLanguageVariant(file.scriptKind))) {
return false;
}