|
77 | 77 | (import "fail" "caml_failwith_tag" |
78 | 78 | (func $caml_failwith_tag (result (ref eq)))) |
79 | 79 | (import "stdlib" "caml_named_value" |
80 | | - (func $caml_named_value (param (ref $string)) (result (ref null eq)))) |
| 80 | + (func $caml_named_value (param (ref eq)) (result (ref null eq)))) |
81 | 81 | (import "obj" "caml_callback_1" |
82 | 82 | (func $caml_callback_1 |
83 | 83 | (param (ref eq)) (param (ref eq)) (result (ref eq)))) |
|
89 | 89 | (func $jsstring_of_string (param (ref $string)) (result anyref))) |
90 | 90 | (import "jsstring" "string_of_jsstring" |
91 | 91 | (func $string_of_jsstring (param anyref) (result (ref $string)))) |
| 92 | + (import "jsstring" "jsstring_of_substring" |
| 93 | + (func $jsstring_of_substring |
| 94 | + (param (ref $string) i32 i32) (result anyref))) |
92 | 95 | (import "int32" "caml_copy_int32" |
93 | 96 | (func $caml_copy_int32 (param i32) (result (ref eq)))) |
94 | 97 | (import "int32" "Int32_val" |
|
459 | 462 | (local.set $s (ref.cast (ref $string) (local.get 0))) |
460 | 463 | (return (struct.new $js (call $jsstring_of_string (local.get $s))))) |
461 | 464 |
|
| 465 | + (func (export "caml_jsstring_of_substring") |
| 466 | + (param $s (ref eq)) (param $i (ref eq)) (param $l (ref eq)) |
| 467 | + (result (ref eq)) |
| 468 | + (return |
| 469 | + (struct.new $js |
| 470 | + (call $jsstring_of_substring |
| 471 | + (ref.cast (ref $string) (local.get $s)) |
| 472 | + (i31.get_u (ref.cast (ref i31) (local.get $i))) |
| 473 | + (i31.get_u (ref.cast (ref i31) (local.get $l))))))) |
| 474 | + |
462 | 475 | (func $caml_jsbytes_of_string (export "caml_jsbytes_of_string") |
463 | 476 | (param (ref eq)) (result (ref eq)) |
464 | 477 | (local $s (ref $string)) |
|
0 commit comments