@@ -111,20 +111,20 @@ module Eval_const = struct
111111 (* TODO: binary+const instr *)
112112 let instr env stack instr =
113113 match instr.Annotated. raw with
114- | Binary. I32_const n -> ok @@ Stack. push_i32 stack n
115- | I64_const n -> ok @@ Stack. push_i64 stack n
116- | F32_const f -> ok @@ Stack. push_f32 stack f
117- | F64_const f -> ok @@ Stack. push_f64 stack f
118- | V128_const f -> ok @@ Stack. push_v128 stack f
119- | I_binop (nn , op ) -> ok @@ ibinop stack nn op
120- | Ref_null t -> ok @@ Stack. push_ref stack (Concrete_ref. null t)
114+ | Binary. I32_const n -> Result. ok @@ Stack. push_i32 stack n
115+ | I64_const n -> Result. ok @@ Stack. push_i64 stack n
116+ | F32_const f -> Result. ok @@ Stack. push_f32 stack f
117+ | F64_const f -> Result. ok @@ Stack. push_f64 stack f
118+ | V128_const f -> Result. ok @@ Stack. push_v128 stack f
119+ | I_binop (nn , op ) -> Result. ok @@ ibinop stack nn op
120+ | Ref_null t -> Result. ok @@ Stack. push_ref stack (Concrete_ref. null t)
121121 | Ref_func f ->
122122 let * f = Link_env.Build. get_func env f in
123123 let value = Concrete_value. Ref (Func (Some f)) in
124- ok @@ Stack. push stack value
124+ Result. ok @@ Stack. push stack value
125125 | Global_get id ->
126126 let * g = Link_env.Build. get_const_global env id in
127- ok @@ Stack. push stack g
127+ Result. ok @@ Stack. push stack g
128128 | _ -> assert false
129129
130130 (* TODO: binary+const expr *)
@@ -222,7 +222,7 @@ let load_memory (ls : 'f State.t)
222222let eval_memory ls (memory : (Binary.Mem.t, Binary.Mem.Type.limits) Origin.t ) :
223223 Concrete_memory. t Result. t =
224224 match memory with
225- | Local (_label , mem_type ) -> ok @@ Concrete_memory. init mem_type
225+ | Local (_label , mem_type ) -> Result. ok @@ Concrete_memory. init mem_type
226226 | Imported import -> load_memory ls import
227227
228228let eval_memories ls env memories =
@@ -255,7 +255,7 @@ let load_table (ls : 'f State.t) (import : Binary.Table.Type.t Origin.imported)
255255let eval_table ls (table : (Binary.Table.t, Binary.Table.Type.t) Origin.t ) :
256256 table Result. t =
257257 match table with
258- | Local { id = label ; typ; _ } -> ok @@ Concrete_table. init ?label typ
258+ | Local { id = label ; typ; _ } -> Result. ok @@ Concrete_table. init ?label typ
259259 | Imported import -> load_table ls import
260260
261261let eval_tables ls env tables =
@@ -294,7 +294,7 @@ let load_func (ls : 'f State.t) (import : Binary.block_type Origin.imported) :
294294
295295let eval_func ls (finished_env : int ) func : func Result.t =
296296 match func with
297- | Origin. Local func -> ok @@ Kind. wasm func finished_env
297+ | Origin. Local func -> Result. ok @@ Kind. wasm func finished_env
298298 | Imported import -> load_func ls import
299299
300300let eval_functions ls (finished_env : int ) env functions =
@@ -311,7 +311,7 @@ let eval_functions ls (finished_env : int) env functions =
311311let eval_tag ls (_finished_env : int )
312312 (tag : (Binary.Tag.t, Binary.block_type) Origin.t ) : Binary.Tag.t Result.t =
313313 match tag with
314- | Origin. Local tag -> ok tag
314+ | Origin. Local tag -> Ok tag
315315 | Imported import ->
316316 let (Binary. Bt_raw ((None | Some _), import_typ)) = import.typ in
317317 let * tag =
@@ -375,7 +375,7 @@ let define_data env data =
375375 let length = Int32. of_int @@ String. length data.init in
376376 let * offset = get_i32 offset in
377377 let * v = active_data_expr env ~offset ~length ~mem ~data: id in
378- ok @@ (v :: init)
378+ Result. ok @@ (v :: init)
379379 | Passive -> Ok init
380380 in
381381 (env, init, succ id) )
@@ -410,7 +410,8 @@ let define_elem env elem =
410410 let length = Int32. of_int @@ List. length init in
411411 let * offset = Eval_const. expr env offset in
412412 let * offset = get_i32 offset in
413- ok @@ (active_elem_expr ~offset ~length ~table ~elem: i :: inits)
413+ Result. ok
414+ @@ (active_elem_expr ~offset ~length ~table ~elem: i :: inits)
414415 | Passive | Declarative -> Ok inits
415416 in
416417 (env, inits, succ i) )
0 commit comments