File: expr_info_use.ml

package info (click to toggle)
ocaml-visitors 20200210-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,896 kB
  • sloc: ml: 4,077; makefile: 44; sh: 18
file content (17 lines) | stat: -rw-r--r-- 369 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
open Expr_info

let strip (e : _ expr) : unit expr =
  let v = object
    inherit [_] map
    method visit_'info _env _info = ()
  end in
  v # visit_expr () e

let number (e : _ expr) : int expr =
  let v = object
    inherit [_] map
    val mutable count = 0
    method visit_'info _env _info =
      let c = count in count <- c + 1; c
  end in
  v # visit_expr () e