MCPcopy Index your code
hub / github.com/angular/angular / applyCreateOpCodes

Function applyCreateOpCodes

packages/core/src/render3/i18n/i18n_apply.ts:204–235  ·  view source on GitHub ↗
(
  lView: LView,
  createOpCodes: I18nCreateOpCodes,
  parentRNode: RElement | null,
  insertInFrontOf: RElement | null,
)

Source from the content-addressed store, hash-verified

202 * @param insertInFrontOf DOM node that should be used as an anchor.
203 */
204export function applyCreateOpCodes(
205 lView: LView,
206 createOpCodes: I18nCreateOpCodes,
207 parentRNode: RElement | null,
208 insertInFrontOf: RElement | null,
209): void {
210 const renderer = lView[RENDERER];
211 for (let i = 0; i < createOpCodes.length; i++) {
212 const opCode = createOpCodes[i++] as any;
213 const text = createOpCodes[i] as string;
214 const isComment = (opCode & I18nCreateOpCode.COMMENT) === I18nCreateOpCode.COMMENT;
215 const appendNow =
216 (opCode & I18nCreateOpCode.APPEND_EAGERLY) === I18nCreateOpCode.APPEND_EAGERLY;
217 const index = opCode >>> I18nCreateOpCode.SHIFT;
218 let rNode = lView[index];
219 let lastNodeWasCreated = false;
220 if (rNode === null) {
221 // We only create new DOM nodes if they don't already exist: If ICU switches case back to a
222 // case which was already instantiated, no need to create new DOM nodes.
223 rNode = lView[index] = _locateOrCreateNode(
224 lView,
225 index,
226 text,
227 isComment ? Node.COMMENT_NODE : Node.TEXT_NODE,
228 );
229 lastNodeWasCreated = wasLastNodeCreated();
230 }
231 if (appendNow && parentRNode !== null && lastNodeWasCreated) {
232 nativeInsertBefore(renderer, parentRNode, rNode, insertInFrontOf, false);
233 }
234 }
235}
236
237/**
238 * Apply `I18nMutateOpCodes` OpCodes.

Callers 2

i18n_parse_spec.tsFile · 0.90
ɵɵi18nStartFunction · 0.90

Calls 3

wasLastNodeCreatedFunction · 0.90
nativeInsertBeforeFunction · 0.90
_locateOrCreateNodeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…