summaryrefslogtreecommitdiff
path: root/src/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 81fb04f..404ecec 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -172,7 +172,7 @@ testStepGuard sline expr = do
evalSteps :: [TestStep] -> TestRun ()
evalSteps = mapM_ $ \case
- Let (SourceLine sline) name expr inner -> do
+ Let (SourceLine sline) (TypedVarName name) expr inner -> do
cur <- asks (lookup name . tsVars . snd)
when (isJust cur) $ do
outLine OutputError Nothing $ T.pack "variable '" `T.append` textVarName name `T.append` T.pack "' already exists on " `T.append` sline
@@ -180,6 +180,15 @@ evalSteps = mapM_ $ \case
value <- eval expr
withVar name value $ evalSteps inner
+ For (SourceLine sline) (TypedVarName name) expr inner -> do
+ cur <- asks (lookup name . tsVars . snd)
+ when (isJust cur) $ do
+ outLine OutputError Nothing $ T.pack "variable '" `T.append` textVarName name `T.append` T.pack "' already exists on " `T.append` sline
+ throwError Failed
+ value <- eval expr
+ forM_ value $ \i -> do
+ withVar name i $ evalSteps inner
+
DeclNode name@(TypedVarName vname) net inner -> do
createNode net (Left name) $ \node -> do
withVar vname node $ evalSteps inner