@@ -748,68 +748,57 @@ export function schedule_effect(signal) {
748
748
* bitwise flag passed in only. The collected effects array will be populated with all the user
749
749
* effects to be flushed.
750
750
*
751
- * @param {Effect } effect
751
+ * @param {Effect } root
752
752
* @returns {Effect[] }
753
753
*/
754
- function process_effects ( effect ) {
754
+ function process_effects ( root ) {
755
755
/** @type {Effect[] } */
756
756
var effects = [ ] ;
757
757
758
- var current_effect = effect . first ;
758
+ var effect = root . first ;
759
759
760
- main_loop: while ( current_effect !== null ) {
761
- var flags = current_effect . f ;
760
+ while ( effect !== null ) {
761
+ var flags = effect . f ;
762
762
var is_branch = ( flags & BRANCH_EFFECT ) !== 0 ;
763
763
var is_skippable_branch = is_branch && ( flags & CLEAN ) !== 0 ;
764
- var sibling = current_effect . next ;
765
764
766
765
if ( ! is_skippable_branch && ( flags & INERT ) === 0 ) {
767
766
if ( ( flags & EFFECT ) !== 0 ) {
768
- effects . push ( current_effect ) ;
767
+ effects . push ( effect ) ;
769
768
} else if ( is_branch ) {
770
- current_effect . f ^= CLEAN ;
769
+ effect . f ^= CLEAN ;
771
770
} else {
772
771
// Ensure we set the effect to be the active reaction
773
772
// to ensure that unowned deriveds are correctly tracked
774
773
// because we're flushing the current effect
775
774
var previous_active_reaction = active_reaction ;
776
775
try {
777
- active_reaction = current_effect ;
778
- if ( check_dirtiness ( current_effect ) ) {
779
- update_effect ( current_effect ) ;
776
+ active_reaction = effect ;
777
+ if ( check_dirtiness ( effect ) ) {
778
+ update_effect ( effect ) ;
780
779
}
781
780
} catch ( error ) {
782
- handle_error ( error , current_effect , null , current_effect . ctx ) ;
781
+ handle_error ( error , effect , null , effect . ctx ) ;
783
782
} finally {
784
783
active_reaction = previous_active_reaction ;
785
784
}
786
785
}
787
786
788
- var child = current_effect . first ;
787
+ var child = effect . first ;
789
788
790
789
if ( child !== null ) {
791
- current_effect = child ;
790
+ effect = child ;
792
791
continue ;
793
792
}
794
793
}
795
794
796
- if ( sibling === null ) {
797
- let parent = current_effect . parent ;
795
+ var parent = effect . parent ;
796
+ effect = effect . next ;
798
797
799
- while ( parent !== null ) {
800
- if ( effect === parent ) {
801
- break main_loop;
802
- }
803
- var parent_sibling = parent . next ;
804
- if ( parent_sibling !== null ) {
805
- current_effect = parent_sibling ;
806
- continue main_loop;
807
- }
808
- parent = parent . parent ;
809
- }
798
+ while ( effect === null && parent !== null ) {
799
+ effect = parent . next ;
800
+ parent = parent . parent ;
810
801
}
811
-
812
- current_effect = sibling ;
813
802
}
814
803
815
804
return effects ;
0 commit comments