|
57 | 57 | (map vertex-data component))) |
58 | 58 |
|
59 | 59 |
|
60 | | -;; register-all-type-aliases : Listof<Syntax> IDTable<ID, Listof<ID>> -> Void |
| 60 | +;; register-all-type-aliases : Listof<Syntax> -> Void |
61 | 61 | ;; |
62 | 62 | ;; register all type alias definitions carried by the input syntaxes |
63 | | -;; dependency-map accounts for the dependencies of struct declarations |
64 | | -(define (register-all-type-aliases type-aliases [dependency-map (make-immutable-free-id-table)]) |
| 63 | +(define (register-all-type-aliases type-aliases) |
65 | 64 | (parameterize ([incomplete-name-alias-map (make-free-id-table)]) |
66 | 65 | (define-values (type-alias-names type-alias-map) |
67 | 66 | (for/lists (_1 _2 #:result (values _1 (make-free-id-table |
|
75 | 74 | (values id (list id type-stx args)))) |
76 | 75 |
|
77 | 76 | (begin0 |
78 | | - (register-all-type-alias-info type-alias-names type-alias-map dependency-map) |
| 77 | + (register-all-type-alias-info type-alias-names type-alias-map) |
79 | 78 | (unless (zero? (free-id-table-count (incomplete-name-alias-map))) |
80 | 79 | (define names (free-id-table-keys (incomplete-name-alias-map))) |
81 | 80 | (int-err "not all type alias names are fully registered: ~n ~a" |
|
92 | 91 | ;; of actually registering the type aliases. If struct names or |
93 | 92 | ;; other definitions need to be registered, do that before calling |
94 | 93 | ;; this function. |
95 | | -(define (register-all-type-alias-info type-alias-names type-alias-map dependency-map) |
| 94 | +(define (register-all-type-alias-info type-alias-names type-alias-map) |
96 | 95 | ;; Find type alias dependencies |
97 | 96 | ;; The two maps defined here contains the dependency structure |
98 | 97 | ;; of type aliases in two senses: |
|
103 | 102 | ;; The second is necessary in order to prevent recursive |
104 | 103 | ;; #:implements clauses and to determine the order in which |
105 | 104 | ;; recursive type aliases should be initialized. |
106 | | - |
107 | | - (define (free-id-table-union! a b) |
108 | | - (define struct-names (list->set (free-id-table-keys b))) |
109 | | - (for ([(id deps) (in-free-id-table b)]) |
110 | | - (free-id-table-set! a id (filter (lambda (v) |
111 | | - (or (free-id-table-ref type-alias-map v #f) |
112 | | - (set-member? struct-names v))) |
113 | | - deps)))) |
114 | | - |
115 | 105 | (define-values (type-alias-dependency-map type-alias-class-map type-alias-productivity-map) |
116 | | - (for/lists (_1 _2 _3 #:result (values (let ([tbl1 (make-free-id-table _1)]) |
117 | | - (free-id-table-union! tbl1 dependency-map) |
118 | | - tbl1) |
| 106 | + (for/lists (_1 _2 _3 #:result (values (make-free-id-table _1) |
119 | 107 | (make-free-id-table _2) |
120 | 108 | (make-free-id-table _3))) |
121 | 109 | ([(name alias-info) (in-free-id-table type-alias-map)]) |
|
179 | 167 | recursive-aliases |
180 | 168 | free-identifier=?)) |
181 | 169 | (car component))) |
182 | | - |
183 | 170 | (define other-recursive-aliases |
184 | 171 | (for/list ([alias (in-list recursive-aliases)] |
185 | 172 | #:unless (member alias |
|
217 | 204 | ;; reverse order of that to avoid unbound type aliases. |
218 | 205 | (define acyclic-constr-names |
219 | 206 | (for/fold ([acc '()]) |
220 | | - ([id (in-list acyclic-singletons)] |
221 | | - #:when (free-id-table-ref type-alias-map id #f)) |
222 | | - (match-define (list _ type-stx args) (free-id-table-ref type-alias-map id #f)) |
| 207 | + ([id (in-list acyclic-singletons)]) |
| 208 | + (match-define (list _ type-stx args) (free-id-table-ref type-alias-map id)) |
223 | 209 | (define acc^ |
224 | 210 | (cond |
225 | 211 | [(not (null? args)) |
|
265 | 251 | #:result |
266 | 252 | (values (reverse type-records) |
267 | 253 | (reverse type-op-records))) |
268 | | - ([id (in-list (append other-recursive-aliases class-aliases))] |
269 | | - #:when (free-id-table-ref type-alias-map id #f)) |
| 254 | + ([id (in-list (append other-recursive-aliases class-aliases))]) |
270 | 255 | (define record (free-id-table-ref type-alias-map id)) |
271 | 256 | (match-define (list _ type-stx args) record) |
272 | 257 | (if (null? args) |
|
307 | 292 | (define res (in-same-component? id x)) |
308 | 293 | res) |
309 | 294 | type-alias-productivity-map |
310 | | - #:delay-variances? #t |
311 | | - #:recursive? #t)) |
| 295 | + #:delay-variances? #t)) |
312 | 296 | (register-type-constructor! id ty-op) |
313 | 297 | (complete-type-alias-registration! id) |
314 | 298 | (reset-resolver-cache!) |
|
0 commit comments