From ebd5bc1d3b27331e55282e76a187f59caa6b232f Mon Sep 17 00:00:00 2001 From: Joe Crayne Date: Tue, 19 Mar 2019 21:04:45 -0400 Subject: grok assertion fail. --- monkeypatch.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/monkeypatch.hs b/monkeypatch.hs index eefc525..98ebe38 100644 --- a/monkeypatch.hs +++ b/monkeypatch.hs @@ -359,6 +359,14 @@ grokStatement (CBlockStmt (CReturn (Just exp) _)) = do let k = uniqIdentifier "go" (compFree x `Map.union` compIntro x) x' = fmap (\y -> App () (hsvar "return") y) x return $ fmap (\y -> Lambda () [hspvar k] y) $ foldr applyComputation x' xs +grokStatement (CBlockStmt (CExpr (Just (C.CCall (CVar (C.Ident "__assert_fail" _ _) _) xs _)) _)) = do + x <- case xs of + (CConst (CStrConst msg _):_) -> let s = getCString msg + in Just $ Computation Map.empty Map.empty (Lit () (HS.String () s s)) + _ -> Nothing + let k = uniqIdentifier "go" (compFree x `Map.union` compIntro x) + x' = fmap (\y -> App () (hsvar "error") y) x + return $ fmap (\y -> Lambda () [hspvar k] y) x' grokStatement (CBlockStmt (CExpr (Just (CAssign CAssignOp cvarnew (C.CCall cvarfun [] _) _)) _)) = do -- cgit v1.2.3