Skip to content

Commit 710ed80

Browse files
committed
add comments
1 parent 14e95ba commit 710ed80

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

hie-compat/src-ghc92/Compat/HieAst.hs

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,21 @@
1515

1616
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
1717

18-
module Compat.HieAst ( enrichHie ) where
19-
20-
-- import GHC.Iface.Ext.Ast (enrichHie)
21-
18+
{-
19+
Forked from GHC v9.2.3 to include record-dot-syntax type information in .hie files.
2220
21+
Changes are marked with "CHANGED:"
2322
24-
{-
2523
Main functions for .hie file generation
2624
-}
2725

26+
-- CHANGED: removed this include and updated the module declaration
2827
-- #include "HsVersions.h"
29-
28+
--
3029
-- module GHC.Iface.Ext.Ast ( mkHieFile, mkHieFileWithSource, getCompressedAsts, enrichHie) where
3130

31+
module Compat.HieAst ( enrichHie ) where
32+
3233
import GHC.Utils.Outputable(ppr)
3334

3435
import GHC.Prelude
@@ -786,6 +787,7 @@ instance HiePass p => HasType (LocatedA (HsExpr (GhcPass p))) where
786787
HsOverLabel{} -> False
787788
HsIPVar{} -> False
788789
XExpr (WrapExpr {}) -> False
790+
-- CHANGED: the line below makes record-dot-syntax types work
789791
XExpr (ExpansionExpr {}) -> False
790792
_ -> True
791793

@@ -918,6 +920,8 @@ instance HiePass p => ToHie (Located (PatSynBind (GhcPass p) (GhcPass p))) where
918920
detSpan = case detScope of
919921
LocalScope a -> Just a
920922
_ -> Nothing
923+
-- CHANGED: removed ASSERT
924+
-- toBind (PrefixCon ts args) = ASSERT(null ts) PrefixCon ts $ map (C Use) args
921925
toBind (PrefixCon ts args) = PrefixCon ts $ map (C Use) args
922926
toBind (InfixCon a b) = InfixCon (C Use a) (C Use b)
923927
toBind (RecCon r) = RecCon $ map (PSC detSpan) r
@@ -1037,8 +1041,10 @@ instance HiePass p => ToHie (PScoped (LocatedA (Pat (GhcPass p)))) where
10371041
in [ toHie $ L ospan wrap
10381042
, toHie $ PS rsp scope pscope $ (L ospan pat)
10391043
]
1040-
1041-
1044+
-- CHANGED: removed preprocessor stuff
1045+
-- #if __GLASGOW_HASKELL__ < 811
1046+
-- HieRn -> []
1047+
-- #endif
10421048
where
10431049
contextify :: a ~ LPat (GhcPass p) => HsConDetails (HsPatSigType (NoGhcTc (GhcPass p))) a (HsRecFields (GhcPass p) a)
10441050
-> HsConDetails (TScoped (HsPatSigType (NoGhcTc (GhcPass p)))) (PScoped a) (RContext (HsRecFields (GhcPass p) (PScoped a)))
@@ -1923,7 +1929,11 @@ instance HiePass p => ToHie (LocatedA (HsSplice (GhcPass p))) where
19231929
HsSpliced _ _ _ ->
19241930
[]
19251931
XSplice x -> case ghcPass @p of
1926-
1932+
-- CHANGED: removed preprocessor stuff
1933+
-- #if __GLASGOW_HASKELL__ < 811
1934+
-- GhcPs -> noExtCon x
1935+
-- GhcRn -> noExtCon x
1936+
-- #endif
19271937
GhcTc -> case x of
19281938
HsSplicedT _ -> []
19291939

0 commit comments

Comments
 (0)