summaryrefslogtreecommitdiff
path: root/ocaml-binary-annot/camlp4/test/fixtures/simplify.ml
blob: d910641c77e4b6f77a5f4134917de9bc4f2e960d (plain)
1
2
3
4
5
6
7
8
9
10
11
open Camlp4.PreCast

let simplify =
  object
    inherit Ast.map as super
    method expr e =
      match super#expr e with
      | <:expr< $x$ + 0 >> | <:expr< 0 + $x$ >> -> x
      | x -> x
  end
in AstFilters.register_str_item_filter simplify#str_item