diff --git a/compiler/GHC/JS/JStg/Monad.hs b/compiler/GHC/JS/JStg/Monad.hs index 3c328150bf09e87fa544b5cc5d3c43ffd0ed9fc3..980bc2cba7bbe849a66b2bfe443cea4d19c9e808 100644 --- a/compiler/GHC/JS/JStg/Monad.hs +++ b/compiler/GHC/JS/JStg/Monad.hs @@ -40,7 +40,6 @@ module GHC.JS.JStg.Monad , JSM , withTag , newIdent - , newIdents , initJSM ) where @@ -95,19 +94,6 @@ newIdent = do env <- get mk_ident :: FastString -> Unique -> Ident mk_ident t i = global (mconcat [t, "_", mkFastString (show i)]) - - --- | A special case optimization over @newIdent@. Given a number of @Ident@ to --- generate, generate all of them at one time and update the state once rather --- than n times. -newIdents :: Int -> JSM [Ident] -newIdents 0 = return [] -newIdents n = do env <- get - let is = take n (uniqsFromSupply $ ids env) - tag = prefix env - return $ fmap (mk_ident tag) is - - -- | Set the tag for @Ident@s for all remaining computations. tag_names :: FastString -> JSM () tag_names tag = modify' (\env -> env {prefix = tag}) diff --git a/compiler/GHC/JS/Make.hs b/compiler/GHC/JS/Make.hs index 0fd023baa937097e81a10af127f1498036307d8a..3a98ca21e5701ae16f50fb61ba49b4c56d14e693 100644 --- a/compiler/GHC/JS/Make.hs +++ b/compiler/GHC/JS/Make.hs @@ -149,6 +149,7 @@ import GHC.JS.JStg.Monad import GHC.JS.Transform import Control.Arrow ((***)) +import Control.Monad (replicateM) import Data.Tuple import qualified Data.Map as M @@ -325,7 +326,7 @@ jFunctionSized -> ([JStgExpr] -> JSM JStgStat) -- ^ function body, input is locally unique generated variables -> JSM JStgStat jFunctionSized name arity body = do - func_args <- newIdents arity + func_args <- replicateM arity newIdent FuncStat name func_args <$> (body $ toJExpr <$> func_args) -- | Construct a top-level function subject to JS hoisting. Special case where