perf(ivy): move local references into consts array (#33129)
Follow-up from #32798. Moves the local references array into the component def's `consts` in order to make it compress better. Before: ``` const _c0 = ['foo', '']; SomeComp.ngComponentDef = defineComponent({ template: function() { element(0, 'div', null, _c0); } }); ``` After: ``` SomeComp.ngComponentDef = defineComponent({ consts: [['foo', '']], template: function() { element(0, 'div', null, 0); } }); ``` PR Close #33129
This commit is contained in:
@ -10,7 +10,7 @@ import {assertDataInRange, assertDefined, assertDomNode, assertGreaterThan, asse
|
||||
import {assertTNodeForLView} from '../assert';
|
||||
import {LContainer, TYPE} from '../interfaces/container';
|
||||
import {LContext, MONKEY_PATCH_KEY_NAME} from '../interfaces/context';
|
||||
import {TNode} from '../interfaces/node';
|
||||
import {TConstants, TNode} from '../interfaces/node';
|
||||
import {RNode, isProceduralRenderer} from '../interfaces/renderer';
|
||||
import {isLContainer, isLView} from '../interfaces/type_checks';
|
||||
import {FLAGS, HEADER_OFFSET, HOST, LView, LViewFlags, PARENT, PREORDER_HOOK_FLAGS, RENDERER, TData, TVIEW} from '../interfaces/view';
|
||||
@ -175,6 +175,11 @@ export function viewAttachedToContainer(view: LView): boolean {
|
||||
return isLContainer(view[PARENT]);
|
||||
}
|
||||
|
||||
/** Returns a constant from `TConstants` instance. */
|
||||
export function getConstant(consts: TConstants | null, index: number | null | undefined) {
|
||||
return consts === null || index == null ? null : consts[index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the pre-order hook flags of the view.
|
||||
* @param lView the LView on which the flags are reset
|
||||
|
Reference in New Issue
Block a user