fix varref' in compiler/zo-structs', etc.

and sync docs better with implementation

original commit: a4da2a3f4c
This commit is contained in:
Matthew Flatt 2011-05-09 09:42:43 -06:00
parent 13e715ef44
commit ee407d6610
6 changed files with 13 additions and 12 deletions

View File

@ -195,7 +195,7 @@
(match expr (match expr
[(struct toplevel (depth pos const? ready?)) [(struct toplevel (depth pos const? ready?))
(decompile-tl expr globs stack closed #f)] (decompile-tl expr globs stack closed #f)]
[(struct varref (tl)) [(struct varref (tl dummy))
`(#%variable-reference ,(decompile-tl tl globs stack closed #t))] `(#%variable-reference ,(decompile-tl tl globs stack closed #t))]
[(struct topsyntax (depth pos midpt)) [(struct topsyntax (depth pos midpt))
(list-ref/protect (glob-desc-vars globs) (+ midpt pos) 'topsyntax)] (list-ref/protect (glob-desc-vars globs) (+ midpt pos) 'topsyntax)]

View File

@ -120,8 +120,9 @@
[(struct beg0 (seq)) [(struct beg0 (seq))
(for-each (lambda (f) (build-graph! lhs f)) (for-each (lambda (f) (build-graph! lhs f))
seq)] seq)]
[(struct varref (tl)) [(struct varref (tl dummy))
(build-graph! lhs tl)] (build-graph! lhs tl)
(build-graph! lhs dummy)]
[(and f (struct assign (id rhs undef-ok?))) [(and f (struct assign (id rhs undef-ok?)))
(build-graph! lhs id) (build-graph! lhs id)
(build-graph! lhs rhs)] (build-graph! lhs rhs)]
@ -252,8 +253,8 @@
(update body))] (update body))]
[(struct beg0 (seq)) [(struct beg0 (seq))
(make-beg0 (map update seq))] (make-beg0 (map update seq))]
[(struct varref (tl)) [(struct varref (tl dummy))
(make-varref (update tl))] (make-varref (update tl) (update dummy))]
[(and f (struct assign (id rhs undef-ok?))) [(and f (struct assign (id rhs undef-ok?)))
(struct-copy assign f (struct-copy assign f
[id (update id)] [id (update id)]

View File

@ -68,8 +68,8 @@
(update body))] (update body))]
[(struct beg0 (seq)) [(struct beg0 (seq))
(make-beg0 (map update seq))] (make-beg0 (map update seq))]
[(struct varref (tl)) [(struct varref (tl dummy))
(make-varref (update tl))] (make-varref (update tl) (update dummy))]
[(and f (struct assign (id rhs undef-ok?))) [(and f (struct assign (id rhs undef-ok?)))
(struct-copy assign f (struct-copy assign f
[id (update id)] [id (update id)]

View File

@ -671,9 +671,9 @@
(protect-quote val) (protect-quote val)
(protect-quote body)) (protect-quote body))
out)] out)]
[(struct varref (expr)) [(struct varref (expr dummy))
(out-marshaled varref-form-type-num (out-marshaled varref-form-type-num
expr (cons expr dummy)
out)] out)]
[(protected-symref v) [(protected-symref v)
(out-anything ((out-shared-index out) v #:error? #t) out)] (out-anything ((out-shared-index out) v #:error? #t) out)]

View File

@ -207,7 +207,7 @@
(define (read-require v) (define (read-require v)
(make-req (cdr v) (car v))) (make-req (cdr v) (car v)))
(define (read-#%variable-ref v) (define (read-#%variable-ref v)
(make-varref v)) (make-varref (car v) (cdr v)))
(define (read-apply-values v) (define (read-apply-values v)
(make-apply-values (car v) (cdr v))) (make-apply-values (car v) (cdr v)))
(define (read-splice v) (define (read-splice v)

View File

@ -29,7 +29,7 @@
[struct id ([field-id field-contract] ...)]))) [struct id ([field-id field-contract] ...)])))
(define-struct zo () #:prefab) (define-struct zo () #:prefab)
(provide zo?) (provide (struct-out zo))
(define-syntax define-form-struct (define-syntax define-form-struct
(syntax-rules () (syntax-rules ()
@ -167,7 +167,7 @@
[body (or/c expr? seq? any/c)])) ; `with-continuation-mark' [body (or/c expr? seq? any/c)])) ; `with-continuation-mark'
(define-form-struct (beg0 expr) ([seq (listof (or/c expr? seq? any/c))])) ; `begin0' (define-form-struct (beg0 expr) ([seq (listof (or/c expr? seq? any/c))])) ; `begin0'
(define-form-struct (splice form) ([forms (listof (or/c form? any/c))])) ; top-level `begin' (define-form-struct (splice form) ([forms (listof (or/c form? any/c))])) ; top-level `begin'
(define-form-struct (varref expr) ([toplevel toplevel?])) ; `#%variable-reference' (define-form-struct (varref expr) ([toplevel toplevel?] [dummy toplevel?])) ; `#%variable-reference'
(define-form-struct (assign expr) ([id toplevel?] [rhs (or/c expr? seq? any/c)] [undef-ok? boolean?])) ; top-level or module-level set! (define-form-struct (assign expr) ([id toplevel?] [rhs (or/c expr? seq? any/c)] [undef-ok? boolean?])) ; top-level or module-level set!
(define-form-struct (apply-values expr) ([proc (or/c expr? seq? any/c)] [args-expr (or/c expr? seq? any/c)])) ; `(call-with-values (lambda () ,args-expr) ,proc) (define-form-struct (apply-values expr) ([proc (or/c expr? seq? any/c)] [args-expr (or/c expr? seq? any/c)])) ; `(call-with-values (lambda () ,args-expr) ,proc)
(define-form-struct (primval expr) ([id exact-nonnegative-integer?])) ; direct preference to a kernel primitive (define-form-struct (primval expr) ([id exact-nonnegative-integer?])) ; direct preference to a kernel primitive