Skip to content

Commit

Permalink
refactor: s/NameKind/NameHint/g
Browse files Browse the repository at this point in the history
  • Loading branch information
kmyk committed Sep 14, 2021
1 parent bb82d79 commit e025d3c
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 79 deletions.
10 changes: 5 additions & 5 deletions src/Jikka/CPlusPlus/Convert/AddMain.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ runMainDeclare format = go M.empty (F.inputTree format)
go sizes = \case
F.Exp e -> do
(x, indices) <- F.unpackSubscriptedVar e
y <- renameVarName' LocalNameKind x
y <- renameVarName' LocalNameHint x
modify' $ M.insert x y
let lookupSize i = case M.lookup i sizes of
Just e -> return e
Expand Down Expand Up @@ -78,7 +78,7 @@ runMainInput format decls = do
(stmts', initialized) <- go initialized (F.Seq formats)
return (stmts ++ stmts', initialized)
F.Loop i n body -> do
j <- renameVarName' LoopCounterNameKind i
j <- renameVarName' LoopCounterNameHint i
modify' $ M.insert i j
n <- runFormatExpr n
(body, initialized) <- go initialized body
Expand All @@ -93,11 +93,11 @@ runMainSolve format = do
let solve = Call' (Function "solve" []) (map Var args)
case F.outputVariables format of
Left x -> do
y <- renameVarName' LocalNameKind x
y <- renameVarName' LocalNameHint x
modify' $ M.insert x y
return $ Declare TyAuto y (DeclareCopy solve)
Right xs -> do
ys <- mapM (renameVarName' LocalNameKind) xs
ys <- mapM (renameVarName' LocalNameHint) xs
modify' $ \env -> foldl (\env (x, y) -> M.insert x y env) env (zip xs ys)
return $ DeclareDestructure ys solve

Expand All @@ -111,7 +111,7 @@ runMainOutput format = go (F.outputTree format)
F.Newline -> return [coutStatement (Lit (LitChar '\n'))]
F.Seq formats -> concat <$> mapM go formats
F.Loop i n body -> do
j <- renameVarName' LoopCounterNameKind i
j <- renameVarName' LoopCounterNameHint i
modify' $ M.insert i j
n <- runFormatExpr n
body <- go body
Expand Down
14 changes: 7 additions & 7 deletions src/Jikka/CPlusPlus/Convert/BurnFlavouredNames.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ emptyEnv =
usedVars = S.empty
}

fromNameKind :: Maybe NameKind -> String
fromNameKind :: Maybe NameHint -> String
fromNameKind = \case
Nothing -> "u"
Just LocalNameKind -> "x"
Just LocalArgumentNameKind -> "b"
Just LoopCounterNameKind -> "i"
Just ConstantNameKind -> "c"
Just FunctionNameKind -> "f"
Just ArgumentNameKind -> "a"
Just LocalNameHint -> "x"
Just LocalArgumentNameHint -> "b"
Just LoopCounterNameHint -> "i"
Just ConstantNameHint -> "c"
Just FunctionNameHint -> "f"
Just ArgumentNameHint -> "a"

chooseOccName :: S.Set String -> VarName -> String
chooseOccName used (VarName occ _ kind) =
Expand Down
102 changes: 51 additions & 51 deletions src/Jikka/CPlusPlus/Convert/FromCore.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import qualified Jikka.Core.Language.Util as X
--------------------------------------------------------------------------------
-- monad

renameVarName' :: MonadAlpha m => Y.NameKind -> X.VarName -> m Y.VarName
renameVarName' :: MonadAlpha m => Y.NameHint -> X.VarName -> m Y.VarName
renameVarName' kind (X.VarName occ _) = case occ of
Nothing -> Y.newFreshName kind
Just occ -> Y.renameVarName' kind occ
Expand Down Expand Up @@ -163,8 +163,8 @@ runIterate env t n f x = do
t <- runType t
n <- runExpr env n
x <- runExpr env x
y <- Y.newFreshName Y.LocalNameKind
i <- Y.newFreshName Y.LoopCounterNameKind
y <- Y.newFreshName Y.LocalNameHint
i <- Y.newFreshName Y.LoopCounterNameHint
(stmtsF, body, f) <- runExprFunction env f (Y.Var y)
useStatement $ Y.Declare t y (Y.DeclareCopy x)
useStatements stmtsF
Expand All @@ -182,7 +182,7 @@ runIf env t e1 e2 e3 = do
return $ Y.Cond e1' e2' e3'
_ -> do
t <- runType t
phi <- Y.newFreshName Y.LocalNameKind
phi <- Y.newFreshName Y.LocalNameHint
let assign = Y.Assign . Y.AssignExpr Y.SimpleAssign (Y.LeftVar phi)
useStatement $ Y.Declare t phi Y.DeclareDefault
useStatement $ Y.If e1' (stmts2 ++ [assign e2']) (Just (stmts3 ++ [assign e3']))
Expand All @@ -194,8 +194,8 @@ runFoldl env t1 t2 f init xs = do
xs <- runExpr env xs
t1 <- runType t1
t2 <- runType t2
y <- Y.newFreshName Y.LocalNameKind
x <- Y.newFreshName Y.LocalNameKind
y <- Y.newFreshName Y.LocalNameHint
x <- Y.newFreshName Y.LocalNameHint
(stmtsF, body, f) <- runExprFunction2 env f (Y.Var y) (Y.Var x)
useStatement $ Y.Declare t2 y (Y.DeclareCopy init)
useStatements stmtsF
Expand All @@ -204,7 +204,7 @@ runFoldl env t1 t2 f init xs = do

runMap :: (MonadStatements m, MonadAlpha m, MonadError Error m) => Env -> X.Type -> X.Type -> X.Expr -> X.Expr -> m Y.Expr
runMap env _ t2 f xs = do
ys <- Y.newFreshName Y.LocalNameKind
ys <- Y.newFreshName Y.LocalNameHint
t2 <- runType t2
case (f, xs) of
-- optimize @map (const e) xs@
Expand All @@ -216,7 +216,7 @@ runMap env _ t2 f xs = do
-- other cases
_ -> do
xs <- runExpr env xs
i <- Y.newFreshName Y.LoopCounterNameKind
i <- Y.newFreshName Y.LoopCounterNameHint
(stmtsF, body, f) <- runExprFunction env f (Y.at xs (Y.Var i))
useStatement $ Y.Declare (Y.TyVector t2) ys (Y.DeclareCopy (Y.vecCtor t2 [Y.size xs]))
useStatements stmtsF
Expand Down Expand Up @@ -352,13 +352,13 @@ runAppBuiltin env f ts args = wrapError' ("converting builtin " ++ X.formatBuilt
X.ModMatPow n -> go03 $ \f k m -> Y.Call' (Y.Function "jikka::modmat::pow" [Y.TyIntValue n]) [f, k, m]
-- list functions
X.Cons -> go12' $ \t x xs -> do
ys <- Y.newFreshName Y.LocalNameKind
ys <- Y.newFreshName Y.LocalNameHint
useStatement $ Y.Declare (Y.TyVector t) ys Y.DeclareDefault
useStatement $ Y.callMethod' (Y.Var ys) "push_back" [x]
useStatement $ Y.callMethod' (Y.Var ys) "insert" [Y.end (Y.Var ys), Y.begin xs, Y.end xs]
return $ Y.Var ys
X.Snoc -> go12' $ \t xs x -> do
ys <- Y.newFreshName Y.LocalNameKind
ys <- Y.newFreshName Y.LocalNameHint
useStatement $ Y.Declare (Y.TyVector t) ys (Y.DeclareCopy xs)
useStatement $ Y.callMethod' (Y.Var ys) "push_back" [x]
return $ Y.Var ys
Expand All @@ -367,8 +367,8 @@ runAppBuiltin env f ts args = wrapError' ("converting builtin " ++ X.formatBuilt
init <- runExpr env init
xs <- runExpr env xs
t2 <- runType t2
ys <- Y.newFreshName Y.LocalNameKind
i <- Y.newFreshName Y.LoopCounterNameKind
ys <- Y.newFreshName Y.LocalNameHint
i <- Y.newFreshName Y.LoopCounterNameHint
(stmtsF, body, f) <- runExprFunction2 env f (Y.at (Y.Var ys) (Y.Var i)) (Y.at xs (Y.Var i))
useStatement $ Y.Declare (Y.TyVector t2) ys (Y.DeclareCopy (Y.vecCtor t2 [Y.incrExpr (Y.size xs)]))
useStatement $ Y.assignAt ys (Y.litInt32 0) init
Expand All @@ -379,8 +379,8 @@ runAppBuiltin env f ts args = wrapError' ("converting builtin " ++ X.formatBuilt
xs <- runExpr env xs
n <- runExpr env n
t <- runType t
ys <- Y.newFreshName Y.LocalNameKind
i <- Y.newFreshName Y.LoopCounterNameKind
ys <- Y.newFreshName Y.LocalNameHint
i <- Y.newFreshName Y.LoopCounterNameHint
(stmtsF, body, f) <- runExprFunction env f (Y.Var ys)
useStatement $ Y.Declare (Y.TyVector t) ys (Y.DeclareCopy xs)
useStatements stmtsF
Expand All @@ -391,8 +391,8 @@ runAppBuiltin env f ts args = wrapError' ("converting builtin " ++ X.formatBuilt
X.Filter -> go12'' $ \t f xs -> do
xs <- runExpr env xs
t <- runType t
ys <- Y.newFreshName Y.LocalNameKind
x <- Y.newFreshName Y.LocalNameKind
ys <- Y.newFreshName Y.LocalNameHint
x <- Y.newFreshName Y.LocalNameHint
(stmtsF, body, f) <- runExprFunction env f (Y.Var x)
useStatement $ Y.Declare (Y.TyVector t) ys Y.DeclareDefault
useStatements stmtsF
Expand All @@ -401,86 +401,86 @@ runAppBuiltin env f ts args = wrapError' ("converting builtin " ++ X.formatBuilt
X.At -> go12 $ \_ e1 e2 -> Y.at e1 e2
X.SetAt -> go13 $ \t xs i x -> Y.Call' (Y.SetAt t) [xs, i, x]
X.Elem -> go12' $ \_ xs x -> do
y <- Y.newFreshName Y.LocalNameKind
y <- Y.newFreshName Y.LocalNameHint
useStatement $ Y.Declare Y.TyBool y (Y.DeclareCopy (Y.BinOp Y.NotEqual (Y.callFunction "std::find" [] [Y.begin xs, Y.end xs, x]) (Y.end xs)))
return $ Y.Var y
X.Sum -> go01' $ \xs -> do
y <- Y.newFreshName Y.LocalNameKind
y <- Y.newFreshName Y.LocalNameHint
useStatement $ Y.Declare Y.TyInt64 y (Y.DeclareCopy (Y.callFunction "std::accumulate" [] [Y.begin xs, Y.end xs, Y.litInt64 0]))
return $ Y.Var y
X.ModSum -> go02' $ \xs m -> do
y <- Y.newFreshName Y.LocalNameKind
x <- Y.newFreshName Y.LocalNameKind
y <- Y.newFreshName Y.LocalNameHint
x <- Y.newFreshName Y.LocalNameHint
useStatement $ Y.Declare Y.TyInt64 y (Y.DeclareCopy (Y.litInt64 0))
useStatement $ Y.ForEach Y.TyInt64 x xs [Y.Assign (Y.AssignExpr Y.AddAssign (Y.LeftVar y) (Y.callFunction "jikka::floormod" [] [Y.Var x, m]))]
return $ Y.callFunction "jikka::floormod" [] [Y.Var y, m]
X.Product -> go01' $ \xs -> do
y <- Y.newFreshName Y.LocalNameKind
x <- Y.newFreshName Y.LocalNameKind
y <- Y.newFreshName Y.LocalNameHint
x <- Y.newFreshName Y.LocalNameHint
useStatement $ Y.Declare Y.TyInt64 y (Y.DeclareCopy (Y.litInt64 1))
useStatement $ Y.ForEach Y.TyInt64 x xs [Y.Assign (Y.AssignExpr Y.MulAssign (Y.LeftVar y) (Y.Var x))]
return $ Y.Var y
X.ModProduct -> go02' $ \xs m -> do
y <- Y.newFreshName Y.LocalNameKind
x <- Y.newFreshName Y.LocalNameKind
y <- Y.newFreshName Y.LocalNameHint
x <- Y.newFreshName Y.LocalNameHint
useStatement $ Y.Declare Y.TyInt64 y (Y.DeclareCopy (Y.litInt64 1))
useStatement $ Y.ForEach Y.TyInt64 x xs [Y.Assign (Y.AssignExpr Y.SimpleAssign (Y.LeftVar y) (Y.callFunction "jikka::mod::mult" [] [Y.Var y, Y.Var x, m]))]
return $ Y.Var y
X.Min1 -> go11' $ \t xs -> do
y <- Y.newFreshName Y.LocalNameKind
y <- Y.newFreshName Y.LocalNameHint
useStatement $ Y.Declare t y (Y.DeclareCopy (Y.UnOp Y.Deref (Y.callFunction "std::min_element" [] [Y.begin xs, Y.end xs])))
return $ Y.Var y
X.Max1 -> go11' $ \t xs -> do
y <- Y.newFreshName Y.LocalNameKind
y <- Y.newFreshName Y.LocalNameHint
useStatement $ Y.Declare t y (Y.DeclareCopy (Y.UnOp Y.Deref (Y.callFunction "std::max_element" [] [Y.begin xs, Y.end xs])))
return $ Y.Var y
X.ArgMin -> go11' $ \t xs -> do
y <- Y.newFreshName Y.LocalNameKind
y <- Y.newFreshName Y.LocalNameHint
useStatement $ Y.Declare t y (Y.DeclareCopy (Y.BinOp Y.Sub (Y.callFunction "std::min_element" [] [Y.begin xs, Y.end xs]) (Y.begin xs)))
return $ Y.Var y
X.ArgMax -> go11' $ \t xs -> do
y <- Y.newFreshName Y.LocalNameKind
y <- Y.newFreshName Y.LocalNameHint
useStatement $ Y.Declare t y (Y.DeclareCopy (Y.BinOp Y.Sub (Y.callFunction "std::max_element" [] [Y.begin xs, Y.end xs]) (Y.begin xs)))
return $ Y.Var y
X.Gcd1 -> go11' $ \t xs -> do
y <- Y.newFreshName Y.LocalNameKind
a <- Y.newFreshName Y.LocalArgumentNameKind
b <- Y.newFreshName Y.LocalArgumentNameKind
y <- Y.newFreshName Y.LocalNameHint
a <- Y.newFreshName Y.LocalArgumentNameHint
b <- Y.newFreshName Y.LocalArgumentNameHint
useStatement $ Y.Declare t y (Y.DeclareCopy (Y.UnOp Y.Deref (Y.callFunction "std::accumulate" [] [Y.begin xs, Y.end xs, Y.litInt64 0, Y.Lam [(Y.TyAuto, a), (Y.TyAuto, b)] Y.TyAuto [Y.Return $ Y.callFunction "std::gcd" [] [Y.Var a, Y.Var b]]])))
return $ Y.Var y
X.Lcm1 -> go11' $ \t xs -> do
y <- Y.newFreshName Y.LocalNameKind
a <- Y.newFreshName Y.LocalArgumentNameKind
b <- Y.newFreshName Y.LocalArgumentNameKind
y <- Y.newFreshName Y.LocalNameHint
a <- Y.newFreshName Y.LocalArgumentNameHint
b <- Y.newFreshName Y.LocalArgumentNameHint
useStatement $ Y.Declare t y (Y.DeclareCopy (Y.UnOp Y.Deref (Y.callFunction "std::accumulate" [] [Y.begin xs, Y.end xs, Y.litInt64 1, Y.Lam [(Y.TyAuto, a), (Y.TyAuto, b)] Y.TyAuto [Y.Return $ Y.callFunction "std::lcm" [] [Y.Var a, Y.Var b]]])))
return $ Y.Var y
X.All -> go01' $ \xs -> do
y <- Y.newFreshName Y.LocalNameKind
y <- Y.newFreshName Y.LocalNameHint
useStatement $ Y.Declare Y.TyBool y (Y.DeclareCopy (Y.BinOp Y.Equal (Y.callFunction "std::find" [] [Y.begin xs, Y.end xs, Y.Lit (Y.LitBool False)]) (Y.end xs)))
return $ Y.Var y
X.Any -> go01' $ \xs -> do
y <- Y.newFreshName Y.LocalNameKind
y <- Y.newFreshName Y.LocalNameHint
useStatement $ Y.Declare Y.TyBool y (Y.DeclareCopy (Y.BinOp Y.NotEqual (Y.callFunction "std::find" [] [Y.begin xs, Y.end xs, Y.Lit (Y.LitBool True)]) (Y.end xs)))
return $ Y.Var y
X.Sorted -> go11' $ \t xs -> do
ys <- Y.newFreshName Y.LocalNameKind
ys <- Y.newFreshName Y.LocalNameHint
useStatement $ Y.Declare (Y.TyVector t) ys (Y.DeclareCopy xs)
useStatement $ Y.callFunction' "std::sort" [] [Y.begin (Y.Var ys), Y.end (Y.Var ys)]
return $ Y.Var ys
X.Reversed -> go11' $ \t xs -> do
ys <- Y.newFreshName Y.LocalNameKind
ys <- Y.newFreshName Y.LocalNameHint
useStatement $ Y.Declare (Y.TyVector t) ys (Y.DeclareCopy xs)
useStatement $ Y.callFunction' "std::reverse" [] [Y.begin (Y.Var ys), Y.end (Y.Var ys)]
return $ Y.Var ys
X.Range1 -> go01 $ \n -> Y.Call' Y.Range [n]
X.Range2 -> go02' $ \from to -> do
ys <- Y.newFreshName Y.LocalNameKind
ys <- Y.newFreshName Y.LocalNameHint
useStatement $ Y.Declare (Y.TyVector Y.TyInt64) ys (Y.DeclareCopy (Y.vecCtor Y.TyInt64 [Y.BinOp Y.Sub to from]))
useStatement $ Y.callFunction' "std::iota" [] [Y.begin (Y.Var ys), Y.end (Y.Var ys), from]
return $ Y.Var ys
X.Range3 -> go03' $ \from to step -> do
ys <- Y.newFreshName Y.LocalNameKind
i <- Y.newFreshName Y.LoopCounterNameKind
ys <- Y.newFreshName Y.LocalNameHint
i <- Y.newFreshName Y.LoopCounterNameHint
useStatement $ Y.Declare (Y.TyVector Y.TyInt64) ys Y.DeclareDefault
useStatement $ Y.For Y.TyInt32 i from (Y.BinOp Y.LessThan (Y.Var i) to) (Y.AssignExpr Y.AddAssign (Y.LeftVar i) step) [Y.callMethod' (Y.Var ys) "push_back" [Y.Var i]]
return $ Y.Var ys
Expand Down Expand Up @@ -516,7 +516,7 @@ runAppBuiltin env f ts args = wrapError' ("converting builtin " ++ X.formatBuilt
runExprFunction :: (MonadAlpha m, MonadError Error m) => Env -> X.Expr -> Y.Expr -> m ([Y.Statement], [Y.Statement], Y.Expr)
runExprFunction env f e = case f of
X.Lam x t body -> do
y <- renameVarName' Y.LocalArgumentNameKind x
y <- renameVarName' Y.LocalArgumentNameHint x
(stmts, body) <- runStatementsT $ runExpr (pushVar x t y env) body
let stmts' = map (Y.replaceStatement y e) stmts
let body' = Y.replaceExpr y e body
Expand All @@ -528,8 +528,8 @@ runExprFunction env f e = case f of
runExprFunction2 :: (MonadAlpha m, MonadError Error m) => Env -> X.Expr -> Y.Expr -> Y.Expr -> m ([Y.Statement], [Y.Statement], Y.Expr)
runExprFunction2 env f e1 e2 = case f of
X.Lam2 x1 t1 x2 t2 body -> do
y1 <- renameVarName' Y.LocalArgumentNameKind x1
y2 <- renameVarName' Y.LocalArgumentNameKind x2
y1 <- renameVarName' Y.LocalArgumentNameHint x1
y2 <- renameVarName' Y.LocalArgumentNameHint x2
(stmts, body) <- runStatementsT $ runExpr (pushVar x2 t2 y2 (pushVar x1 t1 y1 env)) body
let stmts' = map (Y.replaceStatement y2 e2 . Y.replaceStatement y1 e1) stmts
let body' = Y.replaceExpr y2 e2 $ Y.replaceExpr y1 e1 body
Expand All @@ -543,7 +543,7 @@ runAssert env = \case
-- optimize @assert all(...)@
X.All' (X.Map' t _ f xs) -> do
t <- runType t
y <- Y.newFreshName Y.LocalNameKind
y <- Y.newFreshName Y.LocalNameHint
xs <- runExpr env xs
(stmtsF, body, e) <- runExprFunction env f (Y.Var y)
useStatements stmtsF
Expand Down Expand Up @@ -574,7 +574,7 @@ runExpr env = \case
ts <- mapM runType ts
ret <- runType ret
xs <- replicateM (arity - length args) X.genVarName'
ys <- mapM (renameVarName' Y.LocalArgumentNameKind) xs
ys <- mapM (renameVarName' Y.LocalArgumentNameHint) xs
e <- runAppBuiltin env builtin bts (args ++ map X.Var xs)
let (_, e') = foldr (\(t, y) (ret, e) -> (Y.TyFunction ret [t], Y.Lam [(t, y)] ret [Y.Return e])) (ret, e) (zip (drop (length args) ts) ys)
return e'
Expand All @@ -592,15 +592,15 @@ runExpr env = \case
return $ Y.Call f args
e@(X.Lam _ _ _) -> do
let (args, body) = X.uncurryLam e
ys <- mapM (renameVarName' Y.LocalArgumentNameKind . fst) args
ys <- mapM (renameVarName' Y.LocalArgumentNameHint . fst) args
let env' = foldl (\env ((x, t), y) -> pushVar x t y env) env (zip args ys)
ret <- runType =<< typecheckExpr env' body
(stmts, body) <- runStatementsT $ runExpr env' body
ts <- mapM (runType . snd) args
let (_, [Y.Return e]) = foldr (\(t, y) (ret, body) -> (Y.TyFunction ret [t], [Y.Return (Y.Lam [(t, y)] ret body)])) (ret, stmts ++ [Y.Return body]) (zip ts ys)
return e
X.Let x t e1 e2 -> do
y <- renameVarName' Y.LocalNameKind x
y <- renameVarName' Y.LocalNameHint x
t' <- runType t
e1 <- runExpr env e1
useStatement $ Y.Declare t' y (Y.DeclareCopy e1)
Expand All @@ -613,7 +613,7 @@ runToplevelFunDef :: (MonadAlpha m, MonadError Error m) => Env -> Y.FunName -> [
runToplevelFunDef env f args ret body = do
ret <- runType ret
args <- forM args $ \(x, t) -> do
y <- renameVarName' Y.ArgumentNameKind x
y <- renameVarName' Y.ArgumentNameHint x
return (x, t, y)
(stmts, result) <- runStatementsT $ runExpr (foldl (\env (x, t, y) -> pushVar x t y env) env args) body
args <- forM args $ \(_, t, y) -> do
Expand Down Expand Up @@ -644,7 +644,7 @@ runToplevelExpr env = \case
_ -> throwInternalError "the result expr must be eta-converted"
-- merge two sets of arguments which introduced by @FunTy@ and @Lam@
args <- forM args $ \(x, t) -> do
y <- renameVarName' Y.ArgumentNameKind x
y <- renameVarName' Y.ArgumentNameHint x
return (x, t, y)
(stmts, e) <- runStatementsT $ runExpr (foldl (\env (x, t, y) -> pushVar x t y env) env args) body
let body = stmts ++ [Y.Return e]
Expand All @@ -668,7 +668,7 @@ runToplevelExpr env = \case
cont <- runToplevelExpr (pushFun x t g env) cont
return $ stmt ++ cont
_ -> do
y <- renameVarName' Y.ConstantNameKind x
y <- renameVarName' Y.ConstantNameHint x
stmt <- runToplevelVarDef env y t e
cont <- runToplevelExpr (pushVar x t y env) cont
return $ stmt ++ cont
Expand Down
4 changes: 2 additions & 2 deletions src/Jikka/CPlusPlus/Convert/InlineSetAt.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ runExpr :: (MonadAlpha m, MonadWriter [Statement] m) => Expr -> m Expr
runExpr = \case
Call' (SetAt t) [xs, i, x] -> do
y <- case xs of
Var xs -> renameVarName LocalNameKind xs
_ -> newFreshName LocalNameKind
Var xs -> renameVarName LocalNameHint xs
_ -> newFreshName LocalNameHint
tell
[ Declare (TyVector t) y (DeclareCopy xs),
Assign (AssignExpr SimpleAssign (LeftAt (LeftVar y) i) x)
Expand Down
Loading

0 comments on commit e025d3c

Please sign in to comment.