perf(ivy): avoid generating selectors array for directives without a selector (#33431)
Now that we've replaced `ngBaseDef` with an abstract directive definition, there are a lot more cases where we generate a directive definition without a selector. These changes make it so that we don't generate the `selectors` array if it's going to be empty. PR Close #33431
This commit is contained in:
@ -48,7 +48,7 @@ export function ɵɵdefineComponent<T>(componentDefinition: {
|
||||
type: Type<T>;
|
||||
|
||||
/** The selectors that will be used to match nodes to this component. */
|
||||
selectors: CssSelectorList;
|
||||
selectors?: CssSelectorList;
|
||||
|
||||
/**
|
||||
* The number of nodes, local refs, and pipes in this component template.
|
||||
@ -275,7 +275,7 @@ export function ɵɵdefineComponent<T>(componentDefinition: {
|
||||
onPush: componentDefinition.changeDetection === ChangeDetectionStrategy.OnPush,
|
||||
directiveDefs: null !, // assigned in noSideEffects
|
||||
pipeDefs: null !, // assigned in noSideEffects
|
||||
selectors: componentDefinition.selectors,
|
||||
selectors: componentDefinition.selectors || EMPTY_ARRAY,
|
||||
viewQuery: componentDefinition.viewQuery || null,
|
||||
features: componentDefinition.features as DirectiveDefFeature[] || null,
|
||||
data: componentDefinition.data || {},
|
||||
@ -507,7 +507,7 @@ export const ɵɵdefineDirective = ɵɵdefineComponent as any as<T>(directiveDef
|
||||
type: Type<T>;
|
||||
|
||||
/** The selectors that will be used to match nodes to this directive. */
|
||||
selectors: CssSelectorList;
|
||||
selectors?: CssSelectorList;
|
||||
|
||||
/**
|
||||
* A map of input names.
|
||||
|
Reference in New Issue
Block a user