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