Skip to content

Commit

Permalink
Fixed last use of regular head
Browse files Browse the repository at this point in the history
  • Loading branch information
bananu7 committed Nov 20, 2020
1 parent 97e4700 commit fcf6c9f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Turnip/Eval/Eval.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ call (Nil) _ = throwErrorStr "Attempt to call a nil value"
call (Boolean _) _ = throwErrorStr "Attempt to call a boolean value"
call (Table tr) args = callMeta tr args

-- | Returns a head of a [Value] pack safely, that is producing a Nil in case it's empty
-- | Returns the head of a [Value] pack safely, that is producing a Nil in case it's empty
packHead :: [Value] -> Value
packHead [] = Nil
packHead (x:_) = x
Expand Down Expand Up @@ -592,8 +592,8 @@ assignLValue (AST.LVar name) v = do
setTableField target (Str name, v)

assignLValue (AST.LFieldRef t k) v = do
tv <- head <$> eval t
kv <- head <$> eval k
tv <- evalHead t
kv <- evalHead k
case tv of
Table tr -> setTableFieldWithNewindex tr (kv,v)
_ -> throwErrorStr "Trying to assign to a field of non-table"
Expand Down

0 comments on commit fcf6c9f

Please sign in to comment.