Skip to content

Commit 867f442

Browse files
committed
audit calls to find-source-editor to make sure they check the results
when it returns #f then there is no sensible source so just ignore this syntax object
1 parent d73c1f5 commit 867f442

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

drracket-tool-text-lib/drracket/private/syncheck/traversals.rkt

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -704,10 +704,12 @@
704704
(loop (car prop))
705705
(loop (cdr prop))]
706706
[(mouse-over-tooltip-prop? prop)
707-
(add-mouse-over/loc (find-source-editor (vector-ref prop 0))
708-
(vector-ref prop 1)
709-
(vector-ref prop 2)
710-
(vector-ref prop 3))])))
707+
(define src (find-source-editor (vector-ref prop 0)))
708+
(when src
709+
(add-mouse-over/loc src
710+
(vector-ref prop 1)
711+
(vector-ref prop 2)
712+
(vector-ref prop 3)))])))
711713

712714
;; add-disappeared-bindings : syntax id-set integer -> void
713715
(define (add-disappeared-bindings stx
@@ -1208,7 +1210,7 @@
12081210
(define source (find-source-editor binder))
12091211
(define pos (syntax-position binder))
12101212
(define span (syntax-span binder))
1211-
(when (and pos span)
1213+
(when (and source pos span)
12121214
(define pos-left (sub1 pos))
12131215
(define pos-right (+ pos-left span))
12141216
(define connections-start
@@ -1344,14 +1346,14 @@
13441346
[_ #f]))
13451347
(when prefix
13461348
(define prefix-source (find-source-editor prefix))
1347-
(define prefix-start (and prefix-source
1348-
(syntax-position prefix)
1349-
(- (syntax-position prefix) 1)))
1350-
(define prefix-end (and prefix-start
1351-
(syntax-span prefix)
1352-
(+ prefix-start (syntax-span prefix))))
1353-
(send defs-text syncheck:add-prefixed-require-reference req-source start end
1354-
(syntax-e prefix) prefix-source prefix-start prefix-end)))))))
1349+
(when prefix-source
1350+
(define prefix-start (and (syntax-position prefix)
1351+
(- (syntax-position prefix) 1)))
1352+
(define prefix-end (and prefix-start
1353+
(syntax-span prefix)
1354+
(+ prefix-start (syntax-span prefix))))
1355+
(send defs-text syncheck:add-prefixed-require-reference req-source start end
1356+
(syntax-e prefix) prefix-source prefix-start prefix-end))))))))
13551357

13561358
;; get-require-filename : sexp-or-module-path-index namespace string[directory] -> filename or #f
13571359
;; finds the filename corresponding to the require in stx

0 commit comments

Comments
 (0)