From 1f5d7dc394bf8a3bf42a8215f1a10987c247751b Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Wed, 23 Sep 2020 09:16:30 +0100 Subject: [PATCH] refactor(compiler-cli): function declarations must have names (#38866) The `AstFactory.createFunctionDeclaration()` was allowing `null` to be passed as the function `name` value. This is not actually possible, since function declarations must always have a name. PR Close #38866 --- .../compiler-cli/src/ngtsc/translator/src/api/ast_factory.ts | 2 +- .../src/ngtsc/translator/src/typescript_ast_factory.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/compiler-cli/src/ngtsc/translator/src/api/ast_factory.ts b/packages/compiler-cli/src/ngtsc/translator/src/api/ast_factory.ts index d8182f3885..d887e0d4a5 100644 --- a/packages/compiler-cli/src/ngtsc/translator/src/api/ast_factory.ts +++ b/packages/compiler-cli/src/ngtsc/translator/src/api/ast_factory.ts @@ -97,7 +97,7 @@ export interface AstFactory { * @param parameters the names of the function's parameters. * @param body a statement (or a block of statements) that are the body of the function. */ - createFunctionDeclaration(functionName: string|null, parameters: string[], body: TStatement): + createFunctionDeclaration(functionName: string, parameters: string[], body: TStatement): TStatement; /** diff --git a/packages/compiler-cli/src/ngtsc/translator/src/typescript_ast_factory.ts b/packages/compiler-cli/src/ngtsc/translator/src/typescript_ast_factory.ts index 06a86d7c56..b039e0c954 100644 --- a/packages/compiler-cli/src/ngtsc/translator/src/typescript_ast_factory.ts +++ b/packages/compiler-cli/src/ngtsc/translator/src/typescript_ast_factory.ts @@ -79,13 +79,13 @@ export class TypeScriptAstFactory implements AstFactory ts.createParameter(undefined, undefined, undefined, param)), undefined, body); }