[Git][ghc/ghc][wip/T18599] add AnnDot annotation to getField calc
Shayne Fletcher
gitlab at gitlab.haskell.org
Mon Oct 12 01:47:40 UTC 2020
Shayne Fletcher pushed to branch wip/T18599 at Glasgow Haskell Compiler / GHC
Commits:
26b29eba by Shayne Fletcher at 2020-10-11T21:47:27-04:00
add AnnDot annotation to getField calc
- - - - -
1 changed file:
- compiler/GHC/Parser.y
Changes:
=====================================
compiler/GHC/Parser.y
=====================================
@@ -2618,20 +2618,18 @@ fexp :: { ECP }
-- See Note [Whitespace-sensitive operator parsing] in Lexer.x
| fexp TIGHT_INFIX_PROJ field
- {% do { ; $1 <- runPV (unECP $1)
- -- Suppose lhs is an application term e.g. 'f a' and
- -- rhs is '.b'. Usually we want the parse 'f
- -- (a.b)' rather than '(f a).b.'. However, if lhs is
- -- a projection 'r.a' (say) then we want the parse
- -- '(r.a).b'.
- ; return . ecpFromExp $ case $1 of
- L _ (HsApp _ f arg)
- | not $ isGetField f ->
- let l = (comb2 arg $3) in
- L (getLoc f `combineSrcSpans` l)
- (HsApp noExtField f (mkGetField l arg $3))
- _ -> mkGetField (comb2 $1 $>) $1 $3
- }}
+ {% runPV (unECP $1) >>= \ $1 ->
+ -- Suppose lhs is an application term e.g. 'f a'
+ -- and rhs is '.b'. Usually we want the parse 'f
+ -- (a.b)' rather than '(f a).b.'. However, if lhs
+ -- is a projection 'r.a' (say) then we want the
+ -- parse '(r.a).b'.
+ fmap ecpFromExp $ ams (case $1 of
+ L _ (HsApp _ f arg) | not $ isGetField f ->
+ let l = comb2 arg $3 in
+ L (getLoc f `combineSrcSpans` l)
+ (HsApp noExtField f (mkGetField l arg $3))
+ _ -> mkGetField (comb2 $1 $>) $1 $3) [mj AnnDot $2] }
| aexp { $1 }
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/26b29ebac6ba3da8caec77f73c0a1d2ec8dbe512
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/26b29ebac6ba3da8caec77f73c0a1d2ec8dbe512
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20201011/4270f858/attachment-0001.html>
More information about the ghc-commits
mailing list