diff options
-rw-r--r-- | check.hs | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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 |