Skip to content

Commit 6ee8922

Browse files
resyntax-ci[bot]rfindler
authored andcommitted
Fix 4 occurrences of let-to-define
Internal definitions are recommended instead of `let` expressions, to reduce nesting.
1 parent 3932fab commit 6ee8922

File tree

1 file changed

+63
-63
lines changed

1 file changed

+63
-63
lines changed

drracket/gui-debugger/debug-tool.rkt

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -384,24 +384,24 @@
384384
(if (cons? stat) "Change return value..." "Skip expression...")
385385
menu
386386
(lambda (item evt)
387-
(let ([tmp (get-text-from-user "Return value" #f)])
388-
(when tmp
389-
(let/ec k
390-
(send (get-tab) set-break-status
391-
(cons 'exit-break
392-
(call-with-values
393-
(lambda ()
394-
(with-handlers ([exn:fail? (lambda (exn)
395-
(message-box
396-
"Debugger Error"
387+
(define tmp (get-text-from-user "Return value" #f))
388+
(when tmp
389+
(let/ec k
390+
(send (get-tab) set-break-status
391+
(cons 'exit-break
392+
(call-with-values
393+
(lambda ()
394+
(with-handlers ([exn:fail?
395+
(lambda (exn)
396+
(message-box "Debugger Error"
397397
(format "An error occurred: ~a"
398398
(exn-message exn))
399399
#f
400400
'(ok))
401-
(k))])
402-
(read (open-input-string tmp))))
403-
list)))
404-
(invalidate-bitmap-cache)))))))]
401+
(k))])
402+
(read (open-input-string tmp))))
403+
list)))
404+
(invalidate-bitmap-cache))))))]
405405
[else
406406
(make-object menu-item%
407407
"Continue to this point"
@@ -521,47 +521,47 @@
521521
(define frame-num (send (get-tab) get-frame-num))
522522
(define break-status (send (get-tab) get-break-status))
523523
(when (and (eq? frame-defs this) start end)
524-
(let*-values ([(xl yl xr yr) (find-char-box this start)]
525-
[(ym) (average yl yr)]
526-
[(xa ya xb yb) (find-char-box this end)]
527-
[(diameter) (- xb xa)]
528-
[(yoff) (/ (- yb ya diameter) 2)]
529-
[(ym2) (average ya yb)])
530-
(let ([op (send dc get-pen)]
531-
[ob (send dc get-brush)])
532-
(cond
533-
[(and (zero? frame-num) (eq? break-status 'error))
534-
(send dc set-pen pc-err-pen)
535-
(send dc set-brush pc-err-brush)]
536-
[(and (zero? frame-num) (eq? break-status 'break))
537-
(send dc set-pen pc-brk-pen)
538-
(send dc set-brush pc-brk-brush)]
539-
[(zero? frame-num)
540-
(send dc set-pen pc-pen)
541-
(send dc set-brush pc-brush)]
542-
[else
543-
(send dc set-pen pc-up-stack-pen)
544-
(send dc set-brush pc-up-stack-brush)])
545-
(unless (and (zero? frame-num) (cons? break-status))
546-
;; mark the beginning of the expression with a triangle
547-
(send dc draw-polygon
548-
(list (make-object point% xl yl)
549-
(make-object point% xl yr)
550-
(make-object point% xr ym))
551-
dx
552-
dy))
553-
(if (and (zero? frame-num) (cons? break-status))
554-
;; top frame, end: mark the end of the expression with a triangle
555-
(send dc draw-polygon
556-
(list (make-object point% xa ya)
557-
(make-object point% xa yb)
558-
(make-object point% xb ym2))
559-
dx
560-
dy)
561-
;; otherwise: make the end of the expression with a circle
562-
(send dc draw-ellipse (+ xa dx) (+ ya dy yoff) diameter diameter))
563-
(send dc set-pen op)
564-
(send dc set-brush ob))))))
524+
(define-values (xl yl xr yr) (find-char-box this start))
525+
(define ym (average yl yr))
526+
(define-values (xa ya xb yb) (find-char-box this end))
527+
(define diameter (- xb xa))
528+
(define yoff (/ (- yb ya diameter) 2))
529+
(define ym2 (average ya yb))
530+
(define op (send dc get-pen))
531+
(define ob (send dc get-brush))
532+
(cond
533+
[(and (zero? frame-num) (eq? break-status 'error))
534+
(send dc set-pen pc-err-pen)
535+
(send dc set-brush pc-err-brush)]
536+
[(and (zero? frame-num) (eq? break-status 'break))
537+
(send dc set-pen pc-brk-pen)
538+
(send dc set-brush pc-brk-brush)]
539+
[(zero? frame-num)
540+
(send dc set-pen pc-pen)
541+
(send dc set-brush pc-brush)]
542+
[else
543+
(send dc set-pen pc-up-stack-pen)
544+
(send dc set-brush pc-up-stack-brush)])
545+
(unless (and (zero? frame-num) (cons? break-status))
546+
;; mark the beginning of the expression with a triangle
547+
(send dc draw-polygon
548+
(list (make-object point% xl yl)
549+
(make-object point% xl yr)
550+
(make-object point% xr ym))
551+
dx
552+
dy))
553+
(if (and (zero? frame-num) (cons? break-status))
554+
;; top frame, end: mark the end of the expression with a triangle
555+
(send dc draw-polygon
556+
(list (make-object point% xa ya)
557+
(make-object point% xa yb)
558+
(make-object point% xb ym2))
559+
dx
560+
dy)
561+
;; otherwise: make the end of the expression with a circle
562+
(send dc draw-ellipse (+ xa dx) (+ ya dy yoff) diameter diameter))
563+
(send dc set-pen op)
564+
(send dc set-brush ob))))
565565

566566
(define/augment (after-set-next-settings s)
567567
(let ([tlw (get-top-level-window)])
@@ -799,8 +799,8 @@
799799
bp)))))))
800800
; break-before
801801
(lambda (top-mark ccm)
802-
(let* ([debug-marks (continuation-mark-set->list ccm debug-key)])
803-
(send (get-tab) suspend oeh (cons top-mark debug-marks) 'entry-break)))
802+
(define debug-marks (continuation-mark-set->list ccm debug-key))
803+
(send (get-tab) suspend oeh (cons top-mark debug-marks) 'entry-break))
804804
; break-after
805805
(case-lambda
806806
[(top-mark ccm val)
@@ -810,12 +810,12 @@
810810
(cons top-mark debug-marks)
811811
(list 'exit-break val))))]
812812
[(top-mark ccm . vals)
813-
(let* ([debug-marks (continuation-mark-set->list ccm debug-key)])
814-
(apply values
815-
(send (get-tab) suspend
816-
oeh
817-
(cons top-mark debug-marks)
818-
(cons 'exit-break vals))))])))
813+
(define debug-marks (continuation-mark-set->list ccm debug-key))
814+
(apply values
815+
(send (get-tab) suspend
816+
oeh
817+
(cons top-mark debug-marks)
818+
(cons 'exit-break vals)))])))
819819
(uncaught-exception-handler
820820
(lambda (exn)
821821
(if (and (exn:break? exn) (send (get-tab) suspend-on-break?))

0 commit comments

Comments
 (0)