[Git][ghc/ghc][master] JS: Fix missing variable declarations
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Wed Nov 15 18:21:09 UTC 2023
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
2125c176 by Luite Stegeman at 2023-11-15T13:19:38-05:00
JS: Fix missing variable declarations
The JStg IR update was missing some local variable declarations
that were present earlier, causing global variables to be used
implicitly (or an error in JavaScript strict mode).
This adds the local variable declarations again.
- - - - -
1 changed file:
- compiler/GHC/StgToJS/Expr.hs
Changes:
=====================================
compiler/GHC/StgToJS/Expr.hs
=====================================
@@ -232,10 +232,10 @@ genEntryLne ctx i rhs@(StgRhsClosure _ext _cc update args body typ) =
(L.find ((==i) . fst . snd) (zip [0..] vars))
mk_bh :: G JStgStat
mk_bh | isUpdatable update =
- do x <- Var <$> freshIdent
+ do x <- freshIdent
return $ mconcat
- [ x |= ApplExpr (var "h$bh_lne") [Sub sp (toJExpr myOffset), toJExpr (payloadSize+1)]
- , IfStat x (ReturnStat x) mempty
+ [ x ||= ApplExpr (var "h$bh_lne") [Sub sp (toJExpr myOffset), toJExpr (payloadSize+1)]
+ , IfStat (Var x) (ReturnStat (Var x)) mempty
]
| otherwise = pure mempty
blk_hl <- mk_bh
@@ -913,11 +913,11 @@ loadParams from args = do
[ loadIfUsed (from .^ closureField1_) x1 u1
, loadIfUsed (from .^ closureField2_) x2 u2
]
- ((x,u):xs) -> do d <- Var <$> freshIdent
+ ((x,u):xs) -> do d <- freshIdent
return $ mconcat
[ loadIfUsed (from .^ closureField1_) x u
- , mconcat [ d |= from .^ closureField2_
- , loadConVarsIfUsed d xs
+ , mconcat [ d ||= from .^ closureField2_
+ , loadConVarsIfUsed (Var d) xs
]
]
where
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2125c17620c701a55d6bef48cfd1abc9cf183161
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2125c17620c701a55d6bef48cfd1abc9cf183161
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/20231115/c627acb7/attachment-0001.html>
More information about the ghc-commits
mailing list