Fixed the findMeta function to return emptyMeta when no Meta exists in the given data

This commit is contained in:
Neil Brown 2007-08-28 15:23:50 +00:00
parent 1386dd6808
commit c572dcb067

View File

@ -296,8 +296,9 @@ makeConstant m n = A.Literal m A.Int $ A.IntLiteral m (show n)
-- | Find the first Meta value in some part of the AST.
findMeta :: (Data t, Typeable t) => t -> Meta
findMeta e = head $ gmapQ (mkQ emptyMeta findMeta') e
findMeta e = if null metaList then emptyMeta else head metaList
where
metaList = gmapQ (mkQ emptyMeta findMeta') e
findMeta' :: Meta -> Meta
findMeta' m = m