Skip to content

Commit

Permalink
Hard code undefined simplifications
Browse files Browse the repository at this point in the history
  • Loading branch information
filipeom committed Sep 5, 2024
1 parent fda436f commit 73e2bc5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/ast/expr.ml
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,12 @@ let rec relop ty (op : relop) (hte1 : t) (hte2 : t) : t =
| op, Val v1, Val v2 -> value (if Eval.relop ty op v1 v2 then True else False)
| Eq, _, Val Nothing | Eq, Val Nothing, _ -> value False
| Ne, _, Val Nothing | Ne, Val Nothing, _ -> value True
| Eq, _, Val (App (`Op "symbol", [ Str "undefined" ]))
| Eq, Val (App (`Op "symbol", [ Str "undefined" ])), _ ->
value False
| Ne, _, Val (App (`Op "symbol", [ Str "undefined" ]))
| Ne, Val (App (`Op "symbol", [ Str "undefined" ])), _ ->
value True
| Eq, Ptr { base = b1; offset = os1 }, Ptr { base = b2; offset = os2 } ->
if Int32.equal b1 b2 then relop Ty_bool Eq os1 os2 else value False
| Ne, Ptr { base = b1; offset = os1 }, Ptr { base = b2; offset = os2 } ->
Expand Down

0 comments on commit 73e2bc5

Please sign in to comment.