From 78f9fb61963f3da0c0e7b68d44fad1e37d2b4e79 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Mon, 23 Mar 2009 18:59:41 +0000 Subject: [PATCH] Added support in recordFields for channel bundles (which are similar enough to records) --- common/Types.hs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/common/Types.hs b/common/Types.hs index 1b0926d..33d1c0e 100644 --- a/common/Types.hs +++ b/common/Types.hs @@ -137,6 +137,21 @@ recordFields m (A.Record rec) case st of A.RecordType _ _ fs -> return fs _ -> dieP m "not record type" +recordFields m (A.ChanDataType A.DirInput _ n) + = do st <- specTypeOfName n + case st of + A.ChanBundleType _ _ fs -> return fs + _ -> dieP m "not record type" +-- Directions are flipped for the ! end: +recordFields m (A.ChanDataType A.DirOutput _ n) + = do st <- specTypeOfName n + case st of + A.ChanBundleType _ _ fs -> return [(n, flipDirOfEnd t) | (n, t) <- fs] + _ -> dieP m "not record type" + where + flipDirOfEnd (A.ChanEnd dir attr t) = A.ChanEnd (flipDir dir) attr t + flipDir A.DirInput = A.DirOutput + flipDir A.DirOutput = A.DirInput recordFields m _ = dieP m "not record type" recordAttr :: (CSMR m, Die m) => Meta -> A.Type -> m A.RecordAttr