Enforce rule: fields legal only at actor toplevel or in facet setup code

This commit is contained in:
Tony Garnock-Jones 2016-07-10 16:47:37 -04:00
parent 175c619edc
commit 9bf2991da8
1 changed files with 8 additions and 3 deletions

View File

@ -207,9 +207,14 @@
(define-syntax (field stx)
(syntax-parse stx
[(_ [id:id init] ...)
(syntax/loc stx
(begin (define id (make-field 'id init))
...))]))
(quasisyntax/loc stx
(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)
(syntax-parse stx