From 359eb87abbd56fd634de90a35fae31be1be914e9 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sat, 23 Jun 2012 05:21:08 -0700 Subject: [PATCH] fix zo-parse, zo-struct, etc. for context in whole-module import original commit: 6173b7eb058a99384567a20ab6778c1d6f350e6e --- collects/compiler/zo-marshal.rkt | 8 +++++--- collects/compiler/zo-parse.rkt | 18 ++++++++++++------ collects/compiler/zo-structs.rkt | 8 +++++--- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/collects/compiler/zo-marshal.rkt b/collects/compiler/zo-marshal.rkt index a9a1179f88..dc52cfd82e 100644 --- a/collects/compiler/zo-marshal.rkt +++ b/collects/compiler/zo-marshal.rkt @@ -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) diff --git a/collects/compiler/zo-parse.rkt b/collects/compiler/zo-parse.rkt index ca9776446d..4e2484cc7b 100644 --- a/collects/compiler/zo-parse.rkt +++ b/collects/compiler/zo-parse.rkt @@ -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) diff --git a/collects/compiler/zo-structs.rkt b/collects/compiler/zo-structs.rkt index 39da7d1fb2..b770a6a66d 100644 --- a/collects/compiler/zo-structs.rkt +++ b/collects/compiler/zo-structs.rkt @@ -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?]))