summaryrefslogtreecommitdiff
path: root/bytecomp/translcore.ml
diff options
context:
space:
mode:
authorGilles Peskine <Gilles.Peskine@inria.fr>2002-01-03 16:26:35 +0000
committerGilles Peskine <Gilles.Peskine@inria.fr>2002-01-03 16:26:35 +0000
commitcc4c0dc0d028b816389f5a35a191b9980065fbd0 (patch)
tree8a8921d7897a5fb32723016d8b959c28600dfbbd /bytecomp/translcore.ml
parent18381b2f5e543b91c7cad62c86412652198813de (diff)
downloadocaml-cc4c0dc0d028b816389f5a35a191b9980065fbd0.tar.gz
Generate code for dynamic and coerce. This code depends on a new
standard library module: dynamics. The type compatibility check is as yet very crude. git-svn-id: http://caml.inria.fr/svn/ocaml/branches/jocamltrunk@4209 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'bytecomp/translcore.ml')
-rw-r--r--bytecomp/translcore.ml13
1 files changed, 13 insertions, 0 deletions
diff --git a/bytecomp/translcore.ml b/bytecomp/translcore.ml
index 5658bbc915..c7cf4f6ef6 100644
--- a/bytecomp/translcore.ml
+++ b/bytecomp/translcore.ml
@@ -603,6 +603,19 @@ let rec transl_exp e =
transl_exp (List.hd expr_list)]),
fill_fields 1 (List.tl expr_list))
end
+(*> JOCAML *)
+ | Texp_dynamic d ->
+ Lprim (Pmakeblock (0, Immutable),
+ [Transldyn.type_expr d.exp_loc d.exp_type;
+ transl_exp d])
+ | Texp_coerce (d, t) ->
+ let te = (* probably wrong if type variables are involved *)
+ Typetexp.transl_type_scheme e.exp_env t
+ in
+ Lapply (Transldyn.dynamics_prim "coerce_internal",
+ [transl_exp d;
+ Transldyn.type_expr t.Parsetree.ptyp_loc te])
+(*< JOCAML *)
| Texp_ifthenelse(cond, ifso, Some ifnot) ->
Lifthenelse(transl_exp cond,
event_before ifso (transl_exp ifso),