Skip to content

Commit dcb18d6

Browse files
committed
Adopt push-pop API
1 parent 9ad9ec9 commit dcb18d6

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/compiler/program.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -867,15 +867,15 @@ namespace ts {
867867
forEachResolvedProjectReference
868868
});
869869

870-
tracing.begin(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
870+
tracing.push(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
871871
const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
872-
tracing.end();
872+
tracing.pop();
873873
// We set `structuralIsReused` to `undefined` because `tryReuseStructureFromOldProgram` calls `tryReuseStructureFromOldProgram` which checks
874874
// `structuralIsReused`, which would be a TDZ violation if it was not set in advance to `undefined`.
875875
let structureIsReused: StructureIsReused;
876-
tracing.begin(tracing.Phase.Program, "tryReuseStructureFromOldProgram", {});
876+
tracing.push(tracing.Phase.Program, "tryReuseStructureFromOldProgram", {});
877877
structureIsReused = tryReuseStructureFromOldProgram(); // eslint-disable-line prefer-const
878-
tracing.end();
878+
tracing.pop();
879879
if (structureIsReused !== StructureIsReused.Completely) {
880880
processingDefaultLibFiles = [];
881881
processingOtherFiles = [];
@@ -911,23 +911,23 @@ namespace ts {
911911
}
912912
}
913913

914-
tracing.begin(tracing.Phase.Program, "processRootFiles", { count: rootNames.length });
914+
tracing.push(tracing.Phase.Program, "processRootFiles", { count: rootNames.length });
915915
forEach(rootNames, name => processRootFile(name, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false));
916-
tracing.end();
916+
tracing.pop();
917917

918918
// load type declarations specified via 'types' argument or implicitly from types/ and node_modules/@types folders
919919
const typeReferences: string[] = rootNames.length ? getAutomaticTypeDirectiveNames(options, host) : emptyArray;
920920

921921
if (typeReferences.length) {
922-
tracing.begin(tracing.Phase.Program, "processTypeReferences", { count: typeReferences.length });
922+
tracing.push(tracing.Phase.Program, "processTypeReferences", { count: typeReferences.length });
923923
// This containingFilename needs to match with the one used in managed-side
924924
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();
925925
const containingFilename = combinePaths(containingDirectory, inferredTypesContainingFile);
926926
const resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
927927
for (let i = 0; i < typeReferences.length; i++) {
928928
processTypeReferenceDirective(typeReferences[i], resolutions[i]);
929929
}
930-
tracing.end();
930+
tracing.pop();
931931
}
932932

933933
// Do not process the default library if:
@@ -1049,25 +1049,25 @@ namespace ts {
10491049
if (!moduleNames.length) return emptyArray;
10501050
const containingFileName = getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
10511051
const redirectedReference = getRedirectReferenceForResolution(containingFile);
1052-
tracing.begin(tracing.Phase.Program, "resolveModuleNamesWorker", { containingFileName });
1052+
tracing.push(tracing.Phase.Program, "resolveModuleNamesWorker", { containingFileName });
10531053
performance.mark("beforeResolveModule");
10541054
const result = actualResolveModuleNamesWorker(moduleNames, containingFileName, reusedNames, redirectedReference);
10551055
performance.mark("afterResolveModule");
10561056
performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
1057-
tracing.end();
1057+
tracing.pop();
10581058
return result;
10591059
}
10601060

10611061
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames: string[], containingFile: string | SourceFile): readonly (ResolvedTypeReferenceDirective | undefined)[] {
10621062
if (!typeDirectiveNames.length) return [];
10631063
const containingFileName = !isString(containingFile) ? getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile;
10641064
const redirectedReference = !isString(containingFile) ? getRedirectReferenceForResolution(containingFile) : undefined;
1065-
tracing.begin(tracing.Phase.Program, "resolveTypeReferenceDirectiveNamesWorker", { containingFileName });
1065+
tracing.push(tracing.Phase.Program, "resolveTypeReferenceDirectiveNamesWorker", { containingFileName });
10661066
performance.mark("beforeResolveTypeReference");
10671067
const result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference);
10681068
performance.mark("afterResolveTypeReference");
10691069
performance.measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference");
1070-
tracing.end();
1070+
tracing.pop();
10711071
return result;
10721072
}
10731073

@@ -2438,13 +2438,13 @@ namespace ts {
24382438

24392439
// Get source file from normalized fileName
24402440
function findSourceFile(fileName: string, path: Path, isDefaultLib: boolean, ignoreNoDefaultLib: boolean, refFile: RefFile | undefined, packageId: PackageId | undefined): SourceFile | undefined {
2441-
tracing.begin(tracing.Phase.Program, "findSourceFile", {
2441+
tracing.push(tracing.Phase.Program, "findSourceFile", {
24422442
fileName,
24432443
isDefaultLib: isDefaultLib || undefined,
24442444
refKind: refFile ? (RefFileKind as any)[refFile.kind] : undefined,
24452445
});
24462446
const result = findSourceFileWorker(fileName, path, isDefaultLib, ignoreNoDefaultLib, refFile, packageId);
2447-
tracing.end();
2447+
tracing.pop();
24482448
return result;
24492449
}
24502450

@@ -2773,9 +2773,9 @@ namespace ts {
27732773
resolvedTypeReferenceDirective?: ResolvedTypeReferenceDirective,
27742774
refFile?: RefFile
27752775
): void {
2776-
tracing.begin(tracing.Phase.Program, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolveModuleNamesReusingOldState, refKind: refFile?.kind, refPath: refFile?.file.path });
2776+
tracing.push(tracing.Phase.Program, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolveModuleNamesReusingOldState, refKind: refFile?.kind, refPath: refFile?.file.path });
27772777
processTypeReferenceDirectiveWorker(typeReferenceDirective, resolvedTypeReferenceDirective, refFile);
2778-
tracing.end();
2778+
tracing.pop();
27792779
}
27802780

27812781
function processTypeReferenceDirectiveWorker(

0 commit comments

Comments
 (0)