Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions private/source.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
[source-code-analysis? (-> any/c boolean?)]
[source-code-analysis-code (-> source-code-analysis? source?)]
[source-code-analysis-visited-forms (-> source-code-analysis? (listof syntax?))]
[source-code-analysis-expansion-time-output (-> source-code-analysis? immutable-string?)]
[syntax-source-location (-> syntax? source-location?)]
[with-input-from-source (-> source? (-> any) any)]))

Expand Down Expand Up @@ -78,7 +79,7 @@
#:guard (λ (original contents _) (values original (string->immutable-string contents))))


(define-record-type source-code-analysis (code visited-forms))
(define-record-type source-code-analysis (code visited-forms expansion-time-output))
(define-record-type source-location (source line column position span))


Expand Down Expand Up @@ -177,9 +178,13 @@
(add-all-original-subforms! visited))]
[(_ _) (void)])

(define output-port (open-output-string))
(define expanded
(parameterize ([current-expand-observe observe-event!])
(parameterize ([current-expand-observe observe-event!]
[current-output-port output-port])
(expand program-stx)))

(define output (get-output-string output-port))
(define binding-table (fully-expanded-syntax-binding-table expanded))
(define original-binding-table-by-position
(for*/fold ([table (hash)])
Expand Down Expand Up @@ -221,7 +226,7 @@
(sorting syntax-source-location<=> #:key syntax-source-location)
#:into into-list))

(source-code-analysis #:code code #:visited-forms visited)))
(source-code-analysis #:code code #:visited-forms visited #:expansion-time-output output)))


(define (syntax-source-location stx)
Expand Down
Loading