on master help sign in
Fix coverage.
0179c54Matus Tejiscak
src/IRTS/Compiler.hs+3−10
@@ -170,14 +170,6 @@ build (n, d)
170 logLvl 3 $ "Compiled " ++ show n ++ " =\n\t" ++ show def
170 logLvl 3 $ "Compiled " ++ show n ++ " =\n\t" ++ show def
171 return (n, def)
171 return (n, def)
172
172
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−
181declArgs args inl n (LLam xs x) = declArgs (args ++ xs) inl n x
173declArgs args inl n (LLam xs x) = declArgs (args ++ xs) inl n x
182declArgs args inl n x = LFun (if inl then [Inline] else []) n args x
174declArgs args inl n x = LFun (if inl then [Inline] else []) n args x
183
175
@@ -272,8 +264,9 @@ instance ToIR (TT Name) where
272 | (P _ n _, args) <- unApply tm = do
264 | (P _ n _, args) <- unApply tm = do
273 ist <- getIState
265 ist <- getIState
274 case lookup n (idris_scprims ist) of
266 case lookup n (idris_scprims ist) of
275− -- if it's a primitive, compile to the corresponding code
267+ -- if it's a primitive, compile to the corresponding op
268+ Just (arity, op) | length args == arity
276− Just _ -> fromJust . getPrim ist n <$> mapM (ir' env) args
269+ -> LOp op <$> mapM (ir' env) args
277
270
278 Nothing
271 Nothing
279 -- if it's collapsible, compile to LNothing
272 -- if it's collapsible, compile to LNothing