Don't attempt to constant-fold empty arrays

This commit is contained in:
Adam Sampson 2007-04-30 04:03:29 +00:00
parent e701088469
commit 576c31aa72
2 changed files with 3 additions and 0 deletions

View File

@ -58,6 +58,8 @@ simplifyExpression ps e
--{{{ expression evaluator
evalLiteral :: A.Expression -> EvalM OccValue
evalLiteral (A.Literal _ _ (A.ArrayLiteral _ []))
= throwError "empty array"
evalLiteral (A.Literal _ _ (A.ArrayLiteral _ aes))
= liftM OccArray (mapM evalLiteralArray aes)
evalLiteral l = evalSimpleLiteral l

View File

@ -316,6 +316,7 @@ data BytesInResult =
BIJust Int -- ^ Just that many bytes.
| BIOneFree Int Int -- ^ An array type; A bytes, times unknown dimension B.
| BIUnknown -- ^ No idea.
deriving (Show, Eq)
-- | Return the size in bytes of a data type.
bytesInType :: (PSM m, Die m) => A.Type -> m BytesInResult