tools/pas2c.hs
changeset 7335 3c6f08af7dac
parent 7333 520a16a14747
child 7429 fcf13e40d6b6
--- a/tools/pas2c.hs	Sat Jun 30 01:09:31 2012 +0400
+++ b/tools/pas2c.hs	Tue Jul 03 22:44:50 2012 +0400
@@ -842,7 +842,8 @@
     modify (\s -> s{lastType = BTInt})
     case lt of
          BTString -> return $ text "Length" <> parens e'
-         BTArray {} -> return $ text "length_ar" <> parens e'
+         BTArray RangeInfinite _ _ -> error $ "length() called on variable size array " ++ show e'
+         BTArray (RangeFromTo _ n) _ _ -> initExpr2C (BuiltInFunction "succ" [n])
          _ -> error $ "length() called on " ++ show lt
 expr2C (BuiltInFunCall params ref) = do
     r <- ref2C ref