Generate array constants properly

This commit is contained in:
Adam Sampson 2007-04-19 18:12:31 +00:00
parent 4efde46770
commit a2f3c868d9
2 changed files with 12 additions and 1 deletions

View File

@ -720,7 +720,16 @@ introduceSpec (A.Specification _ n (A.Is _ am t v))
rhsSizes n
introduceSpec (A.Specification _ n (A.IsExpr _ am t e))
= do let (rhs, rhsSizes) = abbrevExpression am t e
genDecl am t n
case (am, t, e) of
(A.ValAbbrev, A.Array _ ts, A.ExprLiteral _ _) ->
-- For "VAL []T a IS [vs]:", we have to use [] rather than * in the
-- declaration, since you can't say "int *foo = {vs};" in C.
do tell ["const "]
genType ts
tell [" "]
genName n
tell ["[]"]
_ -> genDecl am t n
tell [" = "]
rhs
tell [";\n"]

View File

@ -15,3 +15,5 @@ handles different types.)
Have a final pass that checks all the mangling has been done -- i.e. function
calls have been removed, and so on.
Multidimensional array literals won't work.