fix a problem with the way that check syntax's interval map

tracks information about the program
This commit is contained in:
Robby Findler 2013-02-02 19:34:20 -06:00
parent 2e8ffe7400
commit 25f92f8e9e
2 changed files with 22 additions and 10 deletions

View File

@ -811,11 +811,12 @@ If the namespace does not, they are colored the unbound color.
;; the last test in the above and is because some syntax objects
;; appear to be from the original source, but can have bogus information.
;; Use (add1 end) below, because interval-maps use half-open intervals
;; ie, [start, end] = [start, end+1)
;; interval-maps use half-open intervals which works out well for positions
;; in the editor, since the interval [0,3) covers the characters just after
;; positions 0, 1, and 2, but not the character at position 3 (positions are
;; between characters)
(cond [use-key?
(interval-map-update*! arrow-record
start (add1 end)
(interval-map-update*! arrow-record start end
(lambda (old)
(if (for/or ([x (in-list old)])
(and (pair? x) (car x) (eq? (car x) key)))
@ -823,9 +824,8 @@ If the namespace does not, they are colored the unbound color.
(cons (cons key to-add) old)))
null)]
[else
(interval-map-cons*! arrow-record
start (add1 end)
to-add null)])))
(interval-map-cons*!
arrow-record start end to-add null)])))
(define/private (add-identifier-to-range text/start/ends name-dup?)
(define id-set (apply set text/start/ends))
@ -835,8 +835,7 @@ If the namespace does not, they are colored the unbound color.
(define arrow-record (get-arrow-record arrow-records (list-ref text/start/span 0)))
(define start (list-ref text/start/span 1))
(define end (list-ref text/start/span 2))
(interval-map-update*! arrow-record
start (add1 end)
(interval-map-update*! arrow-record start end
(lambda (curr-val)
(define this-uf-set
(for/or ([thing (in-list curr-val)])

View File

@ -1149,7 +1149,20 @@
" x x x x x x x x x x x x x x x x x x x x x x x x\n"
" x x x x x x x x x x x x x x x x x x x x x x x x\n"
" x x x x x x x x x x x x x x x x x x x x x x x x)\n"))
))
(build-rename-test
(string-append
"#lang racket\n"
"(let ([x 1])\n"
" x`1\n"
" `2)\n")
20
"x"
"y"
(string-append
"#lang racket\n"
"(let ([y 1])\n"
" y`1\n"
" `2)\n"))))
(define (main)