summaryrefslogtreecommitdiff
path: root/testsuite/tests/tool-ocaml/t210-setfield3.ml
blob: d50d2c2a631612f999705e6c501ae828792ba5f1 (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
38
39
40
41
42
open Lib;;
type t = {
  mutable a : int;
  mutable b : int;
  mutable c : int;
  mutable d : int;
};;

let x = {a = 7; b = 6; c = 5; d = 4} in
x.d <- 11;
if x.d <> 11 then raise Not_found;
x
;;

(**
       0 CONSTINT 42
       2 PUSHACC0 
       3 MAKEBLOCK1 0
       5 POP 1
       7 SETGLOBAL Lib
       9 CONSTINT 4
      11 PUSHCONSTINT 5
      13 PUSHCONSTINT 6
      15 PUSHCONSTINT 7
      17 MAKEBLOCK 4, 0
      20 PUSHCONSTINT 11
      22 PUSHACC1 
      23 SETFIELD3 
      24 CONSTINT 11
      26 PUSHACC1 
      27 GETFIELD3 
      28 NEQ 
      29 BRANCHIFNOT 36
      31 GETGLOBAL Not_found
      33 MAKEBLOCK1 0
      35 RAISE 
      36 ACC0 
      37 POP 1
      39 ATOM0 
      40 SETGLOBAL T210-setfield3
      42 STOP 
**)