equal
deleted
inserted
replaced
840 e' <- expr2C e |
840 e' <- expr2C e |
841 lt <- gets lastType |
841 lt <- gets lastType |
842 modify (\s -> s{lastType = BTInt}) |
842 modify (\s -> s{lastType = BTInt}) |
843 case lt of |
843 case lt of |
844 BTString -> return $ text "Length" <> parens e' |
844 BTString -> return $ text "Length" <> parens e' |
845 BTArray {} -> return $ text "length_ar" <> parens e' |
845 BTArray RangeInfinite _ _ -> error $ "length() called on variable size array " ++ show e' |
|
846 BTArray (RangeFromTo _ n) _ _ -> initExpr2C (BuiltInFunction "succ" [n]) |
846 _ -> error $ "length() called on " ++ show lt |
847 _ -> error $ "length() called on " ++ show lt |
847 expr2C (BuiltInFunCall params ref) = do |
848 expr2C (BuiltInFunCall params ref) = do |
848 r <- ref2C ref |
849 r <- ref2C ref |
849 t <- gets lastType |
850 t <- gets lastType |
850 ps <- mapM expr2C params |
851 ps <- mapM expr2C params |