From 7488749af2408b6509776cfb54c150a834b55314 Mon Sep 17 00:00:00 2001 From: alexwl Date: Mon, 10 Dec 2018 16:50:24 +0300 Subject: Index injectivity annotations --- src/HaskellCodeExplorer/AST/RenamedSource.hs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/HaskellCodeExplorer/AST/RenamedSource.hs b/src/HaskellCodeExplorer/AST/RenamedSource.hs index d3b67d3..52e92e6 100644 --- a/src/HaskellCodeExplorer/AST/RenamedSource.hs +++ b/src/HaskellCodeExplorer/AST/RenamedSource.hs @@ -64,6 +64,7 @@ import GHC #endif , Type , RoleAnnotDecl(..) + , InjectivityAnn (..) , unLoc ) #if MIN_VERSION_GLASGOW_HASKELL(8,4,3,0) @@ -124,7 +125,8 @@ namesFromRenamedSource = hsRecAmbFieldExprNames `extQ` hsRecFieldPatNames `extQ` foreignDeclNames `extQ` - roleAnnotationNames) + roleAnnotationNames `extQ` + injectivityAnnotationNames) #if MIN_VERSION_GLASGOW_HASKELL(8,4,3,0) fieldOccName :: Bool -> FieldOcc GhcRn -> NameOccurrence @@ -647,3 +649,19 @@ roleAnnotationNames (RoleAnnotDecl n _) = , isBinder = False } ] + +#if MIN_VERSION_GLASGOW_HASKELL(8,4,3,0) +injectivityAnnotationNames :: InjectivityAnn GhcRn -> [NameOccurrence] +#else +injectivityAnnotationNames :: InjectivityAnn Name -> [NameOccurrence] +#endif +injectivityAnnotationNames (InjectivityAnn lhsName rhsNames) = + injAnnNameOcc lhsName : map injAnnNameOcc rhsNames + where + injAnnNameOcc :: GenLocated SrcSpan Name -> NameOccurrence + injAnnNameOcc n = + NameOccurrence + { locatedName = Just <$> n + , description = "InjectivityAnn" + , isBinder = False + } -- cgit v1.2.3