summaryrefslogtreecommitdiff
path: root/compiler/utils/Binary.hs
diff options
context:
space:
mode:
authorAlan Zimmerman <alan.zimm@gmail.com>2015-01-15 13:11:21 -0600
committerAustin Seipp <austin@well-typed.com>2015-01-16 10:16:05 -0600
commit11881ec6f8d4db881671173441df87c2457409f4 (patch)
treea03777d178fc04dea082e7b12f2c7cf2dfa97ff3 /compiler/utils/Binary.hs
parentfffbf0627c2c2ee4bc49f9d26a226b39a066945e (diff)
downloadhaskell-11881ec6f8d4db881671173441df87c2457409f4.tar.gz
API Annotations tweaks.
Summary: HsTyLit now has SourceText Update documentation of HsSyn to reflect which annotations are attached to which element. Ensure that the parser always keeps HsSCC and HsTickPragma values, to be ignored in the desugar phase if not needed Bringing in SourceText for pragmas Add Location in NPlusKPat Add Location in FunDep Make RecCon payload Located Explicitly add AnnVal to RdrName where it is compound Add Location in IPBind Add Location to name in IEThingAbs Add Maybe (Located id,Bool) to Match to track fun_id,infix This includes converting Match into a record and adding a note about why the fun_id needs to be replicated in the Match. Add Location in KindedTyVar Sort out semi-colons for parsing - import statements - stmts - decls - decls_cls - decls_inst This updates the haddock submodule. Test Plan: ./validate Reviewers: hvr, austin, goldfire, simonpj Reviewed By: simonpj Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D538
Diffstat (limited to 'compiler/utils/Binary.hs')
-rw-r--r--compiler/utils/Binary.hs42
1 files changed, 24 insertions, 18 deletions
diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs
index a83e613029..9b0d0cdca1 100644
--- a/compiler/utils/Binary.hs
+++ b/compiler/utils/Binary.hs
@@ -775,18 +775,20 @@ instance Binary Activation where
return (ActiveAfter ab)
instance Binary InlinePragma where
- put_ bh (InlinePragma a b c d) = do
+ put_ bh (InlinePragma s a b c d) = do
+ put_ bh s
put_ bh a
put_ bh b
put_ bh c
put_ bh d
get bh = do
+ s <- get bh
a <- get bh
b <- get bh
c <- get bh
d <- get bh
- return (InlinePragma a b c d)
+ return (InlinePragma s a b c d)
instance Binary RuleMatchInfo where
put_ bh FunLike = putByte bh 0
@@ -832,19 +834,19 @@ instance Binary RecFlag where
_ -> do return NonRecursive
instance Binary OverlapMode where
- put_ bh NoOverlap = putByte bh 0
- put_ bh Overlaps = putByte bh 1
- put_ bh Incoherent = putByte bh 2
- put_ bh Overlapping = putByte bh 3
- put_ bh Overlappable = putByte bh 4
+ put_ bh (NoOverlap s) = putByte bh 0 >> put_ bh s
+ put_ bh (Overlaps s) = putByte bh 1 >> put_ bh s
+ put_ bh (Incoherent s) = putByte bh 2 >> put_ bh s
+ put_ bh (Overlapping s) = putByte bh 3 >> put_ bh s
+ put_ bh (Overlappable s) = putByte bh 4 >> put_ bh s
get bh = do
h <- getByte bh
case h of
- 0 -> return NoOverlap
- 1 -> return Overlaps
- 2 -> return Incoherent
- 3 -> return Overlapping
- 4 -> return Overlappable
+ 0 -> (get bh) >>= \s -> return $ NoOverlap s
+ 1 -> (get bh) >>= \s -> return $ Overlaps s
+ 2 -> (get bh) >>= \s -> return $ Incoherent s
+ 3 -> (get bh) >>= \s -> return $ Overlapping s
+ 4 -> (get bh) >>= \s -> return $ Overlappable s
_ -> panic ("get OverlapMode" ++ show h)
@@ -880,20 +882,24 @@ instance Binary Fixity where
return (Fixity aa ab)
instance Binary WarningTxt where
- put_ bh (WarningTxt w) = do
+ put_ bh (WarningTxt s w) = do
putByte bh 0
+ put_ bh s
put_ bh w
- put_ bh (DeprecatedTxt d) = do
+ put_ bh (DeprecatedTxt s d) = do
putByte bh 1
+ put_ bh s
put_ bh d
get bh = do
h <- getByte bh
case h of
- 0 -> do w <- get bh
- return (WarningTxt w)
- _ -> do d <- get bh
- return (DeprecatedTxt d)
+ 0 -> do s <- get bh
+ w <- get bh
+ return (WarningTxt s w)
+ _ -> do s <- get bh
+ d <- get bh
+ return (DeprecatedTxt s d)
instance Binary a => Binary (GenLocated SrcSpan a) where
put_ bh (L l x) = do