Added constant-folding support for VariableSizes
This commit is contained in:
parent
1144975abc
commit
c1c73f9186
|
@ -115,6 +115,16 @@ evalVariable (A.Variable m n)
|
|||
evalVariable (A.SubscriptedVariable _ sub v) = evalVariable v >>= evalSubscript sub
|
||||
evalVariable (A.DirectedVariable _ _ v) = evalVariable v
|
||||
evalVariable (A.DerefVariable _ v) = evalVariable v
|
||||
evalVariable (A.VariableSizes m v)
|
||||
= do t <- astTypeOf v
|
||||
case t of
|
||||
A.Array ds _ -> sequence [case d of
|
||||
A.Dimension e -> evalExpression e
|
||||
A.UnknownDimension ->
|
||||
throwError (Just m, "Unknown dimension")
|
||||
| d <- ds] >>* OccArray
|
||||
_ -> throwError (Just m, " variable not array")
|
||||
|
||||
|
||||
evalIndex :: A.Expression -> EvalM Int
|
||||
evalIndex e
|
||||
|
|
Loading…
Reference in New Issue
Block a user