aboutsummaryrefslogtreecommitdiff
path: root/src/HaskellCodeExplorer/AST
diff options
context:
space:
mode:
authoralexwl <alexey.a.kiryushin@gmail.com>2018-12-10 16:50:24 +0300
committeralexwl <alexey.a.kiryushin@gmail.com>2018-12-10 16:50:24 +0300
commit7488749af2408b6509776cfb54c150a834b55314 (patch)
treed7dc66efba2300cf2b233a7f6c94d77f7314f24d /src/HaskellCodeExplorer/AST
parent2c089ff24c85faf0595a1d8b985c4e3ead3f4b64 (diff)
Index injectivity annotations
Diffstat (limited to 'src/HaskellCodeExplorer/AST')
-rw-r--r--src/HaskellCodeExplorer/AST/RenamedSource.hs20
1 files changed, 19 insertions, 1 deletions
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
+ }