@@ -494,7 +494,7 @@ this map (identified by a key), and will `dissoc` it afterwards."}
494
494
{:style/indent 1 }
495
495
[form dbg-state original-form]
496
496
`(with-initial-debug-bindings
497
- (breakpoint-if-interesting
497
+ (breakpoint
498
498
~form ~dbg-state ~original-form)))
499
499
500
500
(defmacro breakpoint-if-exception-with-initial-debug-bindings
@@ -571,29 +571,34 @@ this map (identified by a key), and will `dissoc` it afterwards."}
571
571
(and (seq? form)
572
572
(irrelevant-return-value-forms (first form)))))
573
573
574
+ (defmacro breakpoint
575
+ " Wrap form in a breakpoint unconditionally."
576
+ [form {:keys [coor] :as dbg-state} original-form]
577
+ (let [condition (:break/when (meta form))]
578
+ (if condition
579
+ ; ; If there is a condition and it is falsy, we need to skip
580
+ ; ; the current level (:deeper than parent coor), but only
581
+ ; ; once. Next time, we need to test the condition again.
582
+ `(let [old-breaks# @*skip-breaks*]
583
+ (when-not ~condition
584
+ (skip-breaks! :deeper ~(vec (butlast coor)) (:code (:msg ~'STATE__)) false ))
585
+ (try
586
+ (expand-break ~form ~dbg-state ~original-form)
587
+ ; ; in case :continue-all was requested in a deeper level
588
+ ; ; we don't want go back to the old-breaks
589
+ (finally (when (not= :all (:mode @*skip-breaks*))
590
+ (reset! *skip-breaks* old-breaks#)))))
591
+ `(expand-break ~form ~dbg-state ~original-form))))
592
+
574
593
(defmacro breakpoint-if-interesting
575
594
" Wrap form in a breakpoint if it looks interesting.
576
595
Uninteresting forms are symbols that resolve to `clojure.core`
577
596
(taking locals into account), and sexps whose head is present in
578
597
`irrelevant-return-value-forms`. Used as :breakfunction in `tag-form`."
579
- [form { :keys [coor] :as dbg-state} original-form]
598
+ [form dbg-state original-form]
580
599
(if (uninteresting-form? &env form)
581
600
form
582
- (let [condition (:break/when (meta form))]
583
- (if condition
584
- ; ; If there is a condition and it is falsy, we need to skip
585
- ; ; the current level (:deeper than parent coor), but only
586
- ; ; once. Next time, we need to test the condition again.
587
- `(let [old-breaks# @*skip-breaks*]
588
- (when-not ~condition
589
- (skip-breaks! :deeper ~(vec (butlast coor)) (:code (:msg ~'STATE__)) false ))
590
- (try
591
- (expand-break ~form ~dbg-state ~original-form)
592
- ; ; in case :continue-all was requested in a deeper level
593
- ; ; we don't want go back to the old-breaks
594
- (finally (when (not= :all (:mode @*skip-breaks*))
595
- (reset! *skip-breaks* old-breaks#)))))
596
- `(expand-break ~form ~dbg-state ~original-form)))))
601
+ `(breakpoint ~form ~dbg-state ~original-form)))
597
602
598
603
(defmacro breakpoint-if-exception
599
604
" Wrap form in a try-catch that has breakpoint on exception.
0 commit comments