Added pulling up of list literals and list-constructed expressions
This commit is contained in:
parent
2300a5c3a7
commit
48fbf5f3e1
|
@ -336,8 +336,10 @@ pullUp pullUpArraysInsideRecords
|
||||||
doLiteralRepr lr = doGeneric lr
|
doLiteralRepr lr = doGeneric lr
|
||||||
|
|
||||||
-- | Pull array expressions that aren't already non-subscripted variables.
|
-- | Pull array expressions that aren't already non-subscripted variables.
|
||||||
|
-- Also pull lists that are literals or constructed
|
||||||
doExpression :: A.Expression -> PassM A.Expression
|
doExpression :: A.Expression -> PassM A.Expression
|
||||||
doExpression e
|
doExpression e
|
||||||
|
-- This part handles recursing into the expression first:
|
||||||
= do e' <- doExpression' e
|
= do e' <- doExpression' e
|
||||||
t <- astTypeOf e'
|
t <- astTypeOf e'
|
||||||
case t of
|
case t of
|
||||||
|
@ -347,6 +349,11 @@ pullUp pullUpArraysInsideRecords
|
||||||
A.ExprVariable _ (A.DirectedVariable _ _ _) -> return e'
|
A.ExprVariable _ (A.DirectedVariable _ _ _) -> return e'
|
||||||
--TODO work out whether to pull up DerefVariable
|
--TODO work out whether to pull up DerefVariable
|
||||||
_ -> pull t e'
|
_ -> pull t e'
|
||||||
|
A.List _ ->
|
||||||
|
case e' of
|
||||||
|
A.ExprConstr {} -> pull t e'
|
||||||
|
A.Literal {} -> pull t e'
|
||||||
|
_ -> return e'
|
||||||
_ -> return e'
|
_ -> return e'
|
||||||
where
|
where
|
||||||
pull :: A.Type -> A.Expression -> PassM A.Expression
|
pull :: A.Type -> A.Expression -> PassM A.Expression
|
||||||
|
|
Loading…
Reference in New Issue
Block a user