mirror of
https://github.com/MorizzG/MLox.git
synced 2025-12-06 04:22:41 +00:00
fixed oeprator not to convert to bool first
This commit is contained in:
parent
8735cc5023
commit
1e50140970
1 changed files with 1 additions and 1 deletions
|
|
@ -33,7 +33,7 @@ let rec interpret_expr (env : environment) (expr_node : expr_node) :
|
|||
let* expr = interpret_expr env expr in
|
||||
match (op, expr) with
|
||||
| Neg, Number x -> Number (-.x) |> Result.ok
|
||||
| Not, Bool b -> Bool (not b) |> Result.ok
|
||||
| Not, value -> Bool (lox_value_to_bool value |> not) |> Result.ok
|
||||
| _, _ ->
|
||||
let msg =
|
||||
Printf.sprintf "Invalid operant of type %s to operator %s"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue