[Git][ghc/ghc][wip/az/epa-splicedecl-comments] EPA: Avoid duplicated comments in splice decls

Alan Zimmerman (@alanz) gitlab at gitlab.haskell.org
Sat Apr 20 10:28:51 UTC 2024



Alan Zimmerman pushed to branch wip/az/epa-splicedecl-comments at Glasgow Haskell Compiler / GHC


Commits:
8c709e82 by Alan Zimmerman at 2024-04-20T11:28:39+01:00
EPA: Avoid duplicated comments in splice decls

Contributes to #24669

- - - - -


1 changed file:

- compiler/GHC/Parser/PostProcess.hs


Changes:

=====================================
compiler/GHC/Parser/PostProcess.hs
=====================================
@@ -397,17 +397,14 @@ mkSpliceDecl :: LHsExpr GhcPs -> P (LHsDecl GhcPs)
 -- as spliced declaration.  See #10945
 mkSpliceDecl lexpr@(L loc expr)
   | HsUntypedSplice _ splice@(HsUntypedSpliceExpr {}) <- expr = do
-    !cs <- getCommentsFor (locA loc)
-    return $ L (addCommentsToEpAnn loc cs) $ SpliceD noExtField (SpliceDecl noExtField (L loc splice) DollarSplice)
+    return $ L loc $ SpliceD noExtField (SpliceDecl noExtField (L (l2l loc) splice) DollarSplice)
 
   | HsUntypedSplice _ splice@(HsQuasiQuote {}) <- expr = do
-    cs <- getCommentsFor (locA loc)
-    return $ L (addCommentsToEpAnn loc cs) $ SpliceD noExtField (SpliceDecl noExtField (L loc splice) DollarSplice)
+    return $ L loc $ SpliceD noExtField (SpliceDecl noExtField (L (l2l loc) splice) DollarSplice)
 
   | otherwise = do
-    !cs <- getCommentsFor (locA loc)
-    return $ L (addCommentsToEpAnn loc cs) $ SpliceD noExtField (SpliceDecl noExtField
-                                 (L loc (HsUntypedSpliceExpr noAnn lexpr))
+    return $ L loc $ SpliceD noExtField (SpliceDecl noExtField
+                                 (L (l2l loc) (HsUntypedSpliceExpr noAnn (la2la lexpr)))
                                        BareSplice)
 
 mkRoleAnnotDecl :: SrcSpan



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8c709e821ff568ab55b1684936d215f0a22515ee

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8c709e821ff568ab55b1684936d215f0a22515ee
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/20240420/cda253c4/attachment-0001.html>


More information about the ghc-commits mailing list