on master help sign in
Fix coverage.
commit0179c54c275cc189cabce540e7a71a5667f7a1ac authorMatus Tejiscak <ziman@functor.sk> dateMon 10 Feb 2014, 15:53 (13 years ago) parent44ee6d3
1 file changed+3−10
src/IRTS/Compiler.hs+3−10
src/IRTS/Compiler.hs+3−10
@@ -170,14 +170,6 @@ build (n, d)
170170 logLvl 3 $ "Compiled " ++ show n ++ " =\n\t" ++ show def
171171 return (n, def)
172172
173−getPrim :: IState -> Name -> [LExp] -> Maybe LExp
174−getPrim i n args = case lookup n (idris_scprims i) of
175− Just (ar, op) ->
176− if (ar == length args)
177− then return (LOp op args)
178− else Nothing
179− _ -> Nothing
180−
181173declArgs args inl n (LLam xs x) = declArgs (args ++ xs) inl n x
182174declArgs args inl n x = LFun (if inl then [Inline] else []) n args x
183175
@@ -272,8 +264,9 @@ instance ToIR (TT Name) where
272264 | (P _ n _, args) <- unApply tm = do
273265 ist <- getIState
274266 case lookup n (idris_scprims ist) of
275− -- if it's a primitive, compile to the corresponding code
276− Just _ -> fromJust . getPrim ist n <$> mapM (ir' env) args
267+ -- if it's a primitive, compile to the corresponding op
268+ Just (arity, op) | length args == arity
269+ -> LOp op <$> mapM (ir' env) args
277270
278271 Nothing
279272 -- if it's collapsible, compile to LNothing