@@ -48,18 +48,15 @@ import {TNode} from '../interfaces/node';
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 [ ] {
55- const results : ControlFlowBlock [ ] = [ ] ;
5653 const lView = getLContext ( node ) ?. lView ;
5754
5855 if ( lView ) {
59- findControlFlowBlocks ( node , lView , results ) ;
56+ return findControlFlowBlocks ( node , lView ) ;
6057 }
6158
62- return results ;
59+ return [ ] ;
6360}
6461
6562/**
@@ -91,8 +88,6 @@ const deferBlockFinder: ControlFlowBlockViewFinder = ({
9188 const tDetails = getTDeferBlockDetails ( tView , tNode ) ;
9289
9390 if ( isTDeferBlockDetails ( tDetails ) ) {
94- // return {lContainer, lView, tNode, tDetails};
95-
9691 const native = getNativeByTNode ( tNode , lView ) ;
9792 const lDetails = getLDeferBlockDetails ( lView , tNode ) ;
9893
@@ -222,9 +217,14 @@ const CONTROL_FLOW_BLOCK_FINDERS: ControlFlowBlockViewFinder[] = [deferBlockFind
222217 *
223218 * @param node Node in which to search for blocks.
224219 * @param lView View within the node in which to search for blocks.
225- * @param results Array to which to add blocks once they're found.
220+ * @param results (Optional) Array to which to add blocks once they're found.
221+ * @returns Found control flow blocks results array.
226222 */
227- function findControlFlowBlocks ( node : Node , lView : LView , results : ControlFlowBlock [ ] ) {
223+ function findControlFlowBlocks (
224+ node : Node ,
225+ lView : LView ,
226+ results : ControlFlowBlock [ ] = [ ] ,
227+ ) : ControlFlowBlock [ ] {
228228 const tView = lView [ TVIEW ] ;
229229
230230 for ( let i = HEADER_OFFSET ; i < tView . bindingStartIndex ; i ++ ) {
@@ -255,6 +255,8 @@ function findControlFlowBlocks(node: Node, lView: LView, results: ControlFlowBlo
255255 findControlFlowBlocks ( node , slot , results ) ;
256256 }
257257 }
258+
259+ return results ;
258260}
259261
260262/**
0 commit comments