further improvements to source locations for `require' forms

This commit is contained in:
Matthew Flatt 2012-09-30 06:32:26 -06:00
parent 259a2b8c19
commit 9047427e07
4 changed files with 18 additions and 7 deletions

View File

@ -24,8 +24,10 @@
(raise-argument-error 'make-import "identifier?" i))
(unless (symbol? s)
(raise-argument-error 'make-import "symbol?" s))
(unless (module-path? path)
(raise-argument-error 'make-import "module-path?" path))
(unless (or (module-path? path)
(and (syntax? path)
(module-path? (syntax->datum path))))
(raise-argument-error 'make-import "(or/c module-path? module-path-syntax?)" path))
(unless (or (not mode)
(exact-integer? mode))
(raise-argument-error 'make-import "(or/c exact-integer? #f)" mode))
@ -292,14 +294,19 @@
name
stx)
name
mod-path
(if (equal? (syntax->datum #'simple) mod-path)
#'simple
mod-path)
mode
0
mode
stx))
(cdr names))))
namess))
(list (make-import-source (datum->syntax #'simple mod-path #'simple #'simple) 0)))))]
(list (make-import-source (if (equal? (syntax->datum #'simple) mod-path)
#'simple
(datum->syntax #'simple mod-path #'simple))
0)))))]
[(id . rest)
(identifier? #'id)
(let ([t (syntax-local-value #'id (lambda () #f))])

View File

@ -893,7 +893,10 @@ Returns @racket[#t] if @racket[v] has the
@defstruct[import ([local-id identifier?]
[src-sym symbol?]
[src-mod-path module-path?]
[src-mod-path (or/c module-path?
(and/c syntax?
(lambda (stx)
(module-path? (syntax->datum stx)))))]
[mode (or/c exact-integer? #f)]
[req-mode (or/c exact-integer? #f)]
[orig-mode (or/c exact-integer? #f)]

View File

@ -800,8 +800,8 @@
(_only rl2))))
(list #'rl1 #'rl2)]))
(test (list #f #t) map syntax-original? r/ls)
(test (list #f #t) map number? (map syntax-position r/ls)))
(test (list #t #t) map syntax-original? r/ls)
(test (list #t #t) map number? (map syntax-position r/ls)))
;; ----------------------------------------

View File

@ -4,6 +4,7 @@ Added reroot-path
Added #:break and #:final clauses to for forms
syntax/for-body: added
racket/set: added set-first and set-rest, sets are streams
racket/require-transformer: an import's module path can be syntax
Version 5.3.0.23
Changed make-log-receiver to accept a logger name as an