( tView: TView, lView: LView<T>, templateFn: ComponentTemplate<T>, rf: RenderFlags, context: T, )
| 84 | import {writeToDirectiveInput} from './write_to_directive_input'; |
| 85 | |
| 86 | export function executeTemplate<T>( |
| 87 | tView: TView, |
| 88 | lView: LView<T>, |
| 89 | templateFn: ComponentTemplate<T>, |
| 90 | rf: RenderFlags, |
| 91 | context: T, |
| 92 | ) { |
| 93 | const prevSelectedIndex = getSelectedIndex(); |
| 94 | const isUpdatePhase = rf & RenderFlags.Update; |
| 95 | try { |
| 96 | setSelectedIndex(-1); |
| 97 | if (isUpdatePhase && lView.length > HEADER_OFFSET) { |
| 98 | // When we're updating, inherently select 0 so we don't |
| 99 | // have to generate that instruction for most update blocks. |
| 100 | selectIndexInternal(tView, lView, HEADER_OFFSET, !!ngDevMode && isInCheckNoChangesMode()); |
| 101 | } |
| 102 | |
| 103 | const preHookType = isUpdatePhase |
| 104 | ? ProfilerEvent.TemplateUpdateStart |
| 105 | : ProfilerEvent.TemplateCreateStart; |
| 106 | profiler(preHookType, context as unknown as {}, templateFn); |
| 107 | templateFn(rf, context); |
| 108 | } finally { |
| 109 | setSelectedIndex(prevSelectedIndex); |
| 110 | |
| 111 | const postHookType = isUpdatePhase |
| 112 | ? ProfilerEvent.TemplateUpdateEnd |
| 113 | : ProfilerEvent.TemplateCreateEnd; |
| 114 | profiler(postHookType, context as unknown as {}, templateFn); |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | /** |
| 119 | * Creates directive instances. |
no test coverage detected
searching dependent graphs…