Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
jberryman
GHC
Commits
0a5613f4
Commit
0a5613f4
authored
Mar 04, 2010
by
simonpj@microsoft.com
Browse files
Minor refactoring of placeHolderPunRhs
parent
c0524abb
Changes
2
Hide whitespace changes
Inline
Side-by-side
compiler/parser/Parser.y.pp
View file @
0a5613f4
...
...
@@ -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
...
...
compiler/parser/RdrHsSyn.lhs
View file @
0a5613f4
...
...
@@ -717,10 +717,10 @@ checkAPat dynflags loc e = case e of
HsType ty -> return (TypePat ty)
_ -> patFail loc
placeHolderPunRhs :: HsExpr RdrName
placeHolderPunRhs ::
L
HsExpr 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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment