@@ -676,36 +676,29 @@ function get_descendant_elements(element, include_self) {
676676
677677 /**
678678 * @param {Compiler.AST.SvelteNode } node
679- * @param {{ is_child: boolean } } state
680679 */
681- function walk_children ( node , state ) {
682- walk ( node , state , {
683- _ ( node , context ) {
684- if ( node . type === 'RegularElement' || node . type === 'SvelteElement' ) {
685- descendants . push ( node ) ;
686-
687- if ( context . state . is_child ) {
688- context . state . is_child = false ;
689- context . next ( ) ;
690- context . state . is_child = true ;
691- } else {
692- context . next ( ) ;
693- }
694- } else if ( node . type === 'RenderTag' ) {
695- for ( const snippet of node . metadata . snippets ) {
696- if ( seen . has ( snippet ) ) continue ;
680+ function walk_children ( node ) {
681+ walk ( node , null , {
682+ RegularElement ( node , context ) {
683+ descendants . push ( node ) ;
684+ context . next ( ) ;
685+ } ,
686+ SvelteElement ( node , context ) {
687+ descendants . push ( node ) ;
688+ context . next ( ) ;
689+ } ,
690+ RenderTag ( node ) {
691+ for ( const snippet of node . metadata . snippets ) {
692+ if ( seen . has ( snippet ) ) continue ;
697693
698- seen . add ( snippet ) ;
699- walk_children ( snippet . body , context . state ) ;
700- }
701- } else {
702- context . next ( ) ;
694+ seen . add ( snippet ) ;
695+ walk_children ( snippet . body ) ;
703696 }
704- }
697+ } ,
705698 } ) ;
706699 }
707700
708- walk_children ( element . fragment , { is_child : true } ) ;
701+ walk_children ( element . fragment ) ;
709702
710703 return descendants ;
711704}
0 commit comments