@@ -296,6 +296,9 @@ let literal lit =
296296let get t at =
297297 [] , GlobalImport t @@ at, [] , [GlobalGet (subject_idx @@ at) @@ at]
298298
299+ let set t at =
300+ [] , GlobalImport t @@ at, [] , [GlobalSet (subject_idx @@ at) @@ at]
301+
299302let invoke ft at =
300303 let FuncType (ts, _) = ft in
301304 [ft @@ at], FuncImport (subject_type_idx @@ at) @@ at,
@@ -583,19 +586,25 @@ let of_wrapper mods x_opt name wrap_action opds wrap_assertion at =
583586let rec of_action mods act =
584587 match act.it with
585588 | Invoke (x_opt , name , args ) ->
589+ let opds = List. map (of_argument mods) args in
586590 " call(" ^ of_var_opt mods x_opt ^ " , " ^ of_name name ^ " , " ^
587- " [" ^ String. concat " , " ( List. map (of_arg mods) args) ^ " ].flat())" ,
591+ " [" ^ String. concat " , " opds ^ " ].flat())" ,
588592 let FuncType (_, ts2) as ft = lookup_func mods x_opt name act.at in
589593 if is_js_func_type ft then None else
590- let opds = List. map (of_arg mods) args in
591594 Some (of_wrapper mods x_opt name (invoke ft) opds, ts2)
592595 | Get (x_opt , name ) ->
593596 " get(" ^ of_var_opt mods x_opt ^ " , " ^ of_name name ^ " )" ,
594597 let GlobalType (t, _) as gt = lookup_global mods x_opt name act.at in
595598 if is_js_global_type gt then None else
596599 Some (of_wrapper mods x_opt name (get gt) [] , [t])
600+ | Set (x_opt , name , arg ) ->
601+ let opd = of_argument mods arg in
602+ " set(" ^ of_var_opt mods x_opt ^ " , " ^ of_name name ^ " , " ^ opd ^ " )" ,
603+ let GlobalType (t, _) as gt = lookup_global mods x_opt name act.at in
604+ if is_js_global_type gt then None else
605+ Some (of_wrapper mods x_opt name (set gt) [opd], [t])
597606
598- and of_arg mods arg =
607+ and of_argument mods arg =
599608 match arg.it with
600609 | LiteralArg lit -> of_literal lit
601610 | ActionArg act ->
0 commit comments