Stopped mobile arrays being allocated after declaration (with random size!)
This commit is contained in:
parent
919781eabc
commit
e8fec8585b
|
@ -1278,10 +1278,12 @@ cdeclareInit m rt@(A.Record _) var
|
||||||
initField :: A.Type -> A.Variable -> CGen ()
|
initField :: A.Type -> A.Variable -> CGen ()
|
||||||
initField t v = do fdeclareInit <- fget declareInit
|
initField t v = do fdeclareInit <- fget declareInit
|
||||||
doMaybe $ fdeclareInit m t v
|
doMaybe $ fdeclareInit m t v
|
||||||
cdeclareInit m t@(A.Mobile _) var
|
cdeclareInit m t@(A.Mobile t') var
|
||||||
= Just $ do call genVariableUnchecked var A.Original
|
= Just $ do call genVariableUnchecked var A.Original
|
||||||
tell ["=NULL;"]
|
tell ["=NULL;"]
|
||||||
call genAssign m [var] $ A.ExpressionList m [A.AllocMobile m t Nothing]
|
case t' of
|
||||||
|
A.Array {} -> return ()
|
||||||
|
_ -> call genAssign m [var] $ A.ExpressionList m [A.AllocMobile m t Nothing]
|
||||||
cdeclareInit _ _ _ = Nothing
|
cdeclareInit _ _ _ = Nothing
|
||||||
|
|
||||||
-- | Free a declared item that's going out of scope.
|
-- | Free a declared item that's going out of scope.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user