From 3c3d8f2aaf546047f9f6b8ed718985dbc403f8ef Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Tue, 15 Mar 2016 16:08:57 -0400 Subject: [PATCH] Slightly more error-checking in (message) forms for #:meta-level --- prospect/actor.rkt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/prospect/actor.rkt b/prospect/actor.rkt index 1ab5a1a..e816326 100644 --- a/prospect/actor.rkt +++ b/prospect/actor.rkt @@ -529,10 +529,14 @@ #,(make-run-script-call outer-expr-stx #'s I-stxs)]))))] [_ #f])))))) - (define (prepend-at-meta-stx stx level) - (if (zero? level) - stx - #`(at-meta #,(prepend-at-meta-stx stx (- level 1))))) + (define (prepend-at-meta-stx context-stx stx level) + (cond + [(not (number? level)) + (raise-syntax-error #f "#:meta-level must be a literal constant number" context-stx)] + [(zero? level) + stx] + [else + #`(at-meta #,(prepend-at-meta-stx context-stx stx (- level 1)))])) (define (analyze-message-subscription! endpoint-index outer-expr-stx P-stx I-stxs L-stx) (define-values (proj pat match-pat bindings _instantiated) @@ -544,7 +548,7 @@ (match (actor-state-variables s) [(vector #,@binding-names) (match #,evt-stx - [(message #,(prepend-at-meta-stx match-pat (syntax-e L-stx))) + [(message #,(prepend-at-meta-stx outer-expr-stx match-pat (syntax-e L-stx))) #,(make-run-script-call outer-expr-stx #'s I-stxs)] [_ #f])])))))