diff options
author | Son Ho | 2021-11-24 14:22:50 +0100 |
---|---|---|
committer | Son Ho | 2021-11-24 14:22:50 +0100 |
commit | 7cc0eeeec8206cf4e0c22ef1608199461c88ebac (patch) | |
tree | 554a2d9b100d02d86d16b1e3e14bc36344967895 | |
parent | ed18b966b671fdd1da60b6582a4bdd92813d5e5a (diff) |
Update eval_rvalue to handle unary_op
Diffstat (limited to '')
-rw-r--r-- | src/Interpreter.ml | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Interpreter.ml b/src/Interpreter.ml index 0eee9bc5..d63f48d5 100644 --- a/src/Interpreter.ml +++ b/src/Interpreter.ml @@ -1525,9 +1525,9 @@ let eval_unary_op (config : config) (ctx : eval_ctx) (unop : unop) | _ -> failwith "Invalid value for unop" let eval_rvalue (config : config) (ctx : eval_ctx) (rvalue : rvalue) : - eval_ctx * typed_value = + (eval_ctx * typed_value) eval_result = match rvalue with - | Use op -> eval_operand config ctx op + | Use op -> Ok (eval_operand config ctx op) | Ref (p, bkind) -> ( match bkind with | Expressions.Shared | Expressions.TwoPhaseMut -> @@ -1557,7 +1557,7 @@ let eval_rvalue (config : config) (ctx : eval_ctx) (rvalue : rvalue) : (* Update the value in the environment *) let env4 = write_place_unwrap config access p nv ctx3.env in (* Return *) - ({ ctx3 with env = env4 }, rv) + Ok ({ ctx3 with env = env4 }, rv) | Expressions.Mut -> (* Access the value *) let access = Write in @@ -1571,8 +1571,8 @@ let eval_rvalue (config : config) (ctx : eval_ctx) (rvalue : rvalue) : (* Update the value in the environment *) let env4 = write_place_unwrap config access p nv ctx3.env in (* Return *) - ({ ctx3 with env = env4 }, rv)) - | UnaryOp (unop, op) -> raise Unimplemented + Ok ({ ctx3 with env = env4 }, rv)) + | UnaryOp (unop, op) -> eval_unary_op config ctx unop op | BinaryOp (binop, op1, op2) -> raise Unimplemented | Discriminant p -> raise Unimplemented | Aggregate (aggregate_kind, ops) -> raise Unimplemented |