diff options
author | Joe Crayne <joe@jerkface.net> | 2019-03-19 21:04:45 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2019-03-19 21:04:45 -0400 |
commit | ebd5bc1d3b27331e55282e76a187f59caa6b232f (patch) | |
tree | 1cec03203671ec054ca879e50672fd6bd85ae632 | |
parent | 2226c41531a68797901b21407ea27046be542757 (diff) |
grok assertion fail.
-rw-r--r-- | monkeypatch.hs | 8 |
1 files changed, 8 insertions, 0 deletions
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 | |||
359 | let k = uniqIdentifier "go" (compFree x `Map.union` compIntro x) | 359 | let k = uniqIdentifier "go" (compFree x `Map.union` compIntro x) |
360 | x' = fmap (\y -> App () (hsvar "return") y) x | 360 | x' = fmap (\y -> App () (hsvar "return") y) x |
361 | return $ fmap (\y -> Lambda () [hspvar k] y) $ foldr applyComputation x' xs | 361 | return $ fmap (\y -> Lambda () [hspvar k] y) $ foldr applyComputation x' xs |
362 | grokStatement (CBlockStmt (CExpr (Just (C.CCall (CVar (C.Ident "__assert_fail" _ _) _) xs _)) _)) = do | ||
363 | x <- case xs of | ||
364 | (CConst (CStrConst msg _):_) -> let s = getCString msg | ||
365 | in Just $ Computation Map.empty Map.empty (Lit () (HS.String () s s)) | ||
366 | _ -> Nothing | ||
367 | let k = uniqIdentifier "go" (compFree x `Map.union` compIntro x) | ||
368 | x' = fmap (\y -> App () (hsvar "error") y) x | ||
369 | return $ fmap (\y -> Lambda () [hspvar k] y) x' | ||
362 | grokStatement (CBlockStmt (CExpr (Just | 370 | grokStatement (CBlockStmt (CExpr (Just |
363 | (CAssign CAssignOp cvarnew | 371 | (CAssign CAssignOp cvarnew |
364 | (C.CCall cvarfun [] _) _)) _)) = do | 372 | (C.CCall cvarfun [] _) _)) _)) = do |