summaryrefslogtreecommitdiff
path: root/testsuite/tests/tool-ocaml/t201-getfield.ml
blob: 253262f201185285bc1c1b832b57b34aa4b3d3f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
(* TEST
 include tool-ocaml-lib;
 flags = "-w -a";
 ocaml_script_as_argument = "true";
 setup-ocaml-build-env;
 ocaml;
*)

open Lib;;
type t = {
  a : int;
  b : int;
  c : int;
  d : int;
  e : int;
};;

if { a = 7; b = 6; c = 5; d = 4; e = 3 }.e <> 3 then raise Not_found;;

(**
       0 CONSTINT 42
       2 PUSHACC0
       3 MAKEBLOCK1 0
       5 POP 1
       7 SETGLOBAL Lib
       9 CONST3
      10 PUSHGETGLOBAL <0>(7, 6, 5, 4, 3)
      12 GETFIELD 4
      14 NEQ
      15 BRANCHIFNOT 22
      17 GETGLOBAL Not_found
      19 MAKEBLOCK1 0
      21 RAISE
      22 ATOM0
      23 SETGLOBAL T201-getfield
      25 STOP
**)