New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
style(compiler-cli): remove unused codes #38462
Conversation
- Remove unused private property _programWithStubs - Remove unused const codegen in _createProgramWithBasicStubs method
There are actually quite a few places in this file that could be cleaned up. Perhaps you could include these too? diff --git a/packages/compiler-cli/src/transformers/program.ts b/packages/compiler-cli/src/transformers/program.ts
index f82477b43a..42f7010eb3 100644
--- a/packages/compiler-cli/src/transformers/program.ts
+++ b/packages/compiler-cli/src/transformers/program.ts
@@ -102,9 +102,7 @@ class AngularCompilerProgram implements Program {
private _analyzedModules: NgAnalyzedModules|undefined;
private _analyzedInjectables: NgAnalyzedFileWithInjectables[]|undefined;
private _structuralDiagnostics: Diagnostic[]|undefined;
- private _programWithStubs: ts.Program|undefined;
private _optionsDiagnostics: Diagnostic[] = [];
- private _transformTsDiagnostics: ts.Diagnostic[] = [];
constructor(
rootNames: ReadonlyArray<string>, private options: CompilerOptions,
@@ -155,8 +153,7 @@ class AngularCompilerProgram implements Program {
this.oldProgramLibrarySummaries.forEach((summary, fileName) => result.set(fileName, summary));
}
if (this.emittedLibrarySummaries) {
- this.emittedLibrarySummaries.forEach(
- (summary, fileName) => result.set(summary.fileName, summary));
+ this.emittedLibrarySummaries.forEach((summary) => result.set(summary.fileName, summary));
}
return result;
}
@@ -269,7 +266,6 @@ class AngularCompilerProgram implements Program {
private _emitRender2({
emitFlags = EmitFlags.Default,
- cancellationToken,
customTransformers,
emitCallback = defaultEmitCallback,
mergeEmitResultsCallback = mergeEmitResults,
@@ -305,7 +301,6 @@ class AngularCompilerProgram implements Program {
const genFileByFileName = new Map<string, GeneratedFile>();
genFiles.forEach(genFile => genFileByFileName.set(genFile.genFileUrl, genFile));
this.emittedLibrarySummaries = [];
- this._transformTsDiagnostics = [];
const emittedSourceFiles = [] as ts.SourceFile[];
const writeTsFile: ts.WriteFileCallback =
(outFileName, outData, writeByteOrderMark, onError?, sourceFiles?) => {
@@ -605,11 +600,6 @@ class AngularCompilerProgram implements Program {
const oldTsProgram = this.oldTsProgram;
this.oldTsProgram = undefined;
- const codegen: CodeGenerator = {
- generateFile: (genFileName, baseFileName) =>
- this.compiler.emitBasicStub(genFileName, baseFileName),
- findGeneratedFileNames: (fileName) => this.compiler.findGeneratedFileNames(fileName),
- };
let rootNames = [...this.rootNames];
@@ -909,7 +899,6 @@ export function createSrcToOutPathMapper(
relative: typeof path.relative
} = path): (srcFileName: string) => string {
if (outDir) {
- let path: {} = {}; // Ensure we error if we use `path` instead of `host`.
if (sampleSrcFileName == null || sampleOutFileName == null) {
throw new Error(`Can't calculate the rootDir without a sample srcFileName / outFileName. `);
}
@@ -1019,15 +1008,6 @@ function diagnosticSourceOfSpan(span: ParseSourceSpan): ts.SourceFile {
return ({fileName: span.start.file.url, text: span.start.file.content} as any);
}
-function diagnosticSourceOfFileName(fileName: string, program: ts.Program): ts.SourceFile {
- const sourceFile = program.getSourceFile(fileName);
- if (sourceFile) return sourceFile;
-
- // If we are reporting diagnostics for a source file that is not in the project then we need
- // to fake a source file so the diagnostic formatting routines can emit the file name.
- // The redundant '()' are here is to avoid having clang-format breaking the line incorrectly.
- return ({fileName, text: ''} as any);
-}
function diagnosticChainFromFormattedDiagnosticChain(chain: FormattedMessageChain): |
Closing this PR since it's ViewEngine-specific and ViewEngine is deprecated (so only critical and security fixes would be merged into ViewEngine-specific code). |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
The private property
_programWithStubs
is not used anywhere in classAngularCompilerProgram
.The const
codegen
is not used anywhere in_createProgramWithBasicStubs
method.This PR is to remove those 2 above.
Issue Number: N.A.
What is the new behavior?
N.A.
Does this PR introduce a breaking change?
Other information
N.A.