Enforce rule: fields legal only at actor toplevel or in facet setup code
This commit is contained in:
parent
175c619edc
commit
9bf2991da8
|
@ -207,8 +207,13 @@
|
||||||
(define-syntax (field stx)
|
(define-syntax (field stx)
|
||||||
(syntax-parse stx
|
(syntax-parse stx
|
||||||
[(_ [id:id init] ...)
|
[(_ [id:id init] ...)
|
||||||
(syntax/loc stx
|
(quasisyntax/loc stx
|
||||||
(begin (define id (make-field 'id init))
|
(begin
|
||||||
|
(when (and (in-script?) (current-facet-id))
|
||||||
|
(error 'field
|
||||||
|
"~a: Cannot declare fields in script; are you missing a (react ...)?"
|
||||||
|
#,(source-location->string stx)))
|
||||||
|
(define id (make-field 'id init))
|
||||||
...))]))
|
...))]))
|
||||||
|
|
||||||
(define-syntax (assert stx)
|
(define-syntax (assert stx)
|
||||||
|
|
Loading…
Reference in New Issue