Moving unit system from mzscheme->scheme/base, reformatting and small changes
as necessary. Ran the quiet testsuite, unit tests, and setup-plt, all good. svn: r17582
This commit is contained in:
parent
d846d22b9e
commit
73d68593af
|
@ -1,21 +1,21 @@
|
|||
(module unit-compiletime mzscheme
|
||||
(require syntax/boundmap
|
||||
mzlib/list
|
||||
"unit-syntax.ss"
|
||||
(only scheme/base define-struct struct-out)
|
||||
(rename scheme/base provide* provide))
|
||||
(require-for-template mzscheme
|
||||
#lang scheme/base
|
||||
|
||||
(require scheme/list
|
||||
syntax/boundmap
|
||||
"unit-syntax.ss")
|
||||
(require (for-syntax scheme/base))
|
||||
(require (for-template scheme/base
|
||||
"unit-keywords.ss"
|
||||
"unit-runtime.ss")
|
||||
"unit-runtime.ss"))
|
||||
(require scheme/private/define-struct)
|
||||
|
||||
(provide* (struct-out var-info)
|
||||
(provide (struct-out var-info)
|
||||
(struct-out signature)
|
||||
(struct-out signature-form)
|
||||
(struct-out unit-info)
|
||||
(struct-out link-record))
|
||||
(struct-out link-record)
|
||||
|
||||
(provide (rename build-siginfo make-siginfo)
|
||||
(rename-out [build-siginfo make-siginfo])
|
||||
siginfo-names siginfo-ctime-ids siginfo-rtime-ids siginfo-subtype
|
||||
unprocess-link-record-bind unprocess-link-record-use
|
||||
set!-trans-extract
|
||||
|
@ -38,7 +38,7 @@
|
|||
(else
|
||||
(syntax-case (car l) ()
|
||||
((r . x)
|
||||
(ormap (lambda (req) (module-identifier=? #'r req))
|
||||
(ormap (lambda (req) (free-identifier=? #'r req))
|
||||
req-forms)
|
||||
(loop (cdr l) (cons (car l) requires)))
|
||||
(_
|
||||
|
@ -89,11 +89,11 @@
|
|||
(make-siginfo names
|
||||
ctime-ids
|
||||
rtime-ids
|
||||
(make-immutable-hash-table (map (λ (x) `(,x . #t)) ctime-ids))))
|
||||
(make-immutable-hasheq (map (λ (x) `(,x . #t)) ctime-ids))))
|
||||
|
||||
;; siginfo-subtype : siginfo siginfo -> bool
|
||||
(define (siginfo-subtype s1 s2)
|
||||
(hash-table-get (siginfo-super-table s1)
|
||||
(hash-ref (siginfo-super-table s1)
|
||||
(car (siginfo-ctime-ids s2))
|
||||
(λ () #f)))
|
||||
|
||||
|
@ -204,7 +204,7 @@
|
|||
;; ensures that pid is an identifier
|
||||
(define (do-prefix stx pid)
|
||||
(if (identifier? stx)
|
||||
(datum->syntax-object
|
||||
(datum->syntax
|
||||
stx
|
||||
(string->symbol (format "~a~a" (syntax-e pid) (syntax-e stx)))
|
||||
stx)
|
||||
|
@ -361,7 +361,7 @@
|
|||
(let* ((sig-res
|
||||
(do-rename (process-import/export #'sub-spec res bind? add-prefix)
|
||||
#'(internal ...)
|
||||
(datum->syntax-object #f (add-prefixes add-prefix #'(external ...)))))
|
||||
(datum->syntax #f (add-prefixes add-prefix #'(external ...)))))
|
||||
(dup (check-duplicate-identifier (sig-int-names sig-res))))
|
||||
(when dup
|
||||
(raise-stx-err
|
||||
|
@ -406,7 +406,7 @@
|
|||
(when (and (eq? (car tinfo1) (car tinfo2))
|
||||
(siginfo-subtype (cdr tinfo1) (cdr tinfo2)))
|
||||
(raise-stx-err (format "the signature of ~a extends this signature"
|
||||
(syntax-object->datum s1))
|
||||
(syntax->datum s1))
|
||||
s2))))
|
||||
tagged-siginfos
|
||||
sources))
|
||||
|
@ -421,8 +421,8 @@
|
|||
;; complete-exports : (listof link-record) (listof link-record) -> (listof link-record)
|
||||
;; The export-bindings should not contain two bindings that are related as subsignatures.
|
||||
(define (complete-exports unit-exports given-bindings)
|
||||
(define binding-table (make-hash-table 'equal))
|
||||
(define used-binding-table (make-hash-table 'equal))
|
||||
(define binding-table (make-hash))
|
||||
(define used-binding-table (make-hash))
|
||||
|
||||
(check-duplicate-subs
|
||||
(map (λ (ts) (cons (link-record-tag ts) (link-record-siginfo ts))) given-bindings)
|
||||
|
@ -430,7 +430,7 @@
|
|||
|
||||
(for-each
|
||||
(λ (b)
|
||||
(hash-table-put! binding-table
|
||||
(hash-set! binding-table
|
||||
(cons (link-record-tag b)
|
||||
(car (siginfo-ctime-ids (link-record-siginfo b))))
|
||||
(link-record-linkid b)))
|
||||
|
@ -443,12 +443,12 @@
|
|||
(ormap
|
||||
(λ (ctime-id)
|
||||
(define key (cons (link-record-tag export) ctime-id))
|
||||
(define used (hash-table-get used-binding-table key (λ () #f)))
|
||||
(define used (hash-ref used-binding-table key (λ () #f)))
|
||||
(when used
|
||||
(raise-stx-err "this export is supplied multiple times by the given unit" used))
|
||||
(let ([r (hash-table-get binding-table key (λ () #f))])
|
||||
(let ([r (hash-ref binding-table key (λ () #f))])
|
||||
(when r
|
||||
(hash-table-put! used-binding-table key r))
|
||||
(hash-set! used-binding-table key r))
|
||||
r))
|
||||
(siginfo-ctime-ids (link-record-siginfo export))))
|
||||
(make-link-record
|
||||
|
@ -460,27 +460,27 @@
|
|||
(link-record-siginfo export)))
|
||||
unit-exports)
|
||||
|
||||
(hash-table-for-each
|
||||
(hash-for-each
|
||||
binding-table
|
||||
(λ (k v)
|
||||
(unless (hash-table-get used-binding-table k (λ () #f))
|
||||
(unless (hash-ref used-binding-table k (λ () #f))
|
||||
(raise-stx-err "this export is not supplied by the given unit" v))))))
|
||||
|
||||
(define (name-form n) (syntax-object->datum n))
|
||||
(define (name-form n) (syntax->datum n))
|
||||
|
||||
;; complete-imports : (hash-tableof symbol (or identifier 'duplicate))
|
||||
;; (listof link-record)
|
||||
;; (listof (list symbol identifier siginfo)) ->
|
||||
;; (listof (cons symbol identifier))
|
||||
(define (complete-imports sig-table given-links unit-imports src)
|
||||
(define linked-sigs-table (make-hash-table 'equal))
|
||||
(define linked-sigs-table (make-hash))
|
||||
(for-each
|
||||
(λ (link)
|
||||
(define tag (link-record-tag link))
|
||||
(for-each
|
||||
(λ (cid)
|
||||
(define there? (hash-table-get linked-sigs-table (cons tag cid) (λ () #f)))
|
||||
(hash-table-put! linked-sigs-table (cons tag cid) (if there? 'duplicate #t)))
|
||||
(define there? (hash-ref linked-sigs-table (cons tag cid) (λ () #f)))
|
||||
(hash-set! linked-sigs-table (cons tag cid) (if there? 'duplicate #t)))
|
||||
(siginfo-ctime-ids (link-record-siginfo link))))
|
||||
given-links)
|
||||
|
||||
|
@ -494,7 +494,7 @@
|
|||
[ctime-ids (siginfo-ctime-ids (link-record-siginfo import))]
|
||||
[tag (link-record-tag import)]
|
||||
[there?
|
||||
(hash-table-get linked-sigs-table
|
||||
(hash-ref linked-sigs-table
|
||||
(cons tag (car ctime-ids))
|
||||
(λ () #f))])
|
||||
(cond
|
||||
|
@ -509,7 +509,7 @@
|
|||
[there?
|
||||
(loop (cdr unit-imports))]
|
||||
[else
|
||||
(let ([there?2 (hash-table-get sig-table
|
||||
(let ([there?2 (hash-ref sig-table
|
||||
(car ctime-ids)
|
||||
(λ () #f))])
|
||||
(cond
|
||||
|
@ -524,7 +524,7 @@
|
|||
[there?2
|
||||
(for-each
|
||||
(λ (cid)
|
||||
(hash-table-put! linked-sigs-table
|
||||
(hash-set! linked-sigs-table
|
||||
(cons tag cid)
|
||||
#t))
|
||||
ctime-ids)
|
||||
|
@ -568,7 +568,7 @@
|
|||
"cannot set! imported or exported variables"
|
||||
sstx)]
|
||||
[(_ . x)
|
||||
(datum->syntax-object
|
||||
(datum->syntax
|
||||
sstx
|
||||
(cons unbox-stx #'x)
|
||||
sstx)])))))
|
||||
sstx)]))))
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
(module unit-runtime mzscheme
|
||||
(require-for-syntax "unit-syntax.ss")
|
||||
#lang scheme/base
|
||||
|
||||
(require (for-syntax "unit-syntax.ss" scheme/base))
|
||||
(provide define-syntax/err-param
|
||||
undefined (rename make-a-unit make-unit) unit-import-sigs unit-export-sigs unit-go unit? unit-deps
|
||||
undefined (rename-out [make-a-unit make-unit]) unit-import-sigs unit-export-sigs unit-go unit? unit-deps
|
||||
check-unit check-no-imports check-sigs check-deps check-helper)
|
||||
|
||||
(define-syntax define-syntax/err-param
|
||||
|
@ -50,15 +51,15 @@
|
|||
;; symbol symbol ->
|
||||
;; ensure that the unit's signatures match the expected signatures.
|
||||
(define (check-helper sub-sig super-sig name import?)
|
||||
(define t (make-hash-table 'equal))
|
||||
(define t (make-hash))
|
||||
(let loop ([i (sub1 (vector-length sub-sig))])
|
||||
(when (>= i 0)
|
||||
(let ([v (cdr (vector-ref sub-sig i))])
|
||||
(let loop ([j (sub1 (vector-length v))])
|
||||
(when (>= j 0)
|
||||
(let ([vj (vector-ref v j)])
|
||||
(hash-table-put! t vj
|
||||
(if (hash-table-get t vj #f)
|
||||
(hash-set! t vj
|
||||
(if (hash-ref t vj #f)
|
||||
'amb
|
||||
#t)))
|
||||
(loop (sub1 j)))))
|
||||
|
@ -66,7 +67,7 @@
|
|||
(let loop ([i (sub1 (vector-length super-sig))])
|
||||
(when (>= i 0)
|
||||
(let* ([v0 (vector-ref (cdr (vector-ref super-sig i)) 0)]
|
||||
[r (hash-table-get t v0 #f)])
|
||||
[r (hash-ref t v0 #f)])
|
||||
(when (or (eq? r 'amb) (not r))
|
||||
(let ([tag (if (pair? v0) (car v0) #f)]
|
||||
[sub-name (car (vector-ref super-sig i))]
|
||||
|
@ -107,7 +108,7 @@
|
|||
(define (check-deps dep-table unit name)
|
||||
(for-each
|
||||
(λ (dep)
|
||||
(let ([r (hash-table-get dep-table dep #f)])
|
||||
(let ([r (hash-ref dep-table dep #f)])
|
||||
(when r
|
||||
(raise
|
||||
(make-exn:fail:contract
|
||||
|
@ -131,6 +132,4 @@
|
|||
;; ensures that unit has the given signatures
|
||||
(define (check-sigs unit expected-imports expected-exports name)
|
||||
(check-helper expected-imports (unit-import-sigs unit) name #t)
|
||||
(check-helper (unit-export-sigs unit) expected-exports name #f)))
|
||||
|
||||
|
||||
(check-helper (unit-export-sigs unit) expected-exports name #f))
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
(module unit-syntax mzscheme
|
||||
(require syntax/stx)
|
||||
(require-for-template "unit-keywords.ss")
|
||||
#lang scheme/base
|
||||
|
||||
(provide (all-defined))
|
||||
(require syntax/stx)
|
||||
(require (for-template "unit-keywords.ss"))
|
||||
|
||||
(provide (all-defined-out))
|
||||
|
||||
(define error-syntax (make-parameter #f))
|
||||
(define raise-stx-err
|
||||
|
@ -75,8 +76,8 @@
|
|||
(checked-syntax->list s)
|
||||
(syntax-case s (prefix rename)
|
||||
((key . x)
|
||||
(or (module-identifier=? #'key #'only)
|
||||
(module-identifier=? #'key #'except))
|
||||
(or (free-identifier=? #'key #'only)
|
||||
(free-identifier=? #'key #'except))
|
||||
(begin
|
||||
(unless import?
|
||||
(raise-stx-err
|
||||
|
@ -281,6 +282,3 @@
|
|||
(format "bad syntax (has ~a parts after keyword)"
|
||||
(sub1 (length (syntax->list d))))
|
||||
d))))
|
||||
)
|
||||
|
||||
;(load "test-unit-syntax.ss")
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
syntax/boundmap
|
||||
"unit-compiletime.ss"
|
||||
"unit-syntax.ss")
|
||||
mzlib/contract)
|
||||
scheme/contract/base)
|
||||
|
||||
(provide (for-syntax build-key
|
||||
check-duplicate-sigs
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
(module unitidmap mzscheme
|
||||
#lang scheme/base
|
||||
|
||||
;; Help Desk binding info:
|
||||
(define (binding binder bound stx)
|
||||
|
@ -12,14 +11,14 @@
|
|||
(cons binder (syntax-local-introduce bound))))
|
||||
|
||||
(define (make-id-mapper unbox-stx the-binder)
|
||||
(let ([set!-stx (datum->syntax-object unbox-stx 'set! #f)])
|
||||
(let ([set!-stx (datum->syntax unbox-stx 'set! #f)])
|
||||
(make-set!-transformer
|
||||
(lambda (sstx)
|
||||
(cond
|
||||
[(identifier? sstx)
|
||||
(binding the-binder sstx
|
||||
unbox-stx)]
|
||||
[(module-identifier=? set!-stx (car (syntax-e sstx)))
|
||||
[(free-identifier=? set!-stx (car (syntax-e sstx)))
|
||||
(raise-syntax-error
|
||||
'unit
|
||||
"cannot set! imported or exported variables"
|
||||
|
@ -27,10 +26,10 @@
|
|||
[else
|
||||
(binding
|
||||
the-binder (car (syntax-e sstx))
|
||||
(datum->syntax-object
|
||||
(datum->syntax
|
||||
sstx
|
||||
(cons unbox-stx (cdr (syntax-e sstx)))
|
||||
sstx))])))))
|
||||
|
||||
(provide make-id-mapper))
|
||||
(provide make-id-mapper)
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
(module unit-exptime mzscheme
|
||||
#lang scheme/base
|
||||
|
||||
(require "private/unit-syntax.ss"
|
||||
"private/unit-compiletime.ss")
|
||||
|
||||
|
@ -23,4 +24,4 @@
|
|||
;; defined vars
|
||||
(apply list (apply append (map car (signature-val-defs s))))
|
||||
;; defined stxs
|
||||
(apply list (apply append (map car (signature-stx-defs s)))))))))
|
||||
(apply list (apply append (map car (signature-stx-defs s))))))))
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
(module unit mzscheme
|
||||
(require-for-syntax mzlib/list
|
||||
#lang scheme/base
|
||||
|
||||
(require (for-syntax scheme/base
|
||||
scheme/list
|
||||
syntax/boundmap
|
||||
syntax/context
|
||||
syntax/kerncase
|
||||
|
@ -9,11 +11,11 @@
|
|||
syntax/stx
|
||||
"private/unit-contract-syntax.ss"
|
||||
"private/unit-compiletime.ss"
|
||||
"private/unit-syntax.ss")
|
||||
"private/unit-syntax.ss"))
|
||||
|
||||
(require mzlib/etc
|
||||
mzlib/contract
|
||||
mzlib/stxparam
|
||||
scheme/contract/base
|
||||
scheme/stxparam
|
||||
"private/unit-contract.ss"
|
||||
"private/unit-keywords.ss"
|
||||
"private/unit-runtime.ss"
|
||||
|
@ -23,7 +25,7 @@
|
|||
define-signature provide-signature-elements
|
||||
only except rename import export prefix link tag init-depend extends contracted
|
||||
unit?
|
||||
(rename :unit unit) define-unit
|
||||
(rename-out [:unit unit]) define-unit
|
||||
compound-unit define-compound-unit compound-unit/infer define-compound-unit/infer
|
||||
invoke-unit define-values/invoke-unit
|
||||
invoke-unit/infer define-values/invoke-unit/infer
|
||||
|
@ -90,16 +92,16 @@
|
|||
(lambda (omission)
|
||||
(cond
|
||||
((and (identifier? omission)
|
||||
(module-identifier=? omission #'-selectors))
|
||||
(free-identifier=? omission #'-selectors))
|
||||
(set! omit-selectors #t))
|
||||
((and (identifier? omission)
|
||||
(module-identifier=? omission #'-setters))
|
||||
(free-identifier=? omission #'-setters))
|
||||
(set! omit-setters #t))
|
||||
((and (identifier? omission)
|
||||
(module-identifier=? omission #'-constructor))
|
||||
(free-identifier=? omission #'-constructor))
|
||||
(set! omit-constructor #t))
|
||||
((and (identifier? omission)
|
||||
(module-identifier=? omission #'-type))
|
||||
(free-identifier=? omission #'-type))
|
||||
(set! omit-type #t))
|
||||
(else
|
||||
(raise-stx-err
|
||||
|
@ -170,16 +172,16 @@
|
|||
(lambda (omission)
|
||||
(cond
|
||||
((and (identifier? omission)
|
||||
(module-identifier=? omission #'-selectors))
|
||||
(free-identifier=? omission #'-selectors))
|
||||
(set! omit-selectors #t))
|
||||
((and (identifier? omission)
|
||||
(module-identifier=? omission #'-setters))
|
||||
(free-identifier=? omission #'-setters))
|
||||
(set! omit-setters #t))
|
||||
((and (identifier? omission)
|
||||
(module-identifier=? omission #'-constructor))
|
||||
(free-identifier=? omission #'-constructor))
|
||||
(set! omit-constructor #t))
|
||||
((and (identifier? omission)
|
||||
(module-identifier=? omission #'-type))
|
||||
(free-identifier=? omission #'-type))
|
||||
(set! omit-type #t))
|
||||
(else
|
||||
(raise-stx-err
|
||||
|
@ -350,7 +352,7 @@
|
|||
(loop (cdr sig-exprs) (cons #'x bindings) val-defs stx-defs (cons #f ctcs)))
|
||||
((x (y z) ...)
|
||||
(and (identifier? #'x)
|
||||
(module-identifier=? #'x #'contracted)
|
||||
(free-identifier=? #'x #'contracted)
|
||||
(andmap identifier? (syntax->list #'(y ...))))
|
||||
(loop (cdr sig-exprs)
|
||||
(append (syntax->list #'(y ...)) bindings)
|
||||
|
@ -359,15 +361,15 @@
|
|||
(append (syntax->list #'(z ...)) ctcs)))
|
||||
((x . z)
|
||||
(and (identifier? #'x)
|
||||
(module-identifier=? #'x #'contracted))
|
||||
(free-identifier=? #'x #'contracted))
|
||||
(raise-syntax-error
|
||||
'define-signature
|
||||
"expected a list of [id contract] pairs after the contracted keyword"
|
||||
(car sig-exprs)))
|
||||
((x . y)
|
||||
(and (identifier? #'x)
|
||||
(or (module-identifier=? #'x #'define-values)
|
||||
(module-identifier=? #'x #'define-syntaxes)))
|
||||
(or (free-identifier=? #'x #'define-values)
|
||||
(free-identifier=? #'x #'define-syntaxes)))
|
||||
(begin
|
||||
(check-def-syntax (car sig-exprs))
|
||||
(syntax-case #'y ()
|
||||
|
@ -378,11 +380,11 @@
|
|||
(let ((b #'body))
|
||||
(loop (cdr sig-exprs)
|
||||
bindings
|
||||
(if (module-identifier=? #'x #'define-values)
|
||||
(if (free-identifier=? #'x #'define-values)
|
||||
(cons (cons (syntax->list #'(name ...)) b)
|
||||
val-defs)
|
||||
val-defs)
|
||||
(if (module-identifier=? #'x #'define-syntaxes)
|
||||
(if (free-identifier=? #'x #'define-syntaxes)
|
||||
(cons (cons (syntax->list #'(name ...)) b)
|
||||
stx-defs)
|
||||
stx-defs)
|
||||
|
@ -448,7 +450,7 @@
|
|||
(filter (lambda (name)
|
||||
(bound-identifier=?
|
||||
name
|
||||
(datum->syntax-object sig (syntax-e name))))
|
||||
(datum->syntax sig (syntax-e name))))
|
||||
names))
|
||||
sigs nameses))
|
||||
(names (apply append nameses))
|
||||
|
@ -482,7 +484,7 @@
|
|||
(current-contract-region)
|
||||
#,(id->contract-src-info var))
|
||||
(error 'unit "contracted import ~a used before definition"
|
||||
(quote #,(syntax-object->datum var))))))))
|
||||
(quote #,(syntax->datum var))))))))
|
||||
(quasisyntax/loc (error-syntax)
|
||||
(quote-syntax (#,loc)))))
|
||||
|
||||
|
@ -568,7 +570,7 @@
|
|||
(values
|
||||
(lambda (import-table)
|
||||
(let-values ([(iloc ...)
|
||||
(vector->values (hash-table-get import-table import-key) 0 icount)]
|
||||
(vector->values (hash-ref import-table import-key) 0 icount)]
|
||||
...)
|
||||
(letrec-syntaxes (#,@(map (lambda (ivs e-ivs ils ics)
|
||||
(with-syntax ([renamings
|
||||
|
@ -624,8 +626,8 @@
|
|||
[definition?
|
||||
(lambda (id)
|
||||
(and (identifier? id)
|
||||
(or (module-identifier=? id (quote-syntax define-values))
|
||||
(module-identifier=? id (quote-syntax define-syntaxes)))))]
|
||||
(or (free-identifier=? id (quote-syntax define-values))
|
||||
(free-identifier=? id (quote-syntax define-syntaxes)))))]
|
||||
[expanded-body
|
||||
(let expand-all ((defns&exprs (syntax->list #'(body ...))))
|
||||
;; Also lifted from Matthew, to expand the body enough
|
||||
|
@ -680,7 +682,7 @@
|
|||
(raise-stx-err "variable defined twice" id))
|
||||
(bound-identifier-mapping-put!
|
||||
table id
|
||||
(make-var-info (module-identifier=? #'dv (quote-syntax define-syntaxes))
|
||||
(make-var-info (free-identifier=? #'dv (quote-syntax define-syntaxes))
|
||||
#f
|
||||
id
|
||||
#f)))
|
||||
|
@ -775,7 +777,7 @@
|
|||
(for-each
|
||||
(lambda (tagged-info sig)
|
||||
(define v
|
||||
#`(hash-table-get #,table-stx #,(car (tagged-info->keys tagged-info))))
|
||||
#`(hash-ref #,table-stx #,(car (tagged-info->keys tagged-info))))
|
||||
(for-each
|
||||
(lambda (int/ext-name index ctc)
|
||||
(bound-identifier-mapping-put! def-table
|
||||
|
@ -1021,7 +1023,7 @@
|
|||
bt
|
||||
lnkid
|
||||
(make-lnkid-record
|
||||
#`(hash-table-get
|
||||
#`(hash-ref
|
||||
#,tableid
|
||||
#,(build-key (syntax-e tag) (car rtime-ids)))
|
||||
(siginfo-names siginfo)
|
||||
|
@ -1047,7 +1049,7 @@
|
|||
[link-deps
|
||||
(map
|
||||
(lambda (tags lnkids i)
|
||||
(define ht (make-hash-table 'equal))
|
||||
(define ht (make-hash))
|
||||
(for-each
|
||||
(lambda (t l)
|
||||
(define et (syntax-e t))
|
||||
|
@ -1057,7 +1059,7 @@
|
|||
(define import-dep (= 0 (lnkid-record-source-idx rec)))
|
||||
(for-each
|
||||
(lambda (ctime-id rtime-id name)
|
||||
(hash-table-put! ht
|
||||
(hash-set! ht
|
||||
(build-key et ctime-id)
|
||||
(list forward-dep import-dep et rtime-id name el)))
|
||||
(lnkid-record-ctime-ids rec)
|
||||
|
@ -1065,7 +1067,7 @@
|
|||
(lnkid-record-names rec)))
|
||||
(syntax->list tags)
|
||||
(syntax->list lnkids))
|
||||
(hash-table-map ht (lambda (x y) y)))
|
||||
(hash-map ht (lambda (x y) y)))
|
||||
(syntax->list #'((sub-in-tag ...) ...))
|
||||
(syntax->list #'((sub-in-lnkid ...) ...))
|
||||
(cdr idxs))])
|
||||
|
@ -1182,7 +1184,7 @@
|
|||
#,(syntax/loc #'sub-exp (check-deps fht sub-tmp 'form))
|
||||
(for-each
|
||||
(lambda (dep)
|
||||
(when (hash-table-get rht dep #f)
|
||||
(when (hash-ref rht dep #f)
|
||||
(set! deps (cons dep deps))))
|
||||
(unit-deps sub-tmp)))))))
|
||||
(syntax->list #'((sub-exp
|
||||
|
@ -1323,7 +1325,7 @@
|
|||
'define-values/invoke-unit)
|
||||
(let-values (((unit-fn export-table)
|
||||
((unit-go unit-tmp))))
|
||||
(let ([out-vec (hash-table-get export-table key1)] ...)
|
||||
(let ([out-vec (hash-ref export-table key1)] ...)
|
||||
(unit-fn #f)
|
||||
(values out-code ... ...))))))
|
||||
(define-values (int-binding ... ...)
|
||||
|
@ -1623,7 +1625,7 @@
|
|||
[link-defs (append import-sigs (apply append sub-outs))])
|
||||
|
||||
(define lnk-table (make-bound-identifier-mapping))
|
||||
(define sig-table (make-hash-table))
|
||||
(define sig-table (make-hasheq))
|
||||
|
||||
(let ([dup (check-duplicate-identifier (map link-record-linkid link-defs))])
|
||||
(when dup
|
||||
|
@ -1638,8 +1640,8 @@
|
|||
(lambda (b)
|
||||
(for-each
|
||||
(lambda (cid)
|
||||
(define there? (hash-table-get sig-table cid #f))
|
||||
(hash-table-put! sig-table cid (if there? 'duplicate (link-record-linkid b))))
|
||||
(define there? (hash-ref sig-table cid #f))
|
||||
(hash-set! sig-table cid (if there? 'duplicate (link-record-linkid b))))
|
||||
(siginfo-ctime-ids (link-record-siginfo b))))
|
||||
link-defs)
|
||||
|
||||
|
@ -1687,7 +1689,7 @@
|
|||
(cond
|
||||
[lookup (unprocess-tagged-id tid)]
|
||||
[else
|
||||
(let ([lnkid (hash-table-get
|
||||
(let ([lnkid (hash-ref
|
||||
sig-table
|
||||
(car (siginfo-ctime-ids (signature-siginfo (lookup-signature (cdr tid)))))
|
||||
#f)])
|
||||
|
@ -1792,11 +1794,11 @@
|
|||
(loop (cdr units) (append i imps) (append e exps))))))
|
||||
(define-values (isig tagged-import-sigs import-tagged-infos
|
||||
import-tagged-sigids import-sigs)
|
||||
(process-unit-import (datum->syntax-object #f isigs)))
|
||||
(process-unit-import (datum->syntax #f isigs)))
|
||||
|
||||
(define-values (esig tagged-export-sigs export-tagged-infos
|
||||
export-tagged-sigids export-sigs)
|
||||
(process-unit-export (datum->syntax-object #f esigs)))
|
||||
(process-unit-export (datum->syntax #f esigs)))
|
||||
(check-duplicate-subs export-tagged-infos esig)
|
||||
(let-values ([(itagged isources) (drop-duplicates import-tagged-infos isig)])
|
||||
(values (drop-from-other-list export-tagged-infos itagged isources)
|
||||
|
@ -1804,7 +1806,7 @@
|
|||
[(list? exports)
|
||||
(let-values ([(spec-esig spec-tagged-export-sigs spec-export-tagged-infos
|
||||
spec-export-tagged-sigids spec-export-sigs)
|
||||
(process-unit-export (datum->syntax-object #f exports))])
|
||||
(process-unit-export (datum->syntax #f exports))])
|
||||
(restrict-exports export-tagged-infos
|
||||
spec-esig spec-export-tagged-infos))]
|
||||
[else esig]))))
|
||||
|
@ -1816,7 +1818,7 @@
|
|||
(siginfo-subtype (cdr ute) (cdr ste))))
|
||||
unit-tagged-exports)
|
||||
(raise-stx-err (format "no subunit exports signature ~a"
|
||||
(syntax-object->datum se))
|
||||
(syntax->datum se))
|
||||
se)))
|
||||
spec-exports
|
||||
spec-tagged-exports)
|
||||
|
@ -1932,6 +1934,3 @@
|
|||
[(_ . stx)
|
||||
(let-values ([(u x y z) (build-unit/s (check-unit-syntax #'stx))])
|
||||
u)]))
|
||||
|
||||
)
|
||||
;(load "test-unit.ss")
|
||||
|
|
Loading…
Reference in New Issue
Block a user