From 90a0a6e5247eb26a4af20a54ecfcbb4d10bc2f4e Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Sun, 7 Jun 2009 01:18:56 +0000 Subject: [PATCH] PR 10275 svn: r15108 --- collects/redex/private/loc-wrapper.ss | 30 ++++++++++++++------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/collects/redex/private/loc-wrapper.ss b/collects/redex/private/loc-wrapper.ss index fefa83e225..4bc3b7df6f 100644 --- a/collects/redex/private/loc-wrapper.ss +++ b/collects/redex/private/loc-wrapper.ss @@ -128,20 +128,22 @@ [else (let ([start-line (or (lw-line lw) line)] [start-column (or (lw-column lw) col)]) - (let-values ([(last-line first-column last-column) - (add-spans/obj (lw-e lw) start-line start-column)]) - (unless (lw-line lw) - (set-lw-line! lw line)) - (set-lw-line-span! lw (- last-line start-line)) - - (unless (lw-column lw) - (set-lw-column! lw col)) - (let ([new-col (min (lw-column lw) - first-column)]) - (set-lw-column! lw new-col) - (set-lw-column-span! lw (- last-column new-col))) - - (values last-line first-column last-column)))])) + (when (and start-line ;; if we don't have src loc info, just give up. + start-column) + (let-values ([(last-line first-column last-column) + (add-spans/obj (lw-e lw) start-line start-column)]) + (unless (lw-line lw) + (set-lw-line! lw line)) + (set-lw-line-span! lw (- last-line start-line)) + + (unless (lw-column lw) + (set-lw-column! lw col)) + (let ([new-col (min (lw-column lw) + first-column)]) + (set-lw-column! lw new-col) + (set-lw-column-span! lw (- last-column new-col))) + + (values last-line first-column last-column))))])) (define (add-spans/obj e line col) (cond [(string? e)