[Git][ghc/ghc][wip/js-hline] lint

Josh Meredith (@JoshMeredith) gitlab at gitlab.haskell.org
Tue May 23 03:36:08 UTC 2023



Josh Meredith pushed to branch wip/js-hline at Glasgow Haskell Compiler / GHC


Commits:
62341d54 by Josh Meredith at 2023-05-23T03:35:58+00:00
lint

- - - - -


1 changed file:

- compiler/GHC/StgToJS/Linker/Linker.hs


Changes:

=====================================
compiler/GHC/StgToJS/Linker/Linker.hs
=====================================
@@ -118,6 +118,9 @@ newtype ArchiveState = ArchiveState { loadedArchives :: IORef (Map FilePath Ar.A
 emptyArchiveState :: IO ArchiveState
 emptyArchiveState = ArchiveState <$> newIORef M.empty
 
+defaultJsContext :: SDocContext
+defaultJsContext = defaultSDocContext{sdocStyle = PprCode}
+
 jsLinkBinary
   :: JSLinkConfig
   -> StgToJSConfig
@@ -196,11 +199,11 @@ link lc_cfg cfg logger unit_env out _include units objFiles jsFiles isRootFun ex
       unless (lcNoRts lc_cfg) $ do
         if csPrettyRender cfg
           then withFile (out </> "rts.js.pretty") WriteMode $ \h ->
-            printSDoc defaultSDocContext (Ppr.PageMode True) h (rtsDeclsText $$ rtsText cfg)
+            printSDoc defaultJsContext (Ppr.PageMode True) h (rtsDeclsText $$ rtsText cfg)
           else withFile (out </> "rts.js") WriteMode $ \h -> do
             bh <- newBufHandle h
-            bPutHDoc bh defaultSDocContext (line rtsDeclsText $$ line (rtsText cfg))
-            bPutHDoc bh defaultSDocContext (line (rtsText cfg))
+            bPutHDoc bh defaultJsContext (line rtsDeclsText $$ line (rtsText cfg))
+            bPutHDoc bh defaultJsContext (line (rtsText cfg))
             bFlush bh
 
       -- link dependencies' JS files into lib.js
@@ -323,10 +326,10 @@ renderLinker h render_pretty mods jsFiles = do
       before <- hTell h
       if render_pretty
         then do
-          printSDoc defaultSDocContext (Ppr.PageMode True) h (pretty x)
+          printSDoc defaultJsContext (Ppr.PageMode True) h (pretty x)
         else do
           bh <- newBufHandle h
-          bPutHDoc bh defaultSDocContext (line $ pretty x)
+          bPutHDoc bh defaultJsContext (line $ pretty x)
           hPutChar h '\n'
           bFlush bh
       after <- hTell h



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/62341d5482fe6af3cc6316def6699de7b7a5459d

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/62341d5482fe6af3cc6316def6699de7b7a5459d
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/20230522/83678056/attachment-0001.html>


More information about the ghc-commits mailing list