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