From d0fb1cfa99df2f2ad8e32051ac89a5a5ef0e35f5 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Wed, 9 Jun 2021 14:53:08 +0200 Subject: [PATCH] Various missing con/destructors --- syndicate/distributed/tcp-server.rkt | 2 +- syndicate/rewrite.rkt | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/syndicate/distributed/tcp-server.rkt b/syndicate/distributed/tcp-server.rkt index 47ab8be..e0e0b5b 100644 --- a/syndicate/distributed/tcp-server.rkt +++ b/syndicate/distributed/tcp-server.rkt @@ -67,7 +67,7 @@ (during (Bind (SturdyRef-oid unvalidated-sturdyref) $key $target) (define sturdyref (validate unvalidated-sturdyref key)) (define attenuation - (append-map values (reverse (SturdyRef-caveatChain sturdyref)))) + (append-map Attenuation-value (reverse (SturdyRef-caveatChain sturdyref)))) (define attenuated-target (apply attenuate-entity-ref target attenuation)) (at observer (assert (embedded attenuated-target)))))])))))))) diff --git a/syndicate/rewrite.rkt b/syndicate/rewrite.rkt index 3c163d8..472a1b0 100644 --- a/syndicate/rewrite.rkt +++ b/syndicate/rewrite.rkt @@ -33,19 +33,22 @@ (set! bindings saved) (not result)))] [(Pattern-Lit (Lit expected)) (preserve=? expected v)] - [(Pattern-PCompound (PCompound (ConstructorSpec-CRec (CRec label arity)) members)) + [(Pattern-PCompound (PCompound (ConstructorSpec-CRec (CRec label arity)) + (PCompoundMembers members))) (match v [(record (== label preserve=?) fields) (and (= (length fields) arity) (for/and [((key pp) (in-hash members))] (and (exact-integer? key) (walk pp (list-ref fields key)))))] [_ #f])] - [(Pattern-PCompound (PCompound (ConstructorSpec-CArr (CArr arity)) members)) + [(Pattern-PCompound (PCompound (ConstructorSpec-CArr (CArr arity)) + (PCompoundMembers members))) (and (list? v) (= (length v) arity) (for/and [((key pp) (in-hash members))] (and (exact-integer? key) (walk pp (list-ref v key)))))] - [(Pattern-PCompound (PCompound (ConstructorSpec-CDict (CDict)) members)) + [(Pattern-PCompound (PCompound (ConstructorSpec-CDict (CDict)) + (PCompoundMembers members))) (and (dict? v) (for/and [((key pp) (in-hash members))] (define vv (hash-ref v key (void))) @@ -59,16 +62,19 @@ [(Template-TRef (TRef name)) (hash-ref bindings name (lambda () (error 'instantiate-Template "Missing binding: ~v" name)))] [(Template-Lit (Lit v)) v] - [(Template-TCompound (TCompound (ConstructorSpec-CRec (CRec label arity)) members)) + [(Template-TCompound (TCompound (ConstructorSpec-CRec (CRec label arity)) + (TCompoundMembers members))) (record label (for/list [(i (in-range 0 arity))] (walk (hash-ref members i (lambda () (error 'instantiate-Template "Missing record field key ~v" i))))))] - [(Template-TCompound (TCompound (ConstructorSpec-CArr (CArr arity)) members)) + [(Template-TCompound (TCompound (ConstructorSpec-CArr (CArr arity)) + (TCompoundMembers members))) (for/list [(i (in-range 0 arity))] (walk (hash-ref members i (lambda () (error 'instantiate-Template "Missing array key ~v" i)))))] - [(Template-TCompound (TCompound (ConstructorSpec-CDict (CDict)) members)) + [(Template-TCompound (TCompound (ConstructorSpec-CDict (CDict)) + (TCompoundMembers members))) (for/hash [((key tt) (in-hash members))] (values key (walk tt)))])))