fix zo-parse, zo-struct, etc. for context in whole-module import

This commit is contained in:
Matthew Flatt 2012-06-23 05:21:08 -07:00
parent 28a47f245e
commit 6173b7eb05
5 changed files with 28 additions and 14 deletions

View File

@ -406,11 +406,13 @@
(define (encode-all-from-module afm)
(match afm
[(struct all-from-module (path phase src-phase #f #f))
[(struct all-from-module (path phase src-phase null #f null))
(list* path phase src-phase)]
[(struct all-from-module (path phase src-phase exns #f))
[(struct all-from-module (path phase src-phase null #f context))
(list* path phase context src-phase)]
[(struct all-from-module (path phase src-phase exns #f null))
(list* path phase exns src-phase)]
[(struct all-from-module (path phase src-phase exns (vector prefix)))
[(struct all-from-module (path phase src-phase exns prefix null))
(list* path phase src-phase exns prefix)]))
(define (encode-wraps wraps)

View File

@ -694,25 +694,31 @@
[else (error 'parse "bad phase shift: ~e" a)])]
[else (error 'decode-wraps "bad wrap element: ~e" a)])))
(define (afm-context? v)
(or (and (list? v) (andmap exact-integer? v))
(and (vector? v)
(= 2 (vector-length v))
(list? (vector-ref v 0))
(andmap exact-integer? (vector-ref v 0)))))
(define all-from-module-memo (make-memo))
(define (decode-all-from-module cp afm)
(define (phase? v)
(or (number? v) (not v)))
(with-memo all-from-module-memo afm
(match afm
[(list* path (? phase? phase) (? phase? src-phase)
(list exn ...) prefix)
[(list* path (? phase? phase) (? phase? src-phase) (list exn ...) prefix)
(make-all-from-module
(parse-module-path-index cp path)
phase src-phase exn (vector prefix))]
[(list* path (? phase? phase) (list exn ...) (? phase? src-phase))
phase src-phase exn prefix null)]
[(list* path (? phase? phase) (? afm-context? context) (? phase? src-phase))
(make-all-from-module
(parse-module-path-index cp path)
phase src-phase exn #f)]
phase src-phase null #f context)]
[(list* path (? phase? phase) (? phase? src-phase))
(make-all-from-module
(parse-module-path-index cp path)
phase src-phase #f #f)])))
phase src-phase null #f null)])))
(define wraps-memo (make-memo))
(define (decode-wraps cp w)

View File

@ -202,9 +202,11 @@
(define-form-struct all-from-module ([path module-path-index?]
[phase (or/c exact-integer? #f)]
[src-phase any/c] ; should be (or/c exact-integer? #f)
[exceptions (or/c (listof (or/c symbol? number?)) #f)] ; should be (listof symbol?)
[prefix (or/c (vector/c (or/c symbol? #f)) #f)])) ; should be (or/c symbol? #f)
[src-phase (or/c exact-integer? #f)]
[exceptions (listof symbol?)]
[prefix (or/c symbol? #f)]
[context (or/c (listof exact-integer?)
(vector/c (listof exact-integer?) any/c))]))
(define-form-struct nominal-path ())
(define-form-struct (simple-nominal-path nominal-path) ([value module-path-index?]))

View File

@ -549,8 +549,11 @@ structures that are produced by @racket[zo-parse] and consumed by
([path module-path-index?]
[phase (or/c exact-integer? #f)]
[src-phase (or/c exact-integer? #f)]
[exceptions (listof (or/c symbol? number?))]
[prefix (or/c symbol? #f)])]{
[exceptions (listof symbol?)]
[prefix (or/c symbol? #f)]
[context (or/c (listof exact-integer?)
(vector/c (listof exact-integer?) any/c)
#f)])]{
Represents a set of simple imports from one module within a
@racket[module-rename].}

View File

@ -9,6 +9,7 @@ racket/future: handling of internal stack overflow without
'start-overflow-work log events
racket/base: guarantee portable results for current-seconds
and file-or-directory-modify-seconds
compiler/zo-structs: added a context field to all-from-module
Version 5.3.0.10
racket/base: add progress-evt?, thread-cell-values?, prefab-key?,