@@ -41,15 +41,13 @@ import {
4141 ControlFlowBlockType ,
4242 DeferBlockData ,
4343 ForLoopBlockData ,
44- RepeaterMetadataShape ,
4544} from './control_flow_types' ;
4645import { TNode } from '../interfaces/node' ;
46+ import { RepeaterMetadata } from '../instructions/control_flow' ;
4747
4848/**
4949 * Gets all of the control flow blocks that are present inside the specified DOM node.
5050 * @param node Node in which to look for control flow blocks.
51- *
52- * @publicApi
5351 */
5452export function getControlFlowBlocks ( node : Node ) : ControlFlowBlock [ ] {
5553 const results : ControlFlowBlock [ ] = [ ] ;
@@ -91,8 +89,6 @@ const deferBlockFinder: ControlFlowBlockViewFinder = ({
9189 const tDetails = getTDeferBlockDetails ( tView , tNode ) ;
9290
9391 if ( isTDeferBlockDetails ( tDetails ) ) {
94- // return {lContainer, lView, tNode, tDetails};
95-
9692 const native = getNativeByTNode ( tNode , lView ) ;
9793 const lDetails = getLDeferBlockDetails ( lView , tNode ) ;
9894
@@ -174,7 +170,7 @@ const forLoopFinder: ControlFlowBlockViewFinder = ({
174170} : ControlFlowBlockViewFinderConfig ) => {
175171 const slot = lView [ slotIdx ] ;
176172
177- if ( ! isRepeaterMetadata ( slot ) ) {
173+ if ( ! ( slot instanceof RepeaterMetadata ) ) {
178174 return null ;
179175 }
180176
@@ -318,27 +314,13 @@ function getRendererLView(lContainer: LContainer): LView | null {
318314 return lView ;
319315}
320316
321- /**
322- * Checks if a value looks like RepeaterMetadata by duck-typing.
323- * Can't use instanceof because that would require importing from control_flow.ts.
324- */
325- function isRepeaterMetadata ( value : unknown ) : value is RepeaterMetadataShape {
326- return (
327- value !== null &&
328- typeof value === 'object' &&
329- 'hasEmptyBlock' in value &&
330- 'trackByFn' in value &&
331- typeof ( value as RepeaterMetadataShape ) . trackByFn === 'function'
332- ) ;
333- }
334-
335317/**
336318 * Returns the string representation of the track expression.
337319 *
338320 * @param metadata Metadata containing the track function.
339321 * @returns
340322 */
341- function getTrackExpression ( metadata : RepeaterMetadataShape ) : string {
323+ function getTrackExpression ( metadata : RepeaterMetadata ) : string {
342324 const trackByFn = metadata . trackByFn ;
343325 if ( trackByFn . name === 'ɵɵrepeaterTrackByIndex' ) {
344326 return '$index' ;
0 commit comments