summaryrefslogtreecommitdiff
path: root/ocaml-binary-annot/testsuite/tests/tool-ocaml/t210-setfield1.ml
diff options
context:
space:
mode:
Diffstat (limited to 'ocaml-binary-annot/testsuite/tests/tool-ocaml/t210-setfield1.ml')
-rw-r--r--ocaml-binary-annot/testsuite/tests/tool-ocaml/t210-setfield1.ml38
1 files changed, 38 insertions, 0 deletions
diff --git a/ocaml-binary-annot/testsuite/tests/tool-ocaml/t210-setfield1.ml b/ocaml-binary-annot/testsuite/tests/tool-ocaml/t210-setfield1.ml
new file mode 100644
index 0000000000..0d8e16762c
--- /dev/null
+++ b/ocaml-binary-annot/testsuite/tests/tool-ocaml/t210-setfield1.ml
@@ -0,0 +1,38 @@
+open Lib;;
+type t = {
+ mutable a : int;
+ mutable b : int;
+};;
+
+let x = {a = 7; b = 6} in
+x.b <- 11;
+if x.b <> 11 then raise Not_found;
+x
+;;
+
+(**
+ 0 CONSTINT 42
+ 2 PUSHACC0
+ 3 MAKEBLOCK1 0
+ 5 POP 1
+ 7 SETGLOBAL Lib
+ 9 CONSTINT 6
+ 11 PUSHCONSTINT 7
+ 13 MAKEBLOCK2 0
+ 15 PUSHCONSTINT 11
+ 17 PUSHACC1
+ 18 SETFIELD1
+ 19 CONSTINT 11
+ 21 PUSHACC1
+ 22 GETFIELD1
+ 23 NEQ
+ 24 BRANCHIFNOT 31
+ 26 GETGLOBAL Not_found
+ 28 MAKEBLOCK1 0
+ 30 RAISE
+ 31 ACC0
+ 32 POP 1
+ 34 ATOM0
+ 35 SETGLOBAL T210-setfield1
+ 37 STOP
+**)