This repository was archived by the owner on Sep 13, 2019. It is now read-only.
File tree 5 files changed +22
-4
lines changed
racket/src/expander/expand 5 files changed +22
-4
lines changed Original file line number Diff line number Diff line change 64
64
requires+provides ; enclosing module's requires+provides during `provide`
65
65
* name ; #f or identifier to name the expression
66
66
observer ; logging observer (for the macro debugger)
67
- for-serializable?)) ; accumulate submodules as serializable?
67
+ for-serializable? ; accumulate submodules as serializable?
68
+ should-not-encounter-macros?)) ; #t when "expanding" to parse
68
69
69
70
(define (make-expand-context ns
70
71
#:to-parsed? [to-parsed? #f ]
107
108
#f ; requires+provides
108
109
#f ; name
109
110
(and observable? (current-expand-observe))
110
- for-serializable?))
111
+ for-serializable?
112
+ #f ))
111
113
112
114
(define (copy-root-expand-context ctx root-ctx)
113
115
(struct*-copy expand-context ctx
192
194
(define (as-to-parsed-context ctx)
193
195
(struct*-copy expand-context ctx
194
196
[to-parsed? #t ]
195
- [observer #f ]))
197
+ [observer #f ]
198
+ [should-not-encounter-macros? #t ]))
Original file line number Diff line number Diff line change 6
6
"../syntax/scope.rkt "
7
7
"../syntax/binding.rkt "
8
8
"../namespace/core.rkt "
9
+ "../namespace/module.rkt "
9
10
"context.rkt "
10
11
"main.rkt "
11
12
"syntax-local.rkt "
107
108
#:to-parsed-ok? to-parsed-ok?
108
109
#:track-to-be-defined? track-to-be-defined?))
109
110
111
+ (namespace-visit-available-modules! (expand-context-namespace ctx) phase)
112
+
110
113
(log-expand local-ctx 'enter-local s)
111
114
(define input-s (add-intdef-scopes (flip-introduction-scopes s ctx) intdefs))
112
115
Original file line number Diff line number Diff line change 270
270
(define adj-s (avoid-current-expand-context (substitute-alternate-id s id) t ctx))
271
271
(log-expand ctx 'exit-macro s)
272
272
(expand adj-s ctx)]
273
+ [(expand-context-should-not-encounter-macros? ctx)
274
+ (raise-syntax-error #f
275
+ "encountered a macro binding in form that should be fully expanded "
276
+ s)]
273
277
[else
274
278
(log-expand* ctx #:when (and (expand-context-only-immediate? ctx)
275
279
(not (rename-transformer? t)))
Original file line number Diff line number Diff line change 791
791
(define-values (exp-rhs parsed-rhs vals)
792
792
(expand+eval-for-syntaxes-binding (m 'rhs ) ids
793
793
(struct*-copy expand-context partial-body-ctx
794
+ [lifts #f ]
795
+ ;; require lifts ok, others disallowed
796
+ [module-lifts #f ]
797
+ [to-module-lifts #f ]
794
798
[need-eventually-defined need-eventually-defined])
795
799
#:log-next? #f ))
796
800
;; Install transformers in the namespace for expansion:
1290
1294
#:modules-being-compiled modules-being-compiled)
1291
1295
(unless is-star?
1292
1296
(log-expand* ctx ['enter-prim s] [(if is-star? 'prim-submodule* 'prim-submodule )]))
1293
-
1297
+
1294
1298
;; Register name and check for duplicates
1295
1299
(define-match m s '(module name . _ ))
1296
1300
(define name (syntax-e (m 'name )))
Original file line number Diff line number Diff line change 212
212
(check who exact-nonnegative-integer? n)
213
213
(define ctx (get-current-expand-context who))
214
214
(define lifts (expand-context-lifts ctx))
215
+ (unless lifts (raise-arguments-error who "no lift target " ))
215
216
(define counter (root-expand-context-counter ctx))
216
217
(define ids (for/list ([i (in-range n)])
217
218
(set-box! counter (add1 (unbox counter)))
264
265
(more-checks)
265
266
(define ctx (get-current-expand-context who))
266
267
(define lift-ctx (get-lift-ctx ctx))
268
+ (unless lift-ctx (raise-arguments-error who "no lift target " ))
267
269
(define phase (expand-context-phase ctx)) ; we're currently at this phase
268
270
(define wrt-phase (get-wrt-phase lift-ctx)) ; lift context is at this phase
269
271
(define added-s (if intro? (flip-introduction-scopes s ctx) s))
294
296
#:post-wrap
295
297
(lambda (s phase require-lift-ctx)
296
298
(wrap-form '#%require (add-scope s sc) phase))))
299
+ (namespace-visit-available-modules! (expand-context-namespace ctx)
300
+ (expand-context-phase ctx))
297
301
(define result-s (add-scope use-s sc))
298
302
(log-expand ctx 'lift-require added-s use-s result-s)
299
303
result-s)
You can’t perform that action at this time.
0 commit comments