summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorsimonpj@microsoft.com <unknown>2010-03-04 12:41:13 +0000
committersimonpj@microsoft.com <unknown>2010-03-04 12:41:13 +0000
commit0a5613f40b0e32cf59966e6b56b807cdbe80aa7b (patch)
tree9de29a172163a9bc4d588cd25972388bad32a144 /compiler
parentc0524abb58eb3331508d77b479bf4d8666843982 (diff)
downloadhaskell-0a5613f40b0e32cf59966e6b56b807cdbe80aa7b.tar.gz
Minor refactoring of placeHolderPunRhs
Diffstat (limited to 'compiler')
-rw-r--r--compiler/parser/Parser.y.pp9
-rw-r--r--compiler/parser/RdrHsSyn.lhs4
2 files changed, 6 insertions, 7 deletions
diff --git a/compiler/parser/Parser.y.pp b/compiler/parser/Parser.y.pp
index 3b51e58418..42cb96f101 100644
--- a/compiler/parser/Parser.y.pp
+++ b/compiler/parser/Parser.y.pp
@@ -1633,11 +1633,10 @@ fbinds1 :: { ([HsRecField RdrName (LHsExpr RdrName)], Bool) }
| '..' { ([], True) }
fbind :: { HsRecField RdrName (LHsExpr RdrName) }
- : qvar '=' exp { HsRecField $1 $3 False }
- | qvar { HsRecField $1 (L (getLoc $1) placeHolderPunRhs) True }
- -- Here's where we say that plain 'x'
- -- means exactly 'x = x'. The pun-flag boolean is
- -- there so we can still print it right
+ : qvar '=' exp { HsRecField $1 $3 False }
+ | qvar { HsRecField $1 placeHolderPunRhs True }
+ -- In the punning case, use a place-holder
+ -- The renamer fills in the final value
-----------------------------------------------------------------------------
-- Implicit Parameter Bindings
diff --git a/compiler/parser/RdrHsSyn.lhs b/compiler/parser/RdrHsSyn.lhs
index b83bcd952e..ae4a15a2a1 100644
--- a/compiler/parser/RdrHsSyn.lhs
+++ b/compiler/parser/RdrHsSyn.lhs
@@ -717,10 +717,10 @@ checkAPat dynflags loc e = case e of
HsType ty -> return (TypePat ty)
_ -> patFail loc
-placeHolderPunRhs :: HsExpr RdrName
+placeHolderPunRhs :: LHsExpr RdrName
-- The RHS of a punned record field will be filled in by the renamer
-- It's better not to make it an error, in case we want to print it when debugging
-placeHolderPunRhs = HsVar pun_RDR
+placeHolderPunRhs = noLoc (HsVar pun_RDR)
plus_RDR, bang_RDR, pun_RDR :: RdrName
plus_RDR = mkUnqual varName (fsLit "+") -- Hack