From 3a7b2aaaf411ed3372e74593ca7d0ebc0c161023 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Fri, 20 Mar 2009 19:10:11 +0000 Subject: [PATCH] Added a function for getting the attributes of a record type --- common/Types.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/common/Types.hs b/common/Types.hs index cdfbab5..2d8ffac 100644 --- a/common/Types.hs +++ b/common/Types.hs @@ -29,7 +29,7 @@ module Types mulExprs, divExprs , addDimensions, applyDimension, removeFixedDimensions, trivialSubscriptType, subscriptType, unsubscriptType , applyDirection - , recordFields, protocolItems + , recordFields, recordAttr, protocolItems , leastGeneralSharedTypeRain @@ -125,6 +125,15 @@ recordFields m (A.Record rec) _ -> dieP m "not record type" recordFields m _ = dieP m "not record type" +recordAttr :: (CSMR m, Die m) => Meta -> A.Type -> m A.RecordAttr +recordAttr m (A.Record rec) + = do st <- specTypeOfName rec + case st of + A.RecordType _ attr _ -> return attr + _ -> dieP m "not record type" +recordAttr m _ = dieP m "not record type" + + -- | Get the type of a record field. typeOfRecordField :: (CSMR m, Die m) => Meta -> A.Type -> A.Name -> m A.Type typeOfRecordField m t field