summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--check.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/check.hs b/check.hs
index fd94f0d..d2a7c92 100644
--- a/check.hs
+++ b/check.hs
@@ -30,9 +30,14 @@ replaceTypes prog@(Program decls) = mapProgram' filtered mapper
notTypedef _ = True
typeReplacer :: Map.Map Name Type -> Type -> Type
- typeReplacer m t@(TypeName n) = maybe t id $ Map.lookup n m
+ typeReplacer m t@(TypeName n) = maybe t (recurseAfter m) $ Map.lookup n m
typeReplacer _ t = t
+ recurseAfter :: Map.Map Name Type -> Type -> Type
+ recurseAfter m t@(TypeName _) = typeReplacer m t
+ recurseAfter m (TypePtr t) = TypePtr $ recurseAfter m t
+ recurseAfter _ t = t
+
findTypeRenames :: Program -> Map.Map Name Type
findTypeRenames (Program d) = foldl go Map.empty d
where