@@ -1298,7 +1298,9 @@ export const enum StringMeasureOp {
1298
1298
/** string.is_usv_sequence */
1299
1299
IsUSV = 3 /* _BinaryenStringMeasureIsUSV */ ,
1300
1300
/** stringview_wtf16.length */
1301
- WTF16View = 4 /* _BinaryenStringMeasureWTF16View */
1301
+ WTF16View = 4 /* _BinaryenStringMeasureWTF16View */ ,
1302
+ /** string.hash */
1303
+ Hash = 5 /* TODO_BinaryenStringMeasureHash */
1302
1304
}
1303
1305
1304
1306
/** Binaryen StringEncode operation constants. */
@@ -1472,14 +1474,6 @@ export class Module {
1472
1474
return binaryen . _BinaryenRefEq ( this . ref , left , right ) ;
1473
1475
}
1474
1476
1475
- string_eq ( left : ExpressionRef , right : ExpressionRef ) : ExpressionRef {
1476
- return binaryen . _BinaryenStringEq ( this . ref , StringEqOp . Equal , left , right ) ;
1477
- }
1478
-
1479
- string_compare ( left : ExpressionRef , right : ExpressionRef ) : ExpressionRef {
1480
- return binaryen . _BinaryenStringEq ( this . ref , StringEqOp . Compare , left , right ) ;
1481
- }
1482
-
1483
1477
// expressions
1484
1478
1485
1479
unary (
@@ -2136,6 +2130,274 @@ export class Module {
2136
2130
return binaryen . _BinaryenI31Get ( this . ref , expr , signed ) ;
2137
2131
}
2138
2132
2133
+ // stringref
2134
+
2135
+ string_const (
2136
+ str : string
2137
+ ) : ExpressionRef {
2138
+ return binaryen . _BinaryenStringConst ( this . ref , this . allocStringCached ( str ) ) ;
2139
+ }
2140
+
2141
+ string_new_utf8 (
2142
+ ptr : ExpressionRef ,
2143
+ length : ExpressionRef ,
2144
+ memory : string = CommonNames . DefaultMemory // TODO
2145
+ ) : ExpressionRef {
2146
+ return binaryen . _BinaryenStringNew ( this . ref , StringNewOp . UTF8 , ptr , length , 0 , 0 , false ) ;
2147
+ }
2148
+
2149
+ string_new_utf8_array (
2150
+ arr : ExpressionRef ,
2151
+ start : ExpressionRef ,
2152
+ end : ExpressionRef
2153
+ ) : ExpressionRef {
2154
+ return binaryen . _BinaryenStringNew ( this . ref , StringNewOp . UTF8Array , arr , 0 , start , end , false ) ;
2155
+ }
2156
+
2157
+ string_new_lossy_utf8 (
2158
+ ptr : ExpressionRef ,
2159
+ length : ExpressionRef ,
2160
+ memory : string = CommonNames . DefaultMemory // TODO
2161
+ ) : ExpressionRef {
2162
+ return binaryen . _BinaryenStringNew ( this . ref , StringNewOp . Replace , ptr , length , 0 , 0 , false ) ;
2163
+ }
2164
+
2165
+ string_new_lossy_utf8_array (
2166
+ arr : ExpressionRef ,
2167
+ start : ExpressionRef ,
2168
+ end : ExpressionRef
2169
+ ) : ExpressionRef {
2170
+ return binaryen . _BinaryenStringNew ( this . ref , StringNewOp . ReplaceArray , arr , 0 , start , end , false ) ;
2171
+ }
2172
+
2173
+ string_new_wtf8 (
2174
+ ptr : ExpressionRef ,
2175
+ length : ExpressionRef ,
2176
+ memory : string = CommonNames . DefaultMemory // TODO
2177
+ ) : ExpressionRef {
2178
+ return binaryen . _BinaryenStringNew ( this . ref , StringNewOp . WTF8 , ptr , length , 0 , 0 , false ) ;
2179
+ }
2180
+
2181
+ string_new_wtf8_array (
2182
+ arr : ExpressionRef ,
2183
+ start : ExpressionRef ,
2184
+ end : ExpressionRef
2185
+ ) : ExpressionRef {
2186
+ return binaryen . _BinaryenStringNew ( this . ref , StringNewOp . WTF8Array , arr , 0 , start , end , false ) ;
2187
+ }
2188
+
2189
+ string_new_wtf16 (
2190
+ ptr : ExpressionRef ,
2191
+ length : ExpressionRef ,
2192
+ memory : string = CommonNames . DefaultMemory // TODO
2193
+ ) : ExpressionRef {
2194
+ return binaryen . _BinaryenStringNew ( this . ref , StringNewOp . WTF16 , ptr , length , 0 , 0 , false ) ;
2195
+ }
2196
+
2197
+ string_new_wtf16_array (
2198
+ arr : ExpressionRef ,
2199
+ start : ExpressionRef ,
2200
+ end : ExpressionRef
2201
+ ) : ExpressionRef {
2202
+ return binaryen . _BinaryenStringNew ( this . ref , StringNewOp . WTF16Array , arr , 0 , start , end , false ) ;
2203
+ }
2204
+
2205
+ string_from_code_point (
2206
+ codepoint : ExpressionRef
2207
+ ) : ExpressionRef {
2208
+ return binaryen . _BinaryenStringNew ( this . ref , StringNewOp . FromCodePoint , codepoint , 0 , 0 , 0 , false ) ;
2209
+ }
2210
+
2211
+ string_hash (
2212
+ str : ExpressionRef
2213
+ ) : ExpressionRef {
2214
+ return binaryen . _BinaryenStringMeasure ( this . ref , StringMeasureOp . Hash , str ) ;
2215
+ }
2216
+
2217
+ string_measure_utf8 (
2218
+ str : ExpressionRef
2219
+ ) : ExpressionRef {
2220
+ return binaryen . _BinaryenStringMeasure ( this . ref , StringMeasureOp . UTF8 , str ) ;
2221
+ }
2222
+
2223
+ string_measure_wtf8 (
2224
+ str : ExpressionRef
2225
+ ) : ExpressionRef {
2226
+ return binaryen . _BinaryenStringMeasure ( this . ref , StringMeasureOp . WTF8 , str ) ;
2227
+ }
2228
+
2229
+ string_measure_wtf16 (
2230
+ str : ExpressionRef
2231
+ ) : ExpressionRef {
2232
+ return binaryen . _BinaryenStringMeasure ( this . ref , StringMeasureOp . WTF16 , str ) ;
2233
+ }
2234
+
2235
+ string_is_usv_sequence (
2236
+ str : ExpressionRef
2237
+ ) : ExpressionRef {
2238
+ return binaryen . _BinaryenStringMeasure ( this . ref , StringMeasureOp . IsUSV , str ) ;
2239
+ }
2240
+
2241
+ string_encode_utf8 (
2242
+ str : ExpressionRef ,
2243
+ ptr : ExpressionRef ,
2244
+ memory : string = CommonNames . DefaultMemory // TODO
2245
+ ) : ExpressionRef {
2246
+ return binaryen . _BinaryenStringEncode ( this . ref , StringEncodeOp . UTF8 , str , ptr , 0 ) ;
2247
+ }
2248
+
2249
+ string_encode_utf8_array (
2250
+ str : ExpressionRef ,
2251
+ arr : ExpressionRef ,
2252
+ start : ExpressionRef
2253
+ ) : ExpressionRef {
2254
+ return binaryen . _BinaryenStringEncode ( this . ref , StringEncodeOp . UTF8Array , str , arr , start ) ;
2255
+ }
2256
+
2257
+ // TOOD: string_encode_lossy_utf8
2258
+ // TODO: string_encode_lossy_utf8_array
2259
+
2260
+ string_encode_wtf8 (
2261
+ str : ExpressionRef ,
2262
+ ptr : ExpressionRef ,
2263
+ memory : string = CommonNames . DefaultMemory // TODO
2264
+ ) : ExpressionRef {
2265
+ return binaryen . _BinaryenStringEncode ( this . ref , StringEncodeOp . WTF8 , str , ptr , 0 ) ;
2266
+ }
2267
+
2268
+ string_encode_wtf8_array (
2269
+ str : ExpressionRef ,
2270
+ arr : ExpressionRef ,
2271
+ start : ExpressionRef
2272
+ ) : ExpressionRef {
2273
+ return binaryen . _BinaryenStringEncode ( this . ref , StringEncodeOp . WTF8Array , str , arr , start ) ;
2274
+ }
2275
+
2276
+ string_encode_wtf16 (
2277
+ str : ExpressionRef ,
2278
+ ptr : ExpressionRef ,
2279
+ memory : string = CommonNames . DefaultMemory // TODO
2280
+ ) : ExpressionRef {
2281
+ return binaryen . _BinaryenStringEncode ( this . ref , StringEncodeOp . WTF16 , str , ptr , 0 ) ;
2282
+ }
2283
+
2284
+ string_encode_wtf16_array (
2285
+ str : ExpressionRef ,
2286
+ arr : ExpressionRef ,
2287
+ start : ExpressionRef
2288
+ ) : ExpressionRef {
2289
+ return binaryen . _BinaryenStringEncode ( this . ref , StringEncodeOp . WTF16Array , str , arr , start ) ;
2290
+ }
2291
+
2292
+ string_concat (
2293
+ left : ExpressionRef ,
2294
+ right : ExpressionRef
2295
+ ) : ExpressionRef {
2296
+ return binaryen . _BinaryenStringConcat ( this . ref , left , right ) ;
2297
+ }
2298
+
2299
+ string_eq (
2300
+ left : ExpressionRef ,
2301
+ right : ExpressionRef
2302
+ ) : ExpressionRef {
2303
+ return binaryen . _BinaryenStringEq ( this . ref , StringEqOp . Equal , left , right ) ;
2304
+ }
2305
+
2306
+ string_compare (
2307
+ left : ExpressionRef ,
2308
+ right : ExpressionRef
2309
+ ) : ExpressionRef {
2310
+ return binaryen . _BinaryenStringEq ( this . ref , StringEqOp . Compare , left , right ) ;
2311
+ }
2312
+
2313
+ string_as_wtf8 (
2314
+ str : ExpressionRef
2315
+ ) : ExpressionRef {
2316
+ return binaryen . _BinaryenStringAs ( this . ref , StringAsOp . WTF8 , str ) ;
2317
+ }
2318
+
2319
+ string_as_wtf16 (
2320
+ str : ExpressionRef
2321
+ ) : ExpressionRef {
2322
+ return binaryen . _BinaryenStringAs ( this . ref , StringAsOp . WTF16 , str ) ;
2323
+ }
2324
+
2325
+ string_as_iter (
2326
+ str : ExpressionRef
2327
+ ) : ExpressionRef {
2328
+ return binaryen . _BinaryenStringAs ( this . ref , StringAsOp . Iter , str ) ;
2329
+ }
2330
+
2331
+ stringview_wtf8_advance (
2332
+ view : ExpressionRef ,
2333
+ pos : ExpressionRef ,
2334
+ bytes : ExpressionRef
2335
+ ) : ExpressionRef {
2336
+ return binaryen . _BinaryenStringWTF8Advance ( this . ref , view , pos , bytes ) ;
2337
+ }
2338
+
2339
+ // TODO: stringview_wtf8_encode_utf8
2340
+ // TODO: stringview_wtf8_encode_lossy_utf8
2341
+ // TODO: stringview_wtf8_encode_wtf8
2342
+
2343
+ stringview_wtf8_slice (
2344
+ view : ExpressionRef ,
2345
+ start : ExpressionRef ,
2346
+ end : ExpressionRef
2347
+ ) : ExpressionRef {
2348
+ return binaryen . _BinaryenStringSliceWTF ( this . ref , StringSliceWTFOp . WTF8 , view , start , end ) ;
2349
+ }
2350
+
2351
+ stringview_wtf16_length (
2352
+ view : ExpressionRef
2353
+ ) : ExpressionRef {
2354
+ return binaryen . _BinaryenStringMeasure ( this . ref , StringMeasureOp . WTF16View , view ) ;
2355
+ }
2356
+
2357
+ stringview_wtf16_slice (
2358
+ view : ExpressionRef ,
2359
+ start : ExpressionRef ,
2360
+ end : ExpressionRef
2361
+ ) : ExpressionRef {
2362
+ return binaryen . _BinaryenStringSliceWTF ( this . ref , StringSliceWTFOp . WTF16 , view , start , end ) ;
2363
+ }
2364
+
2365
+ stringview_wtf16_get_codeunit (
2366
+ view : ExpressionRef ,
2367
+ pos : ExpressionRef
2368
+ ) : ExpressionRef {
2369
+ return binaryen . _BinaryenStringWTF16Get ( this . ref , view , pos ) ;
2370
+ }
2371
+
2372
+ // TODO: stringview_wtf16_encode
2373
+
2374
+ stringview_iter_next (
2375
+ view : ExpressionRef
2376
+ ) : ExpressionRef {
2377
+ return binaryen . _BinaryenStringIterNext ( this . ref , view ) ;
2378
+ }
2379
+
2380
+ stringview_iter_advance (
2381
+ view : ExpressionRef ,
2382
+ count : ExpressionRef
2383
+ ) : ExpressionRef {
2384
+ return binaryen . _BinaryenStringIterMove ( this . ref , StringIterMoveOp . Advance , view , count ) ;
2385
+ }
2386
+
2387
+ stringview_iter_rewind (
2388
+ view : ExpressionRef ,
2389
+ count : ExpressionRef
2390
+ ) : ExpressionRef {
2391
+ return binaryen . _BinaryenStringIterMove ( this . ref , StringIterMoveOp . Rewind , view , count ) ;
2392
+ }
2393
+
2394
+ stringview_iter_slice (
2395
+ view : ExpressionRef ,
2396
+ count : ExpressionRef
2397
+ ) : ExpressionRef {
2398
+ return binaryen . _BinaryenStringSliceIter ( this . ref , view , count ) ;
2399
+ }
2400
+
2139
2401
// globals
2140
2402
2141
2403
addGlobal (
0 commit comments