Commit 8f074ccb authored by wz1000's avatar wz1000

update for hiefile-typeclass-info

parent 97f301a6
......@@ -13,6 +13,7 @@ import Haddock.Backends.Hyperlinker.Utils
import qualified Data.ByteString as BS
import GHC.Iface.Ext.Types
import GHC.Iface.Ext.Utils
import GHC.Unit.Module ( ModuleName, moduleNameString )
import GHC.Types.Name ( getOccString, isInternalName, Name, nameModule, nameUnique )
import GHC.Types.SrcLoc
......@@ -139,8 +140,9 @@ richToken srcs details Token{..}
contexts = concatMap (Set.elems . identInfo) . Map.elems . nodeIdentifiers $ details
-- pick an arbitary identifier to hyperlink with
identDet = Map.lookupMin . nodeIdentifiers $ details
-- pick an arbitary non-evidence identifier to hyperlink with
identDet = Map.lookupMin $ Map.filter notEvidence $ nodeIdentifiers $ details
notEvidence = not . any isEvidenceContext . identInfo
-- If we have name information, we can make links
linked = case identDet of
......@@ -163,7 +165,8 @@ annotate ni content =
| otherwise = mempty
annotation = typ ++ identTyps
typ = unlines (nodeType ni)
typedIdents = [ (n,t) | (n, identType -> Just t) <- Map.toList $ nodeIdentifiers ni ]
typedIdents = [ (n,t) | (n, c@(identType -> Just t)) <- Map.toList $ nodeIdentifiers ni
, not (any isEvidenceContext $ identInfo c) ]
identTyps
| length typedIdents > 1 || null (nodeType ni)
= concatMap (\(n,t) -> printName n ++ " :: " ++ t ++ "\n") typedIdents
......@@ -176,17 +179,19 @@ richTokenStyle
:: Bool -- ^ are we lacking a type annotation?
-> ContextInfo -- ^ in what context did this token show up?
-> [StyleClass]
richTokenStyle True Use = ["hs-type"]
richTokenStyle False Use = ["hs-var"]
richTokenStyle _ RecField{} = ["hs-var"]
richTokenStyle _ PatternBind{} = ["hs-var"]
richTokenStyle _ MatchBind{} = ["hs-var"]
richTokenStyle _ TyVarBind{} = ["hs-type"]
richTokenStyle _ ValBind{} = ["hs-var"]
richTokenStyle _ TyDecl = ["hs-type"]
richTokenStyle _ ClassTyDecl{} = ["hs-type"]
richTokenStyle _ Decl{} = ["hs-var"]
richTokenStyle _ IEThing{} = [] -- could be either a value or type
richTokenStyle True Use = ["hs-type"]
richTokenStyle False Use = ["hs-var"]
richTokenStyle _ RecField{} = ["hs-var"]
richTokenStyle _ PatternBind{} = ["hs-var"]
richTokenStyle _ MatchBind{} = ["hs-var"]
richTokenStyle _ TyVarBind{} = ["hs-type"]
richTokenStyle _ ValBind{} = ["hs-var"]
richTokenStyle _ TyDecl = ["hs-type"]
richTokenStyle _ ClassTyDecl{} = ["hs-type"]
richTokenStyle _ Decl{} = ["hs-var"]
richTokenStyle _ IEThing{} = [] -- could be either a value or type
richTokenStyle _ EvidenceVarBind{} = []
richTokenStyle _ EvidenceVarUse{} = []
tokenStyle :: TokenType -> [StyleClass]
tokenStyle TkIdentifier = ["hs-identifier"]
......
......@@ -95,10 +95,12 @@
><span id="x"
><span class="annot"
><span class="annottext"
>Point -&gt; Int
>Int
Point
Point -&gt; Int
</span
><a href="Records.html#x"
><span class="hs-identifier hs-var hs-var"
><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var"
>x</span
></a
></span
......@@ -129,10 +131,12 @@
><span id="y"
><span class="annot"
><span class="annottext"
>Point -&gt; Int
>Int
Point
Point -&gt; Int
</span
><a href="Records.html#y"
><span class="hs-identifier hs-var hs-var"
><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var"
>y</span
></a
></span
......
......@@ -699,8 +699,11 @@
><span
> </span
><span class="annot"
><a href="Types.html#Bar"
><span class="hs-identifier hs-type"
><span class="annottext"
>Quux
</span
><a href="Types.html#Bar"
><span class="hs-identifier hs-var"
>Bar</span
></a
></span
......@@ -761,8 +764,11 @@
><span
> </span
><span class="annot"
><a href="Types.html#Baz"
><span class="hs-identifier hs-type"
><span class="annottext"
>Quux
</span
><a href="Types.html#Baz"
><span class="hs-identifier hs-var"
>Baz</span
></a
></span
......@@ -864,8 +870,11 @@
><span
> </span
><span class="annot"
><a href="Types.html#Bar"
><span class="hs-identifier hs-type"
><span class="annottext"
>Quux
</span
><a href="Types.html#Bar"
><span class="hs-identifier hs-var"
>Bar</span
></a
></span
......@@ -926,8 +935,11 @@
><span
> </span
><span class="annot"
><a href="Types.html#Baz"
><span class="hs-identifier hs-type"
><span class="annottext"
>Quux
</span
><a href="Types.html#Baz"
><span class="hs-identifier hs-var"
>Baz</span
></a
></span
......@@ -1060,8 +1072,11 @@
><span
> </span
><span class="annot"
><a href="Types.html#Bar"
><span class="hs-identifier hs-type"
><span class="annottext"
>Quux
</span
><a href="Types.html#Bar"
><span class="hs-identifier hs-var"
>Bar</span
></a
></span
......@@ -1112,8 +1127,11 @@
><span
> </span
><span class="annot"
><a href="Types.html#Baz"
><span class="hs-identifier hs-type"
><span class="annottext"
>Quux
</span
><a href="Types.html#Baz"
><span class="hs-identifier hs-var"
>Baz</span
></a
></span
......@@ -1207,8 +1225,11 @@
><span class="hs-special"
>(</span
><span class="annot"
><a href="Types.html#Bar"
><span class="hs-identifier hs-type"
><span class="annottext"
>Quux
</span
><a href="Types.html#Bar"
><span class="hs-identifier hs-var"
>Bar</span
></a
></span
......@@ -1259,8 +1280,11 @@
><span class="hs-special"
>(</span
><span class="annot"
><a href="Types.html#Baz"
><span class="hs-identifier hs-type"
><span class="annottext"
>Quux
</span
><a href="Types.html#Baz"
><span class="hs-identifier hs-var"
>Baz</span
></a
></span
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment