Added a function for getting the attributes of a record type

This commit is contained in:
Neil Brown 2009-03-20 19:10:11 +00:00
parent 64f58f3770
commit 3a7b2aaaf4

View File

@ -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