commit 2de80c8091829e66365dd52bc2e45a0963bec801
parent 6ac55c8e7237a88d06aa5022f35647c407016854
Author: Ryan Culpepper <ryanc@racket-lang.org>
Date: Wed, 1 Feb 2017 19:05:13 -0500
syntax/parse: fix ps->stx+index; fixes #1602
Collapse CDR frames separated by ORD, POST, etc. For example,
(1 ORD 2 stx) should be same as (3 stx).
Diffstat:
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/parse/private/runtime-report.rkt b/parse/private/runtime-report.rkt
@@ -262,18 +262,19 @@ ie (ps->stx+index ps1) = (ps->stx+index ps2).
(interp parent)]
[(cons 'post parent)
(interp parent)]))
- (let ([ps (ps-truncate-opaque ps)])
+ (let loop ([ps (ps-truncate-opaque ps)])
(match ps
[(cons (? syntax? stx) _)
(cons stx 0)]
- [(cons 'car parent)
+ [(cons 'car _)
(cons (interp ps) 0)]
[(cons (? exact-positive-integer? n) parent)
- (cons (interp parent) n)]
+ (match (loop parent)
+ [(cons stx m) (cons stx (+ m n))])]
[(cons (? ord?) parent)
- (ps->stx+index parent)]
+ (loop parent)]
[(cons 'post parent)
- (ps->stx+index parent)])))
+ (loop parent)])))
;; ============================================================