Validate play vars
This commit is contained in:
parent
7f73a9b7de
commit
3153469a2c
1 changed files with 8 additions and 0 deletions
|
@ -31,6 +31,10 @@
|
||||||
(unless (every (lambda (h) (and (pair? h) (handler? (cdr h)))) handlers)
|
(unless (every (lambda (h) (and (pair? h) (handler? (cdr h)))) handlers)
|
||||||
(error (format #f "invalid handlers: ~a" handlers))))
|
(error (format #f "invalid handlers: ~a" handlers))))
|
||||||
|
|
||||||
|
(define (validate-vars vars)
|
||||||
|
(unless (every pair? vars)
|
||||||
|
(error (format #f "invalid vars: ~a" vars))))
|
||||||
|
|
||||||
(define (validate-triggers tasks handlers)
|
(define (validate-triggers tasks handlers)
|
||||||
(for-each (lambda (task)
|
(for-each (lambda (task)
|
||||||
(for-each (lambda (trigger)
|
(for-each (lambda (trigger)
|
||||||
|
@ -46,6 +50,10 @@
|
||||||
(validate-tasks tasks)
|
(validate-tasks tasks)
|
||||||
(validate-handlers handlers)
|
(validate-handlers handlers)
|
||||||
(validate-triggers tasks handlers)
|
(validate-triggers tasks handlers)
|
||||||
|
(validate-vars vars)
|
||||||
|
;; Reconstruct the vars here because, when a quoted list is passed in the
|
||||||
|
;; play, it can result in an error (expected mutable pair) from assoc-set!
|
||||||
|
;; from register-context-var!.
|
||||||
(make-play description connection (fold (match-lambda* (((k . v) accum) (alist-cons k v accum))) '() vars) tasks handlers))
|
(make-play description connection (fold (match-lambda* (((k . v) accum) (alist-cons k v accum))) '() vars) tasks handlers))
|
||||||
|
|
||||||
(define (run-play play)
|
(define (run-play play)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue