From dcb18d6f1872b04867abdd61a9b8087f8c6b3eff Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Thu, 22 Oct 2020 11:01:42 -0700 Subject: [PATCH] Adopt push-pop API --- src/compiler/program.ts | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 2572ed5f7e1..396c4d8d84c 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -867,15 +867,15 @@ namespace ts { forEachResolvedProjectReference }); - tracing.begin(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram }); + tracing.push(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram }); const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options); - tracing.end(); + tracing.pop(); // We set `structuralIsReused` to `undefined` because `tryReuseStructureFromOldProgram` calls `tryReuseStructureFromOldProgram` which checks // `structuralIsReused`, which would be a TDZ violation if it was not set in advance to `undefined`. let structureIsReused: StructureIsReused; - tracing.begin(tracing.Phase.Program, "tryReuseStructureFromOldProgram", {}); + tracing.push(tracing.Phase.Program, "tryReuseStructureFromOldProgram", {}); structureIsReused = tryReuseStructureFromOldProgram(); // eslint-disable-line prefer-const - tracing.end(); + tracing.pop(); if (structureIsReused !== StructureIsReused.Completely) { processingDefaultLibFiles = []; processingOtherFiles = []; @@ -911,15 +911,15 @@ namespace ts { } } - tracing.begin(tracing.Phase.Program, "processRootFiles", { count: rootNames.length }); + tracing.push(tracing.Phase.Program, "processRootFiles", { count: rootNames.length }); forEach(rootNames, name => processRootFile(name, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false)); - tracing.end(); + tracing.pop(); // load type declarations specified via 'types' argument or implicitly from types/ and node_modules/@types folders const typeReferences: string[] = rootNames.length ? getAutomaticTypeDirectiveNames(options, host) : emptyArray; if (typeReferences.length) { - tracing.begin(tracing.Phase.Program, "processTypeReferences", { count: typeReferences.length }); + tracing.push(tracing.Phase.Program, "processTypeReferences", { count: typeReferences.length }); // This containingFilename needs to match with the one used in managed-side const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : host.getCurrentDirectory(); const containingFilename = combinePaths(containingDirectory, inferredTypesContainingFile); @@ -927,7 +927,7 @@ namespace ts { for (let i = 0; i < typeReferences.length; i++) { processTypeReferenceDirective(typeReferences[i], resolutions[i]); } - tracing.end(); + tracing.pop(); } // Do not process the default library if: @@ -1049,12 +1049,12 @@ namespace ts { if (!moduleNames.length) return emptyArray; const containingFileName = getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory); const redirectedReference = getRedirectReferenceForResolution(containingFile); - tracing.begin(tracing.Phase.Program, "resolveModuleNamesWorker", { containingFileName }); + tracing.push(tracing.Phase.Program, "resolveModuleNamesWorker", { containingFileName }); performance.mark("beforeResolveModule"); const result = actualResolveModuleNamesWorker(moduleNames, containingFileName, reusedNames, redirectedReference); performance.mark("afterResolveModule"); performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule"); - tracing.end(); + tracing.pop(); return result; } @@ -1062,12 +1062,12 @@ namespace ts { if (!typeDirectiveNames.length) return []; const containingFileName = !isString(containingFile) ? getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile; const redirectedReference = !isString(containingFile) ? getRedirectReferenceForResolution(containingFile) : undefined; - tracing.begin(tracing.Phase.Program, "resolveTypeReferenceDirectiveNamesWorker", { containingFileName }); + tracing.push(tracing.Phase.Program, "resolveTypeReferenceDirectiveNamesWorker", { containingFileName }); performance.mark("beforeResolveTypeReference"); const result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference); performance.mark("afterResolveTypeReference"); performance.measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference"); - tracing.end(); + tracing.pop(); return result; } @@ -2438,13 +2438,13 @@ namespace ts { // Get source file from normalized fileName function findSourceFile(fileName: string, path: Path, isDefaultLib: boolean, ignoreNoDefaultLib: boolean, refFile: RefFile | undefined, packageId: PackageId | undefined): SourceFile | undefined { - tracing.begin(tracing.Phase.Program, "findSourceFile", { + tracing.push(tracing.Phase.Program, "findSourceFile", { fileName, isDefaultLib: isDefaultLib || undefined, refKind: refFile ? (RefFileKind as any)[refFile.kind] : undefined, }); const result = findSourceFileWorker(fileName, path, isDefaultLib, ignoreNoDefaultLib, refFile, packageId); - tracing.end(); + tracing.pop(); return result; } @@ -2773,9 +2773,9 @@ namespace ts { resolvedTypeReferenceDirective?: ResolvedTypeReferenceDirective, refFile?: RefFile ): void { - tracing.begin(tracing.Phase.Program, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolveModuleNamesReusingOldState, refKind: refFile?.kind, refPath: refFile?.file.path }); + tracing.push(tracing.Phase.Program, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolveModuleNamesReusingOldState, refKind: refFile?.kind, refPath: refFile?.file.path }); processTypeReferenceDirectiveWorker(typeReferenceDirective, resolvedTypeReferenceDirective, refFile); - tracing.end(); + tracing.pop(); } function processTypeReferenceDirectiveWorker(