summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Seipp <austin@well-typed.com>2013-10-01 21:07:44 -0500
committerAustin Seipp <austin@well-typed.com>2013-10-01 21:07:44 -0500
commit627d1e008cbe4d9318b2466394420a968d1659da (patch)
tree80ac56b460057c21e950e23eaf6ba40290276b3f
parent70ccf23f7e2f67c395be4cb87c8f4a26dd65918d (diff)
downloadhaskell-627d1e008cbe4d9318b2466394420a968d1659da.tar.gz
Add TH support for annotations (#8340)
Authored-by: Gergely Risko <gergely@risko.hu> Signed-off-by: Austin Seipp <austin@well-typed.com>
-rw-r--r--compiler/hsSyn/Convert.lhs13
1 files changed, 13 insertions, 0 deletions
diff --git a/compiler/hsSyn/Convert.lhs b/compiler/hsSyn/Convert.lhs
index 616e05c9de..59cbc7b24c 100644
--- a/compiler/hsSyn/Convert.lhs
+++ b/compiler/hsSyn/Convert.lhs
@@ -480,6 +480,19 @@ cvtPragmaD (RuleP nm bndrs lhs rhs phases)
rhs' placeHolderNames
}
+cvtPragmaD (AnnP target exp)
+ = do { exp' <- cvtl exp
+ ; target' <- case target of
+ ModuleAnnotation -> return ModuleAnnProvenance
+ TypeAnnotation n -> do
+ n' <- tconName n
+ return (TypeAnnProvenance n')
+ ValueAnnotation n -> do
+ n' <- if isVarName n then vName n else cName n
+ return (ValueAnnProvenance n')
+ ; returnL $ Hs.AnnD $ HsAnnotation target' exp'
+ }
+
dfltActivation :: TH.Inline -> Activation
dfltActivation TH.NoInline = NeverActive
dfltActivation _ = AlwaysActive