Handle the RHS type of A.Counted consistently.

Previously the parser set it to the element type, but everything that used it
set it to the type of the whole array. Now it's documented in AST.hs, and the
parser makes it the type of the whole array, since that's almost always what
you really want later on.
This commit is contained in:
Adam Sampson 2008-04-06 00:09:23 +00:00
parent 37b5735de1
commit 475a77404c
2 changed files with 3 additions and 1 deletions

View File

@ -137,6 +137,8 @@ data Type =
-- | A channel of the specified type.
| Chan Direction ChanAttributes Type
-- | A counted input or output.
-- The first type is that of the count; the second is that of the array.
-- (For example, @INT::[]BYTE@ would be @A.Counted A.Int (A.Array ...)@).
| Counted Type Type
| Any
| Timer TimerType

View File

@ -1229,7 +1229,7 @@ protocol
simpleProtocol :: OccParser A.Type
simpleProtocol
= do { l <- tryVX dataType sColons; sLeft; sRight; r <- dataType; return $ A.Counted l r }
= do { l <- tryVX dataType sColons; sLeft; sRight; r <- dataType; return $ A.Counted l (addDimensions [A.UnknownDimension] r) }
<|> dataType
<|> do { sANY; return $ A.Any }
<?> "simple protocol"