@@ -71,14 +71,15 @@ let assemble_obj_args (labels : External_arg_spec.obj_params) (args : J.express
7171 let (accs, eff, assign) as r = aux labels args in
7272 Js_of_lam_option. destruct_optional arg
7373 ~for_sure_none: r
74- ~for_sure_some: (fun x -> let acc, new_eff = Lam_compile_external_call. ocaml_to_js_eff
75- ~arg_label: Arg_label ~arg_type: obj_arg_type x in
76- begin match acc with
77- | Splice2 _
78- | Splice0 -> assert false
79- | Splice1 x ->
80- (Js_op. Lit label, x) :: accs , Ext_list. append new_eff eff , assign
81- end )
74+ ~for_sure_some: (fun x ->
75+ let acc, new_eff = Lam_compile_external_call. ocaml_to_js_eff
76+ ~arg_label: Arg_label ~arg_type: obj_arg_type x in
77+ begin match acc with
78+ | Splice2 _
79+ | Splice0 -> assert false
80+ | Splice1 x ->
81+ (Js_op. Lit label, x) :: accs , Ext_list. append new_eff eff , assign
82+ end )
8283 ~not_sure: (fun _ -> accs, eff , (arg_kind,arg)::assign )
8384 | {obj_arg_label = Obj_empty | Obj_label _ | Obj_optional _ } :: _ , [] -> assert false
8485 | [] , _ :: _ -> assert false
@@ -103,7 +104,7 @@ let assemble_obj_args (labels : External_arg_spec.obj_params) (args : J.express
103104 (Ext_list. flat_map assignment (fun
104105 ((xlabel : External_arg_spec.obj_param ), (arg : J.expression )) ->
105106 match xlabel with
106- | {obj_arg_label = Obj_optional {name = label } } ->
107+ | {obj_arg_label = Obj_optional {name = label ;for_sure_no_nested_option } } ->
107108 (* Need make sure whether assignment is effectful or not
108109 to avoid code duplication
109110 *)
@@ -113,7 +114,7 @@ let assemble_obj_args (labels : External_arg_spec.obj_params) (args : J.express
113114 Lam_compile_external_call. ocaml_to_js_eff
114115 ~arg_label:
115116 Arg_empty ~arg_type: xlabel.obj_arg_type
116- (Js_of_lam_option. val_from_option arg) in
117+ (if for_sure_no_nested_option then arg else Js_of_lam_option. val_from_option arg) in
117118 begin match acc with
118119 | Splice1 v ->
119120 [S. if_ (Js_of_lam_option. is_not_none arg )
@@ -133,7 +134,7 @@ let assemble_obj_args (labels : External_arg_spec.obj_params) (args : J.express
133134 ~arg_label:
134135 Arg_empty
135136 ~arg_type: xlabel.obj_arg_type
136- (Js_of_lam_option. val_from_option arg) in
137+ (if for_sure_no_nested_option then arg else Js_of_lam_option. val_from_option arg) in
137138 begin match acc with
138139 | Splice1 v ->
139140 st ::
0 commit comments