Skip to content

Commit

Permalink
compiler: error if load gets handed the wrong type
Browse files Browse the repository at this point in the history
  • Loading branch information
hellerve committed Nov 8, 2018
1 parent ded4c4c commit e122732
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Eval.hs
Expand Up @@ -1056,6 +1056,8 @@ commandLoad [xobj@(XObj (Str path) _ _)] =
Left _ -> commandLoad [XObj (Str mainToLoad) Nothing Nothing]
ExitFailure _ -> do
return $ invalidPathWith ctx path stderr1
commandLoad [x] =
return $ Left (EvalError ("Invalid args to 'load' command: " ++ pretty x))


-- | Load several files in order.
Expand Down Expand Up @@ -1095,8 +1097,6 @@ commandExpand [xobj] =
Right expanded ->
liftIO $ do putStrLnWithColor Yellow (pretty expanded)
return dynamicNil
commandExpand args =
return (Left (EvalError ("Invalid args to 'expand' command: " ++ joinWithComma (map pretty args))))

-- | This function will show the resulting C code from an expression.
-- | i.e. (Int.+ 2 3) => "_0 = 2 + 3"
Expand All @@ -1115,8 +1115,6 @@ commandC [xobj] =
do liftIO (printC annXObj)
liftIO (mapM printC annDeps)
return dynamicNil
commandC args =
return (Left (EvalError ("Invalid args to 'c': " ++ joinWithComma (map pretty args))))

-- | Helper function for commandC
printC :: XObj -> IO ()
Expand Down

0 comments on commit e122732

Please sign in to comment.