refactor(compiler): remove unreachable code (#40984)

1. The error function throws, so no code after it is reachable.
2. Some switch statements are exhaustive, so no code after them are reachable.

PR Close #40984
This commit is contained in:
Andrew Scott 2021-02-24 10:06:39 -08:00 committed by Zach Arend
parent a31da48507
commit 54b088967a
6 changed files with 0 additions and 10 deletions

View File

@ -124,7 +124,6 @@ export class MetadataDtsModuleScopeResolver implements DtsModuleScopeResolver {
// The export was not a directive, a pipe, or a module. This is an error.
// TODO(alxhub): produce a ts.Diagnostic
throw new Error(`Exported value ${exportRef.debugName} was not a directive, pipe, or module`);
}
const exportScope: ExportScope = {

View File

@ -784,7 +784,6 @@ function modifierFromModifier(modifier: StmtModifier): ts.Modifier {
case StmtModifier.Static:
return ts.createToken(ts.SyntaxKind.StaticKeyword);
}
return error(`unknown statement modifier`);
}
function translateModifiers(modifiers: StmtModifier[]|null): ts.Modifier[]|undefined {

View File

@ -252,8 +252,6 @@ export class ConstantPool {
case DefinitionKind.Pipe:
return this.pipeDefinitions;
}
error(`Unknown definition kind ${kind}`);
return this.componentDefinitions;
}
public propertyNameOf(kind: DefinitionKind): string {
@ -267,8 +265,6 @@ export class ConstantPool {
case DefinitionKind.Pipe:
return 'ɵpipe';
}
error(`Unknown definition kind ${kind}`);
return '<unknown>';
}
private freshName(): string {

View File

@ -432,7 +432,6 @@ function selectorsFromGlobalMetadata(
}
error('Unexpected query form');
return o.NULL_EXPR;
}
function prepareQueryParams(query: R3QueryMetadata, constantPool: ConstantPool): o.Expression[] {

View File

@ -56,8 +56,6 @@ function getHelperDeclaration(name: HelperFunction): ts.Node {
case HelperFunction.splitNamespace:
return getSplitNamespaceHelper();
}
throw new Error(`Unsupported helper called "${name}".`);
}
/** Creates a helper for a custom `any` type during the migration. */

View File

@ -102,7 +102,6 @@ function getLViewToClone(type: TViewType, name: string|null): Array<any> {
}
return embeddedArray;
}
throw new Error('unreachable code');
}
function nameSuffix(text: string|null|undefined): string {