summaryrefslogtreecommitdiff
path: root/compiler/prelude/ForeignCall.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/prelude/ForeignCall.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/prelude/ForeignCall.hs')
-rw-r--r--compiler/prelude/ForeignCall.hs20
1 files changed, 14 insertions, 6 deletions
diff --git a/compiler/prelude/ForeignCall.hs b/compiler/prelude/ForeignCall.hs
index 9afc249276..5b053032bd 100644
--- a/compiler/prelude/ForeignCall.hs
+++ b/compiler/prelude/ForeignCall.hs
@@ -22,6 +22,7 @@ import FastString
import Binary
import Outputable
import Module
+import BasicTypes ( SourceText )
import Data.Char
import Data.Data
@@ -224,12 +225,17 @@ instance Outputable Header where
ppr (Header h) = quotes $ ppr h
-- | A C type, used in CAPI FFI calls
-data CType = CType (Maybe Header) -- header to include for this type
+--
+-- - 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnOpen' @'{-\# CTYPE'@,
+-- 'ApiAnnotation.AnnHeader','ApiAnnotation.AnnVal',
+-- 'ApiAnnotation.AnnClose' @'\#-}'@,
+data CType = CType SourceText -- Note [Pragma source text] in BasicTypes
+ (Maybe Header) -- header to include for this type
FastString -- the type itself
deriving (Data, Typeable)
instance Outputable CType where
- ppr (CType mh ct) = hDoc <+> ftext ct
+ ppr (CType _ mh ct) = hDoc <+> ftext ct
where hDoc = case mh of
Nothing -> empty
Just h -> ppr h
@@ -319,11 +325,13 @@ instance Binary CCallConv where
_ -> do return JavaScriptCallConv
instance Binary CType where
- put_ bh (CType mh fs) = do put_ bh mh
- put_ bh fs
- get bh = do mh <- get bh
+ put_ bh (CType s mh fs) = do put_ bh s
+ put_ bh mh
+ put_ bh fs
+ get bh = do s <- get bh
+ mh <- get bh
fs <- get bh
- return (CType mh fs)
+ return (CType s mh fs)
instance Binary Header where
put_ bh (Header h) = put_ bh h