From ca04ecedec42bc15a8135936ae33a8850cbd641d Mon Sep 17 00:00:00 2001 From: Andrew Kushnir Date: Tue, 10 May 2022 18:52:22 -0700 Subject: [PATCH] refactor(core): avoid code duplication in standalone-related logic (#45949) This commit updates the standalone-related logic to address the feedback from previous code reviews (specifically: https://github.com/angular/angular/pull/45687#discussion_r854499586). PR Close #45949 --- packages/core/src/render3/definition.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/src/render3/definition.ts b/packages/core/src/render3/definition.ts index 76ff5b8f9b0..d141c9a31e1 100644 --- a/packages/core/src/render3/definition.ts +++ b/packages/core/src/render3/definition.ts @@ -288,6 +288,7 @@ export function ɵɵdefineComponent(componentDefinition: { (typeof ngDevMode === 'undefined' || ngDevMode) && initNgDevMode(); const type = componentDefinition.type; + const standalone = componentDefinition.standalone === true; const declaredInputs: {[key: string]: string} = {} as any; const def: Mutable, keyof ComponentDef> = { type: type, @@ -309,9 +310,8 @@ export function ɵɵdefineComponent(componentDefinition: { onPush: componentDefinition.changeDetection === ChangeDetectionStrategy.OnPush, directiveDefs: null!, // assigned in noSideEffects pipeDefs: null!, // assigned in noSideEffects - standalone: componentDefinition.standalone === true, - dependencies: - componentDefinition.standalone === true && componentDefinition.dependencies || null, + standalone, + dependencies: standalone && componentDefinition.dependencies || null, getStandaloneInjector: null, selectors: componentDefinition.selectors || EMPTY_ARRAY, viewQuery: componentDefinition.viewQuery || null,