Cleanup names-of-struct

(cherry picked from commit 154ab046fe)
This commit is contained in:
Eric Dobson 2013-01-20 16:04:24 -08:00 committed by Ryan Culpepper
parent d9b680dbf5
commit aa025b9c56
2 changed files with 4 additions and 10 deletions

View File

@ -26,7 +26,7 @@
(require (for-template racket/base
"internal-forms.rkt"))
(provide tc/struct names-of-struct d-s
(provide tc/struct name-of-struct d-s
refine-struct-variance!
register-parsed-struct-sty!
register-parsed-struct-bindings!)
@ -59,9 +59,7 @@
(define (struct-desc-parent-count fields)
(length (struct-desc-parent-fields fields)))
;; TODO make this not return a list
(define (names-of-struct stx)
(define (name-of-struct stx)
(syntax-parse stx
#:literal-sets (kernel-literals)
#:literals (define-typed-struct-internal values)
@ -73,7 +71,7 @@
(define-typed-struct/exec-internal
nm/par:parent . rest)))
(#%plain-app values)))
(list #'nm/par.name)]))
#'nm/par.name]))
;; parse name field of struct, determining whether a parent struct was specified

View File

@ -278,10 +278,6 @@
[(define-syntaxes (nm ...) . rest) (syntax->list #'(nm ...))]
[_ #f]))
(define (add-type-name! names)
(for-each register-type-name names))
(define (parse-type-alias form)
(kernel-syntax-case* form #f
(define-type-alias-internal values)
@ -309,7 +305,7 @@
(for-each (compose register-type-alias parse-type-alias) type-aliases)
;; Add the struct names to the type table, but not with a type
;(printf "before adding type names~n")
(for-each (compose add-type-name! names-of-struct) struct-defs)
(for-each (compose register-type-name name-of-struct) struct-defs)
(for-each add-constant-variance! struct-defs)
;(printf "after adding type names~n")
;; resolve all the type aliases, and error if there are cycles