@@ -207,7 +207,7 @@ moduleToCpp (Module _ coms mn _ imps _ foreigns decls) _ =
207207 valueToCpp (ObjectUpdate _ o ps) = do
208208 obj <- valueToCpp o
209209 updates <- mapM (sndM valueToCpp) ps
210− obj' <- freshName
210+ obj' <- freshName'
211211 let objVar = AST.Var Nothing obj'
212212 copy = AST.VariableIntroduction Nothing obj' (Just $ AST.App Nothing (AST.Var Nothing (unbox dictType)) [obj])
213213 assign (k, v) = AST.Assignment Nothing (accessorString k objVar) v
@@ -311,7 +311,7 @@ moduleToCpp (Module _ coms mn _ imps _ foreigns decls) _ =
311311 -- and guards.
312312 bindersToCpp :: SourceSpan -> [CaseAlternative Ann] -> [AST] -> m AST
313313 bindersToCpp ss binders vals = do
314− valNames <- replicateM (length vals) freshName
314+ valNames <- replicateM (length vals) freshName'
315315 let assignments = zipWith (AST.VariableIntroduction Nothing) valNames (map Just vals)
316316 cpps <- forM binders $ \(CaseAlternative bs result) -> do
317317 ret <- guardsToCpp result
@@ -362,7 +362,7 @@ moduleToCpp (Module _ coms mn _ imps _ foreigns decls) _ =
362362 go :: [(Ident, Binder Ann)] -> [AST] -> m [AST]
363363 go [] done' = return done'
364364 go ((field, binder) : remain) done' = do
365− argVar <- freshName
365+ argVar <- freshName'
366366 done'' <- go remain done'
367367 cpp <- binderToCpp argVar done'' binder
368368 return (AST.VariableIntroduction Nothing argVar (Just $ accessorString (mkString $ identToCpp field) $ AST.Var Nothing varName) : cpp)
@@ -390,7 +390,7 @@ moduleToCpp (Module _ coms mn _ imps _ foreigns decls) _ =
390390 go :: [AST] -> [(PSString, Binder Ann)] -> m [AST]
391391 go done' [] = return done'
392392 go done' ((prop, binder):bs') = do
393− propVar <- freshName
393+ propVar <- freshName'
394394 done'' <- go done' bs'
395395 cpp <- binderToCpp propVar done'' binder
396396 return (AST.VariableIntroduction Nothing propVar (Just (accessorString prop (AST.Var Nothing varName))) : cpp)
@@ -404,7 +404,7 @@ moduleToCpp (Module _ coms mn _ imps _ foreigns decls) _ =
404404 go :: [AST] -> Integer -> [Binder Ann] -> m [AST]
405405 go done' _ [] = return done'
406406 go done' index (binder:bs') = do
407− elVar <- freshName
407+ elVar <- freshName'
408408 done'' <- go done' (index + 1) bs'
409409 cpp <- binderToCpp elVar done'' binder
410410 return (AST.VariableIntroduction Nothing elVar (Just (AST.Indexer Nothing (AST.NumericLiteral Nothing (Left index)) (AST.Var Nothing varName))) : cpp)
@@ -414,3 +414,8 @@ emptyAnn = (SourceSpan "" (SourcePos 0 0) (SourcePos 0 0), [], Nothing, Nothing)
414414
415415arrayLength :: AST -> AST
416416arrayLength a = AST.App Nothing (AST.Var Nothing arrayLengthFn) [a]
417+
418+freshName' :: MonadSupply m => m Text
419+freshName' = do
420+ name <- freshName
421+ return $ T.replace "$" "_Local_" name