From 081561e9cdf3917ea8ed371d1d384c98be807453 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Tue, 18 Jun 2019 16:31:56 -0700 Subject: [PATCH] add loc --- beautiful-racket-demo/scriptish-demo/expander.rkt | 5 +++-- beautiful-racket-demo/scriptish-demo/test.rkt | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/beautiful-racket-demo/scriptish-demo/expander.rkt b/beautiful-racket-demo/scriptish-demo/expander.rkt index b75cc7c..80cbc84 100644 --- a/beautiful-racket-demo/scriptish-demo/expander.rkt +++ b/beautiful-racket-demo/scriptish-demo/expander.rkt @@ -19,10 +19,11 @@ #'(make-hash (list (cons K V) ...))) (define-macro (func-def (ARG ...) STMT ...) - #'(λ (ARG ...) + (syntax/loc caller-stx + (λ (ARG ...) (let/cc return-cc (syntax-parameterize ([return (make-rename-transformer #'return-cc)]) - STMT ... (void))))) + STMT ... (void)))))) (define-syntax-parameter return (λ (stx) (error 'not-parameterized))) diff --git a/beautiful-racket-demo/scriptish-demo/test.rkt b/beautiful-racket-demo/scriptish-demo/test.rkt index 8daa65c..e36655c 100644 --- a/beautiful-racket-demo/scriptish-demo/test.rkt +++ b/beautiful-racket-demo/scriptish-demo/test.rkt @@ -14,7 +14,7 @@ var thing = { }; thing.foo; // prints 42 -thing.bar; // prints # +thing.bar; // prints # thing.bar(3); // prints 18 if ( thing.foo == 42 ) {