From adb7d89709fabe14791fe9b570d9db3e993d43f6 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Fri, 17 Nov 2023 14:18:23 +0000 Subject: ccwl: Recreate types using syntax. * ccwl/ccwl.scm (type->syntax): New function. (key->output): Use type->syntax. --- ccwl/ccwl.scm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ccwl/ccwl.scm b/ccwl/ccwl.scm index 5ae0761..0127b3c 100644 --- a/ccwl/ccwl.scm +++ b/ccwl/ccwl.scm @@ -138,6 +138,13 @@ compared using @code{equal?}." (primitive-type #''primitive-type))) +(define (type->syntax type) + "Return syntax to recreate @var{type}." + (if (array-type? type) + #`(make-array-type #,(type->syntax (array-type-member-type type))) + (with-syntax ((type (datum->syntax #f type))) + #''type))) + (define (input input-spec) "Return syntax to build an object from INPUT-SPEC." (syntax-case input-spec () @@ -749,8 +756,7 @@ commands." #`(make-output #,(with-syntax ((id (datum->syntax #f (output-id output)))) #''id) - #,(with-syntax ((type (datum->syntax #f (output-type output)))) - #''type) + #,(type->syntax (output-type output)) #,(with-syntax ((binding (datum->syntax #f (output-binding output)))) #''binding) #,(output-source output) -- cgit v1.2.3