warpo 2.2.5-beta-1 → 2.3.0-alpha-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Environment definitions for compiling AssemblyScript to WebAssembly using asc.
3
3
  * @module std/assembly
4
- *//***/
4
+ */ /***/
5
5
 
6
6
  /// <reference no-default-lib="true"/>
7
7
 
@@ -187,7 +187,7 @@ declare function eq<T extends i32 | i64 | f32 | f64>(left: T, right: T): i32;
187
187
  declare function ne<T extends i32 | i64 | f32 | f64>(left: T, right: T): i32;
188
188
  /** Computes the remainder of two integers. */
189
189
  declare function rem<T extends i32 | i64>(left: T, right: T): T;
190
- /** Loads a value of the specified type from memory. Equivalent to dereferncing a pointer in other languages. */
190
+ /** Loads a value of the specified type from memory. Equivalent to dereferencing a pointer in other languages. */
191
191
  declare function load<T>(ptr: usize, immOffset?: usize, immAlign?: usize): T;
192
192
  /** Stores a value of the specified type to memory. Equivalent to dereferencing a pointer in other languages when assigning a value. */
193
193
  declare function store<T>(ptr: usize, value: T, immOffset?: usize, immAlign?: usize): void;
@@ -316,7 +316,7 @@ declare enum AtomicWaitResult {
316
316
  /** Loaded value did not match the expected value. */
317
317
  NOT_EQUAL,
318
318
  /** Not woken before the timeout expired. */
319
- TIMED_OUT
319
+ TIMED_OUT,
320
320
  }
321
321
 
322
322
  /** Converts any other numeric value to an 8-bit signed integer. */
@@ -612,7 +612,7 @@ declare namespace i64 {
612
612
  }
613
613
  }
614
614
  }
615
- /** Converts any other numeric value to a 32-bit (in WASM32) respectivel 64-bit (in WASM64) signed integer. */
615
+ /** Converts any other numeric value to a 32-bit (in WASM32) respectively 64-bit (in WASM64) signed integer. */
616
616
  declare let isize: typeof i32 | typeof i64;
617
617
  /** Converts any other numeric value to an 8-bit unsigned integer. */
618
618
  declare function u8(value: any): u8;
@@ -654,7 +654,7 @@ declare namespace u64 {
654
654
  /** Parses a string as an u64. */
655
655
  export function parse(value: string, radix?: i32): u64;
656
656
  }
657
- /** Converts any other numeric value to a 32-bit (in WASM32) respectivel 64-bit (in WASM64) unsigned integer. */
657
+ /** Converts any other numeric value to a 32-bit (in WASM32) respectively 64-bit (in WASM64) unsigned integer. */
658
658
  declare let usize: typeof u32 | typeof u64;
659
659
  /** Converts any other numeric value to a 1-bit unsigned integer. */
660
660
  declare function bool(value: any): bool;
@@ -787,7 +787,24 @@ declare namespace f64 {
787
787
  export function trunc(value: f64): f64;
788
788
  }
789
789
  /** Initializes a 128-bit vector from sixteen 8-bit integer values. Arguments must be compile-time constants. */
790
- declare function v128(a: i8, b: i8, c: i8, d: i8, e: i8, f: i8, g: i8, h: i8, i: i8, j: i8, k: i8, l: i8, m: i8, n: i8, o: i8, p: i8): v128;
790
+ declare function v128(
791
+ a: i8,
792
+ b: i8,
793
+ c: i8,
794
+ d: i8,
795
+ e: i8,
796
+ f: i8,
797
+ g: i8,
798
+ h: i8,
799
+ i: i8,
800
+ j: i8,
801
+ k: i8,
802
+ l: i8,
803
+ m: i8,
804
+ n: i8,
805
+ o: i8,
806
+ p: i8
807
+ ): v128;
791
808
  declare namespace v128 {
792
809
  /** Creates a vector with identical lanes. */
793
810
  export function splat<T>(x: T): v128;
@@ -955,7 +972,7 @@ declare namespace v128 {
955
972
  export function extmul_high<T extends i8 | u8 | i16 | u16 | i32 | u32>(a: v128, b: v128): v128;
956
973
  /**
957
974
  * Selects 8-bit lanes from `a` using indices in `s`. Indices in the range [0-15] select the i-th element of `a`.
958
- *
975
+ *
959
976
  * Unlike {@link v128.swizzle}, the result of an out of bounds index is implementation-defined, depending on hardware
960
977
  * capabilities: Either `0` or `a[s[i]%16]`.
961
978
  */
@@ -968,24 +985,24 @@ declare namespace v128 {
968
985
  * depending on hardware capabilities:
969
986
  * - If the input lane contains `NaN`, the result is either `0` or the respective maximum integer value.
970
987
  * - If the input lane contains a value otherwise out of bounds of the target type, the result is either the
971
- * saturatated result or maximum integer value.
988
+ * saturated result or maximum integer value.
972
989
  */
973
990
  export function relaxed_trunc<T extends i32 | u32>(a: v128): v128;
974
991
  /**
975
992
  * Truncates each lane of a vector from 64-bit floating point to a 32-bit signed or unsigned integer as indicated by
976
993
  * `T`. Unused higher integer lanes of the result are initialized to zero.
977
- *
994
+ *
978
995
  * Unlike {@link v128.trunc_sat_zero}, the result of lanes out of bounds of the target type is implementation defined,
979
996
  * depending on hardware capabilities:
980
997
  * - If the input lane contains `NaN`, the result is either `0` or the respective maximum integer value.
981
998
  * - If the input lane contains a value otherwise out of bounds of the target type, the result is either the
982
- * saturatated result or maximum integer value.
999
+ * saturated result or maximum integer value.
983
1000
  */
984
1001
  export function relaxed_trunc_zero<T extends i32 | u32>(a: v128): v128;
985
1002
  /**
986
1003
  * Performs the fused multiply-add operation (`a * b + c`) on 32- or 64-bit floating point lanes as indicated by
987
1004
  * `T`.
988
- *
1005
+ *
989
1006
  * The result is implementation defined, depending on hardware capabilities:
990
1007
  * - Either `a * b` is rounded once and the final result rounded again, or
991
1008
  * - The expression is evaluated with higher precision and only rounded once
@@ -994,7 +1011,7 @@ declare namespace v128 {
994
1011
  /**
995
1012
  * Performs the fused negative multiply-add operation (`-(a * b) + c`) on 32- or 64-bit floating point lanes as
996
1013
  * indicated by `T`.
997
- *
1014
+ *
998
1015
  * The result is implementation defined, depending on hardware capabilities:
999
1016
  * - Either `a * b` is rounded once and the final result rounded again, or
1000
1017
  * - The expression is evaluated with higher precision and only rounded once
@@ -1002,7 +1019,7 @@ declare namespace v128 {
1002
1019
  export function relaxed_nmadd<T>(a: v128, b: v128, c: v128): v128;
1003
1020
  /**
1004
1021
  * Selects 8-, 16-, 32- or 64-bit integer lanes as indicated by `T` from `a` or `b` based on masks in `m`.
1005
- *
1022
+ *
1006
1023
  * Behaves like {@link v128.bitselect} if masks in `m` do have all bits either set (result is `a[i]`) or unset (result
1007
1024
  * is `b[i]`). Otherwise the result is implementation-defined, depending on hardware capabilities: If the most
1008
1025
  * significant bit of `m` is set, the result is either `bitselect(a[i], b[i], mask)` or `a[i]`, otherwise the result
@@ -1011,28 +1028,28 @@ declare namespace v128 {
1011
1028
  export function relaxed_laneselect<T>(a: v128, b: v128, m: v128): v128;
1012
1029
  /**
1013
1030
  * Computes the minimum of each 32- or 64-bit floating point lane as indicated by `T`.
1014
- *
1031
+ *
1015
1032
  * Unlike {@link v128.min}, the result is implementation-defined if either value is `NaN` or both are `-0.0` and
1016
1033
  * `+0.0`, depending on hardware capabilities: Either `a[i]` or `b[i]`.
1017
1034
  */
1018
1035
  export function relaxed_min<T>(a: v128, b: v128): v128;
1019
1036
  /**
1020
1037
  * Computes the maximum of each 32- or 64-bit floating point lane as indicated by `T`.
1021
- *
1038
+ *
1022
1039
  * Unlike {@link v128.max}, the result is implementation-defined if either value is `NaN` or both are `-0.0` and
1023
1040
  * `+0.0`, depending on hardware capabilities: Either `a[i]` or `b[i]`.
1024
1041
  */
1025
1042
  export function relaxed_max<T>(a: v128, b: v128): v128;
1026
1043
  /**
1027
1044
  * Performs the lane-wise rounding multiplication in Q15 format (`(a[i] * b[i] + (1 << (Q - 1))) >> Q` where `Q=15`).
1028
- *
1045
+ *
1029
1046
  * Unlike {@link v128.q15mulr_sat}, the result is implementation-defined if both inputs are the minimum signed value:
1030
1047
  * Either the minimum or maximum signed value.
1031
1048
  */
1032
1049
  export function relaxed_q15mulr<T>(a: v128, b: v128): v128;
1033
1050
  /**
1034
1051
  * Computes the dot product of two 8-bit integer lanes each, yielding lanes one size wider than the input.
1035
- *
1052
+ *
1036
1053
  * Unlike {@link v128.dot}, if the most significant bit of `b[i]` is set, whether `b[i]` is interpreted as signed or
1037
1054
  * unsigned is implementation-defined.
1038
1055
  */
@@ -1040,14 +1057,31 @@ declare namespace v128 {
1040
1057
  /**
1041
1058
  * Computes the dot product of two 8-bit integer lanes each, yielding lanes two sizes wider than the input with the
1042
1059
  * lanes of `c` accumulated into the result.
1043
- *
1060
+ *
1044
1061
  * Unlike {@link v128.dot}, if the most significant bit of `b[i]` is set, whether `b[i]` is interpreted as signed or
1045
1062
  * unsigned by the intermediate multiplication is implementation-defined.
1046
1063
  */
1047
1064
  export function relaxed_dot_add<T>(a: v128, b: v128, c: v128): v128;
1048
1065
  }
1049
1066
  /** Initializes a 128-bit vector from sixteen 8-bit integer values. Arguments must be compile-time constants. */
1050
- declare function i8x16(a: i8, b: i8, c: i8, d: i8, e: i8, f: i8, g: i8, h: i8, i: i8, j: i8, k: i8, l: i8, m: i8, n: i8, o: i8, p: i8): v128;
1067
+ declare function i8x16(
1068
+ a: i8,
1069
+ b: i8,
1070
+ c: i8,
1071
+ d: i8,
1072
+ e: i8,
1073
+ f: i8,
1074
+ g: i8,
1075
+ h: i8,
1076
+ i: i8,
1077
+ j: i8,
1078
+ k: i8,
1079
+ l: i8,
1080
+ m: i8,
1081
+ n: i8,
1082
+ o: i8,
1083
+ p: i8
1084
+ ): v128;
1051
1085
  declare namespace i8x16 {
1052
1086
  /** Creates a vector with sixteen identical 8-bit integer lanes. */
1053
1087
  export function splat(x: i8): v128;
@@ -1120,20 +1154,39 @@ declare namespace i8x16 {
1120
1154
  /** Narrows each 16-bit signed integer lane to 8-bit unsigned integer lanes. */
1121
1155
  export function narrow_i16x8_u(a: v128, b: v128): v128;
1122
1156
  /** Selects 8-bit lanes from either vector according to the specified [0-15] respectively [16-31] lane indexes. */
1123
- export function shuffle(a: v128, b: v128, l0: u8, l1: u8, l2: u8, l3: u8, l4: u8, l5: u8, l6: u8, l7: u8, l8: u8, l9: u8, l10: u8, l11: u8, l12: u8, l13: u8, l14: u8, l15: u8): v128;
1157
+ export function shuffle(
1158
+ a: v128,
1159
+ b: v128,
1160
+ l0: u8,
1161
+ l1: u8,
1162
+ l2: u8,
1163
+ l3: u8,
1164
+ l4: u8,
1165
+ l5: u8,
1166
+ l6: u8,
1167
+ l7: u8,
1168
+ l8: u8,
1169
+ l9: u8,
1170
+ l10: u8,
1171
+ l11: u8,
1172
+ l12: u8,
1173
+ l13: u8,
1174
+ l14: u8,
1175
+ l15: u8
1176
+ ): v128;
1124
1177
  /** Selects 8-bit lanes from the first vector according to the indexes [0-15] specified by the 8-bit lanes of the second vector. */
1125
1178
  export function swizzle(a: v128, s: v128): v128;
1126
1179
  /**
1127
1180
  * Selects 8-bit integer lanes from `a` using indices in `s`. Indices in the range [0-15] select the i-th element of
1128
1181
  * `a`.
1129
- *
1182
+ *
1130
1183
  * Unlike {@link i8x16.swizzle}, the result of an out of bounds index is implementation-defined, depending on hardware
1131
1184
  * capabilities: Either `0` or `a[s[i]%16]`.
1132
1185
  */
1133
1186
  export function relaxed_swizzle(a: v128, s: v128): v128;
1134
1187
  /**
1135
1188
  * Selects 8-bit integer lanes from `a` or `b` based on masks in `m`.
1136
- *
1189
+ *
1137
1190
  * Behaves like {@link v128.bitselect} if masks in `m` do have all bits either set (result is `a[i]`) or unset (result
1138
1191
  * is `b[i]`). Otherwise the result is implementation-defined, depending on hardware capabilities: If the most
1139
1192
  * significant bit of `m` is set, the result is either `bitselect(a[i], b[i], mask)` or `a[i]`, otherwise the result
@@ -1256,7 +1309,7 @@ declare namespace i16x8 {
1256
1309
  export function relaxed_q15mulr_s(a: v128, b: v128): v128;
1257
1310
  /**
1258
1311
  * Computes the dot product of two 8-bit integer lanes each, yielding lanes one size wider than the input.
1259
- *
1312
+ *
1260
1313
  * Some results are implementation-defined: If the most significant bit of `b[i]` is set, the intermediate
1261
1314
  * multiplication may interpret `b[i]` as either signed or unsigned.
1262
1315
  */
@@ -1358,7 +1411,7 @@ declare namespace i32x4 {
1358
1411
  * defined, depending on hardware capabilities:
1359
1412
  * - If the input lane contains `NaN`, the result is either `0` or the respective maximum integer value.
1360
1413
  * - If the input lane contains a value otherwise out of bounds of the target type, the result is either the
1361
- * saturatated result or maximum integer value.
1414
+ * saturated result or maximum integer value.
1362
1415
  */
1363
1416
  export function relaxed_trunc_f32x4_s(a: v128): v128;
1364
1417
  /**
@@ -1368,29 +1421,29 @@ declare namespace i32x4 {
1368
1421
  * defined, depending on hardware capabilities:
1369
1422
  * - If the input lane contains `NaN`, the result is either `0` or the respective maximum integer value.
1370
1423
  * - If the input lane contains a value otherwise out of bounds of the target type, the result is either the
1371
- * saturatated result or maximum integer value.
1424
+ * saturated result or maximum integer value.
1372
1425
  */
1373
1426
  export function relaxed_trunc_f32x4_u(a: v128): v128;
1374
1427
  /**
1375
1428
  * Truncates each lane of a vector from 64-bit floating point to a signed 32-bit integer. The two higher
1376
1429
  * integer lanes of the result are initialized to zero.
1377
- *
1430
+ *
1378
1431
  * Unlike {@link i32x4.trunc_sat_f64x2_s_zero}, the result of lanes out of bounds of the target type is implementation
1379
1432
  * defined, depending on hardware capabilities:
1380
1433
  * - If the input lane contains `NaN`, the result is either `0` or the respective maximum integer value.
1381
1434
  * - If the input lane contains a value otherwise out of bounds of the target type, the result is either the
1382
- * saturatated result or maximum integer value.
1435
+ * saturated result or maximum integer value.
1383
1436
  */
1384
1437
  export function relaxed_trunc_f64x2_s_zero(a: v128): v128;
1385
1438
  /**
1386
1439
  * Truncates each lane of a vector from 64-bit floating point to an unsigned 32-bit integer. The two higher
1387
1440
  * integer lanes of the result are initialized to zero.
1388
- *
1441
+ *
1389
1442
  * Unlike {@link i32x4.trunc_sat_f64x2_u_zero}, the result of lanes out of bounds of the target type is implementation
1390
1443
  * defined, depending on hardware capabilities:
1391
1444
  * - If the input lane contains `NaN`, the result is either `0` or the respective maximum integer value.
1392
1445
  * - If the input lane contains a value otherwise out of bounds of the target type, the result is either the
1393
- * saturatated result or maximum integer value.
1446
+ * saturated result or maximum integer value.
1394
1447
  */
1395
1448
  export function relaxed_trunc_f64x2_u_zero(a: v128): v128;
1396
1449
  /**
@@ -1405,7 +1458,7 @@ declare namespace i32x4 {
1405
1458
  /**
1406
1459
  * Computes the dot product of two 8-bit lanes each, yielding lanes two sizes wider than the input with the lanes of
1407
1460
  * `c` accumulated into the result.
1408
- *
1461
+ *
1409
1462
  * Unlike {@link v128.dot}, if the most significant bit of `b[i]` is set, whether `b[i]` is interpreted as signed or
1410
1463
  * unsigned by the intermediate multiplication is implementation-defined.
1411
1464
  */
@@ -1541,7 +1594,7 @@ declare namespace f32x4 {
1541
1594
  export function shuffle(a: v128, b: v128, l0: u8, l1: u8, l2: u8, l3: u8): v128;
1542
1595
  /**
1543
1596
  * Performs the fused multiply-add operation (`a * b + c`) on all 32-bit floating point lanes.
1544
- *
1597
+ *
1545
1598
  * The result is implementation defined, depending on hardware capabilities:
1546
1599
  * - Either `a * b` is rounded once and the final result rounded again, or
1547
1600
  * - The expression is evaluated with higher precision and only rounded once
@@ -1549,7 +1602,7 @@ declare namespace f32x4 {
1549
1602
  export function relaxed_madd(a: v128, b: v128, c: v128): v128;
1550
1603
  /**
1551
1604
  * Performs the fused negative multiply-add operation (`-(a * b) + c`) on all 32-bit floating point lanes.
1552
- *
1605
+ *
1553
1606
  * The result is implementation defined, depending on hardware capabilities:
1554
1607
  * - Either `a * b` is rounded once and the final result rounded again, or
1555
1608
  * - The expression is evaluated with higher precision and only rounded once
@@ -1557,14 +1610,14 @@ declare namespace f32x4 {
1557
1610
  export function relaxed_nmadd(a: v128, b: v128, c: v128): v128;
1558
1611
  /**
1559
1612
  * Computes the minimum of each 32-bit floating point lane.
1560
- *
1613
+ *
1561
1614
  * Unlike {@link f32x4.min}, the result is implementation-defined if either value is `NaN`, `-0.0` or `+0.0`,
1562
1615
  * depending on hardware capabilities: Either `a[i]` or `b[i]`.
1563
1616
  */
1564
1617
  export function relaxed_min(a: v128, b: v128): v128;
1565
1618
  /**
1566
1619
  * Computes the maximum of each 32-bit floating point lane.
1567
- *
1620
+ *
1568
1621
  * Unlike {@link f32x4.max}, the result is implementation-defined if either value is `NaN`, `-0.0` or `+0.0`,
1569
1622
  * depending on hardware capabilities: Either `a[i]` or `b[i]`.
1570
1623
  */
@@ -1631,7 +1684,7 @@ declare namespace f64x2 {
1631
1684
  export function shuffle(a: v128, b: v128, l0: u8, l1: u8): v128;
1632
1685
  /**
1633
1686
  * Performs the fused multiply-add operation (`a * b + c`) on all 64-bit floating point lanes.
1634
- *
1687
+ *
1635
1688
  * The result is implementation defined, depending on hardware capabilities:
1636
1689
  * - Either `a * b` is rounded once and the final result rounded again, or
1637
1690
  * - The expression is evaluated with higher precision and only rounded once
@@ -1639,7 +1692,7 @@ declare namespace f64x2 {
1639
1692
  export function relaxed_madd(a: v128, b: v128, c: v128): v128;
1640
1693
  /**
1641
1694
  * Performs the fused negative multiply-add operation (`-(a * b) + c`) on all 64-bit floating point lanes.
1642
- *
1695
+ *
1643
1696
  * The result is implementation defined, depending on hardware capabilities:
1644
1697
  * - Either `a * b` is rounded once and the final result rounded again, or
1645
1698
  * - The expression is evaluated with higher precision and only rounded once
@@ -1647,14 +1700,14 @@ declare namespace f64x2 {
1647
1700
  export function relaxed_nmadd(a: v128, b: v128, c: v128): v128;
1648
1701
  /**
1649
1702
  * Computes the minimum of each 64-bit floating point lane.
1650
- *
1703
+ *
1651
1704
  * Unlike {@link f64x2.min}, the result is implementation-defined if either value is `NaN`, `-0.0` or `+0.0`,
1652
1705
  * depending on hardware capabilities: Either `a[i]` or `b[i]`.
1653
1706
  */
1654
1707
  export function relaxed_min(a: v128, b: v128): v128;
1655
1708
  /**
1656
1709
  * Computes the maximum of each 64-bit floating point lane.
1657
- *
1710
+ *
1658
1711
  * Unlike {@link f64x2.max}, the result is implementation-defined if either value is `NaN`, `-0.0` or `+0.0`,
1659
1712
  * depending on hardware capabilities: Either `a[i]` or `b[i]`.
1660
1713
  */
@@ -1829,16 +1882,57 @@ declare namespace table {
1829
1882
 
1830
1883
  declare namespace Atomics {
1831
1884
  export function load<T extends i8 | u8 | i16 | u16 | i32 | u32 | i64 | u64>(array: TypedArray<T>, index: i32): T;
1832
- export function store<T extends i8 | u8 | i16 | u16 | i32 | u32 | i64 | u64>(array: TypedArray<T>, index: i32, value: T): void;
1833
- export function add<T extends i8 | u8 | i16 | u16 | i32 | u32 | i64 | u64>(array: TypedArray<T>, index: i32, value: T): T;
1834
- export function sub<T extends i8 | u8 | i16 | u16 | i32 | u32 | i64 | u64>(array: TypedArray<T>, index: i32, value: T): T;
1835
- export function and<T extends i8 | u8 | i16 | u16 | i32 | u32 | i64 | u64>(array: TypedArray<T>, index: i32, value: T): T;
1836
- export function or<T extends i8 | u8 | i16 | u16 | i32 | u32 | i64 | u64>(array: TypedArray<T>, index: i32, value: T): T;
1837
- export function xor<T extends i8 | u8 | i16 | u16 | i32 | u32 | i64 | u64>(array: TypedArray<T>, index: i32, value: T): T;
1838
- export function exchange<T extends i8 | u8 | i16 | u16 | i32 | u32 | i64 | u64>(array: TypedArray<T>, index: i32, value: T): T;
1839
- export function compareExchange<T extends i8 | u8 | i16 | u16 | i32 | u32 | i64 | u64>(array: TypedArray<T>, index: i32, expectedValue: T, replacementValue: T): T;
1840
- export function wait<T extends i8 | u8 | i16 | u16 | i32 | u32 | i64 | u64>(array: TypedArray<T>, value: T, timeout?: i64): AtomicWaitResult;
1841
- export function notify<T extends i8 | u8 | i16 | u16 | i32 | u32 | i64 | u64>(array: TypedArray<T>, index: i32, count?: i32): i32;
1885
+ export function store<T extends i8 | u8 | i16 | u16 | i32 | u32 | i64 | u64>(
1886
+ array: TypedArray<T>,
1887
+ index: i32,
1888
+ value: T
1889
+ ): void;
1890
+ export function add<T extends i8 | u8 | i16 | u16 | i32 | u32 | i64 | u64>(
1891
+ array: TypedArray<T>,
1892
+ index: i32,
1893
+ value: T
1894
+ ): T;
1895
+ export function sub<T extends i8 | u8 | i16 | u16 | i32 | u32 | i64 | u64>(
1896
+ array: TypedArray<T>,
1897
+ index: i32,
1898
+ value: T
1899
+ ): T;
1900
+ export function and<T extends i8 | u8 | i16 | u16 | i32 | u32 | i64 | u64>(
1901
+ array: TypedArray<T>,
1902
+ index: i32,
1903
+ value: T
1904
+ ): T;
1905
+ export function or<T extends i8 | u8 | i16 | u16 | i32 | u32 | i64 | u64>(
1906
+ array: TypedArray<T>,
1907
+ index: i32,
1908
+ value: T
1909
+ ): T;
1910
+ export function xor<T extends i8 | u8 | i16 | u16 | i32 | u32 | i64 | u64>(
1911
+ array: TypedArray<T>,
1912
+ index: i32,
1913
+ value: T
1914
+ ): T;
1915
+ export function exchange<T extends i8 | u8 | i16 | u16 | i32 | u32 | i64 | u64>(
1916
+ array: TypedArray<T>,
1917
+ index: i32,
1918
+ value: T
1919
+ ): T;
1920
+ export function compareExchange<T extends i8 | u8 | i16 | u16 | i32 | u32 | i64 | u64>(
1921
+ array: TypedArray<T>,
1922
+ index: i32,
1923
+ expectedValue: T,
1924
+ replacementValue: T
1925
+ ): T;
1926
+ export function wait<T extends i8 | u8 | i16 | u16 | i32 | u32 | i64 | u64>(
1927
+ array: TypedArray<T>,
1928
+ value: T,
1929
+ timeout?: i64
1930
+ ): AtomicWaitResult;
1931
+ export function notify<T extends i8 | u8 | i16 | u16 | i32 | u32 | i64 | u64>(
1932
+ array: TypedArray<T>,
1933
+ index: i32,
1934
+ count?: i32
1935
+ ): i32;
1842
1936
  /** The static Atomics.isLockFree() method is used to determine whether to use locks or atomic operations. It returns true, if the given size is one of the BYTES_PER_ELEMENT */
1843
1937
  export function isLockFree(size: usize): bool;
1844
1938
  }
@@ -1988,7 +2082,7 @@ declare abstract class TypedArray<T> implements ArrayBufferView {
1988
2082
  /** The join() method joins all elements of an array into a string. This method has the same algorithm as Array.prototype.join(). */
1989
2083
  join(separator?: string): string;
1990
2084
  /** The set() method stores multiple values in the typed array, reading input values from a specified array. */
1991
- set<U extends ArrayLike<number>>(source: U, offset?: i32): void
2085
+ set<U extends ArrayLike<number>>(source: U, offset?: i32): void;
1992
2086
  /** The toString() method returns a string representing the specified array and its elements. This method has the same algorithm as Array.prototype.toString() */
1993
2087
  toString(): string;
1994
2088
  }
@@ -2051,11 +2145,11 @@ declare class Float64Array extends TypedArray<f64> {
2051
2145
 
2052
2146
  /** Class representing a sequence of values of type `T`. */
2053
2147
  declare class Array<T> {
2054
-
2055
2148
  /** Tests if a value is an array. */
2056
2149
  static isArray<U>(value: any): value is Array<any>;
2057
2150
 
2058
2151
  [key: number]: T;
2152
+ [Symbol.iterator](): Iterator<T>;
2059
2153
  /** Current length of the array. */
2060
2154
  length: i32;
2061
2155
  /** Returns raw pointer to data storage (unsafe). */
@@ -2076,8 +2170,14 @@ declare class Array<T> {
2076
2170
  forEach(callbackfn: (value: T, index: i32, array: Array<T>) => void): void;
2077
2171
  map<U>(callbackfn: (value: T, index: i32, array: Array<T>) => U): Array<U>;
2078
2172
  filter(callbackfn: (value: T, index: i32, array: Array<T>) => bool): Array<T>;
2079
- reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: i32, array: Array<T>) => U, initialValue: U): U;
2080
- reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: i32, array: Array<T>) => U, initialValue: U): U;
2173
+ reduce<U>(
2174
+ callbackfn: (previousValue: U, currentValue: T, currentIndex: i32, array: Array<T>) => U,
2175
+ initialValue: U
2176
+ ): U;
2177
+ reduceRight<U>(
2178
+ callbackfn: (previousValue: U, currentValue: T, currentIndex: i32, array: Array<T>) => U,
2179
+ initialValue: U
2180
+ ): U;
2081
2181
  every(callbackfn: (value: T, index: i32, array: Array<T>) => bool): bool;
2082
2182
  some(callbackfn: (value: T, index: i32, array: Array<T>) => bool): bool;
2083
2183
  shift(): T;
@@ -2113,8 +2213,14 @@ declare class StaticArray<T> {
2113
2213
  forEach(callbackfn: (value: T, index: i32, array: StaticArray<T>) => void): void;
2114
2214
  map<U>(callbackfn: (value: T, index: i32, array: StaticArray<T>) => U): Array<U>;
2115
2215
  filter(callbackfn: (value: T, index: i32, array: StaticArray<T>) => bool): Array<T>;
2116
- reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: i32, array: StaticArray<T>) => U, initialValue: U): U;
2117
- reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: i32, array: StaticArray<T>) => U, initialValue: U): U;
2216
+ reduce<U>(
2217
+ callbackfn: (previousValue: U, currentValue: T, currentIndex: i32, array: StaticArray<T>) => U,
2218
+ initialValue: U
2219
+ ): U;
2220
+ reduceRight<U>(
2221
+ callbackfn: (previousValue: U, currentValue: T, currentIndex: i32, array: StaticArray<T>) => U,
2222
+ initialValue: U
2223
+ ): U;
2118
2224
  every(callbackfn: (value: T, index: i32, array: StaticArray<T>) => bool): bool;
2119
2225
  some(callbackfn: (value: T, index: i32, array: StaticArray<T>) => bool): bool;
2120
2226
  concat(items: Array<T>): Array<T>;
@@ -2176,13 +2282,13 @@ declare namespace String {
2176
2282
  /** Replaces unpaired surrogates with the replacement character (U+FFFD). */
2177
2283
  REPLACE,
2178
2284
  /** Throws an error on unpaired surrogates. */
2179
- ERROR
2285
+ ERROR,
2180
2286
  }
2181
2287
  /** Calculates the byte length of the specified string when encoded as UTF-8, optionally null terminated. */
2182
2288
  export function byteLength(str: string, nullTerminated?: bool): i32;
2183
2289
  /** Encodes the specified string to UTF-8 bytes, optionally null terminated. ErrorMode defaults to WTF-8. */
2184
2290
  export function encode(str: string, nullTerminated?: bool, errorMode?: ErrorMode): ArrayBuffer;
2185
- /** Encodes the specified raw string to UTF-8 bytes, opionally null terminated. ErrorMode defaults to WTF-8. Returns the number of bytes written. */
2291
+ /** Encodes the specified raw string to UTF-8 bytes, optionally null terminated. ErrorMode defaults to WTF-8. Returns the number of bytes written. */
2186
2292
  export function encodeUnsafe(str: usize, len: i32, buf: usize, nullTerminated?: bool, errorMode?: ErrorMode): usize;
2187
2293
  /** Decodes the specified buffer from UTF-8 bytes to a string, optionally null terminated. */
2188
2294
  export function decode(buf: ArrayBuffer, nullTerminated?: bool): string;
@@ -2220,15 +2326,7 @@ declare namespace performance {
2220
2326
 
2221
2327
  declare class Date {
2222
2328
  /** Returns the UTC timestamp in milliseconds of the specified date. */
2223
- static UTC(
2224
- year: i32,
2225
- month: i32,
2226
- day: i32,
2227
- hour: i32,
2228
- minute: i32,
2229
- second: i32,
2230
- millisecond: i32
2231
- ): i64;
2329
+ static UTC(year: i32, month: i32, day: i32, hour: i32, minute: i32, second: i32, millisecond: i32): i64;
2232
2330
  /** Returns the current UTC timestamp in milliseconds. */
2233
2331
  static now(): i64;
2234
2332
  /** Parses a string representation of a date, and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC. */
@@ -2267,7 +2365,6 @@ declare class Date {
2267
2365
 
2268
2366
  /** Class for representing a runtime error. Base class of all errors. */
2269
2367
  declare class Error {
2270
-
2271
2368
  /** Error name. */
2272
2369
  name: string;
2273
2370
 
@@ -2285,16 +2382,16 @@ declare class Error {
2285
2382
  }
2286
2383
 
2287
2384
  /** Class for indicating an error when a value is not in the set or range of allowed values. */
2288
- declare class RangeError extends Error { }
2385
+ declare class RangeError extends Error {}
2289
2386
 
2290
2387
  /** Class for indicating an error when a value is not of the expected type. */
2291
- declare class TypeError extends Error { }
2388
+ declare class TypeError extends Error {}
2292
2389
 
2293
2390
  /** Class for indicating an error when trying to interpret syntactically invalid code. */
2294
- declare class SyntaxError extends Error { }
2391
+ declare class SyntaxError extends Error {}
2295
2392
 
2296
2393
  /** Class for indicating an error when a global URI handling function was used in a wrong way. */
2297
- declare class URIError extends Error { }
2394
+ declare class URIError extends Error {}
2298
2395
 
2299
2396
  interface Function {
2300
2397
  /** Function table index. */
@@ -2317,7 +2414,8 @@ type ThisParameterType<T> = T extends (this: infer U, ...args: never) => any ? U
2317
2414
  /**
2318
2415
  * Removes the 'this' parameter from a function type.
2319
2416
  */
2320
- type OmitThisParameter<T> = unknown extends ThisParameterType<T> ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T;
2417
+ type OmitThisParameter<T> =
2418
+ unknown extends ThisParameterType<T> ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T;
2321
2419
 
2322
2420
  interface CallableFunction extends Function {
2323
2421
  /**
@@ -2353,7 +2451,11 @@ interface CallableFunction extends Function {
2353
2451
  * @param thisArg The object to be used as the this object.
2354
2452
  * @param args Arguments to bind to the parameters of the function.
2355
2453
  */
2356
- bind<T, A extends any[], B extends any[], R>(this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R;
2454
+ bind<T, A extends any[], B extends any[], R>(
2455
+ this: (this: T, ...args: [...A, ...B]) => R,
2456
+ thisArg: T,
2457
+ ...args: A
2458
+ ): (...args: B) => R;
2357
2459
  }
2358
2460
 
2359
2461
  interface NewableFunction extends Function {
@@ -2389,13 +2491,17 @@ interface NewableFunction extends Function {
2389
2491
  * @param thisArg The object to be used as the this object.
2390
2492
  * @param args Arguments to bind to the parameters of the function.
2391
2493
  */
2392
- bind<A extends any[], B extends any[], R>(this: new (...args: [...A, ...B]) => R, thisArg: any, ...args: A): new (...args: B) => R;
2494
+ bind<A extends any[], B extends any[], R>(
2495
+ this: new (...args: [...A, ...B]) => R,
2496
+ thisArg: any,
2497
+ ...args: A
2498
+ ): new (...args: B) => R;
2393
2499
  }
2394
2500
 
2395
2501
  interface IArguments {}
2396
2502
  interface RegExp {}
2397
2503
 
2398
- declare class Map<K,V> {
2504
+ declare class Map<K, V> {
2399
2505
  readonly size: i32;
2400
2506
  has(key: K): bool;
2401
2507
  set(key: K, value: V): this;
@@ -2415,28 +2521,38 @@ declare class Set<K> {
2415
2521
  clear(): void;
2416
2522
  values(): K[]; // preliminary
2417
2523
  toString(): string;
2524
+ [Symbol.iterator](): Iterator<K>;
2418
2525
  }
2419
2526
 
2420
- interface SymbolConstructor {
2421
- readonly hasInstance: symbol;
2422
- readonly isConcatSpreadable: symbol;
2423
- readonly isRegExp: symbol;
2424
- readonly iterator: symbol;
2425
- readonly match: symbol;
2426
- readonly replace: symbol;
2427
- readonly search: symbol;
2428
- readonly species: symbol;
2429
- readonly split: symbol;
2430
- readonly toPrimitive: symbol;
2431
- readonly toStringTag: symbol;
2432
- readonly unscopables: symbol;
2527
+ declare interface SymbolConstructor {
2433
2528
  (description?: string | null): symbol;
2529
+ readonly iterator: symbol;
2434
2530
  for(key: string): symbol;
2435
2531
  keyFor(sym: symbol): string | null;
2436
2532
  }
2437
-
2438
2533
  declare const Symbol: SymbolConstructor;
2439
2534
 
2535
+ interface Symbol {
2536
+ /** Returns a string representation of an object. */
2537
+ toString(): string;
2538
+ }
2539
+
2540
+ declare class IteratorResult<T> {
2541
+ private constructor(value: T);
2542
+ get done(): boolean;
2543
+ get value(): T;
2544
+ static done<T>(): IteratorResult<T>;
2545
+ static fromValue<T>(value: T): IteratorResult<T>;
2546
+ }
2547
+
2548
+ interface Iterator<T> {
2549
+ next(): IteratorResult<T>;
2550
+ }
2551
+
2552
+ interface Iterable<T> {
2553
+ [Symbol.iterator](): Iterator<T>;
2554
+ }
2555
+
2440
2556
  /** @internal */
2441
2557
  interface IMath<T> {
2442
2558
  /** The base of natural logarithms, e, approximately 2.718. */
@@ -2576,7 +2692,7 @@ declare namespace process {
2576
2692
  /** Array of command line arguments passed to the binary upon instantiation. */
2577
2693
  export const argv: string[];
2578
2694
  /** Map of variables in the binary's user environment. */
2579
- export const env: Map<string,string>;
2695
+ export const env: Map<string, string>;
2580
2696
  /** Terminates the process with either the given exit code, or `process.exitCode` if omitted. */
2581
2697
  export function exit(code?: i32): void;
2582
2698
  /** `exit()`’s default value. Defaults to `0`. */
@@ -2645,38 +2761,78 @@ interface TypedPropertyDescriptor<T> {
2645
2761
  set?(value: T): void;
2646
2762
  }
2647
2763
 
2648
- type Constructor =
2649
- (new (...args: any[]) => unknown)
2650
- | (abstract new (...args: any[]) => unknown);
2764
+ type Constructor = (new (...args: any[]) => unknown) | (abstract new (...args: any[]) => unknown);
2651
2765
 
2652
2766
  /** Annotates a method as a binary operator overload for the specified `token`. */
2653
- declare function operator(token:
2654
- "[]" | "[]=" | "{}" | "{}=" | "==" | "!=" | ">" | "<" | "<=" | ">=" |
2655
- ">>" | ">>>" | "<<" | "&" | "|" | "^" | "+" | "-" | "*" | "**" | "/" | "%"
2656
- ): (
2657
- target: any,
2658
- propertyKey: string,
2659
- descriptor: TypedPropertyDescriptor<any>
2660
- ) => TypedPropertyDescriptor<any> | void;
2767
+ declare function operator(
2768
+ token:
2769
+ | "[]"
2770
+ | "[]="
2771
+ | "{}"
2772
+ | "{}="
2773
+ | "=="
2774
+ | "!="
2775
+ | ">"
2776
+ | "<"
2777
+ | "<="
2778
+ | ">="
2779
+ | ">>"
2780
+ | ">>>"
2781
+ | "<<"
2782
+ | "&"
2783
+ | "|"
2784
+ | "^"
2785
+ | "+"
2786
+ | "-"
2787
+ | "*"
2788
+ | "**"
2789
+ | "/"
2790
+ | "%"
2791
+ ): (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<any>) => TypedPropertyDescriptor<any> | void;
2661
2792
 
2662
2793
  declare namespace operator {
2663
2794
  /** Annotates a method as a binary operator overload for the specified `token`. */
2664
- export function binary(token:
2665
- "[]" | "[]=" | "{}" | "{}=" | "==" | "!=" | ">" | "<" | "<=" | ">=" |
2666
- ">>" | ">>>" | "<<" | "&" | "|" | "^" | "+" | "-" | "*" | "**" | "/" | "%"
2795
+ export function binary(
2796
+ token:
2797
+ | "[]"
2798
+ | "[]="
2799
+ | "{}"
2800
+ | "{}="
2801
+ | "=="
2802
+ | "!="
2803
+ | ">"
2804
+ | "<"
2805
+ | "<="
2806
+ | ">="
2807
+ | ">>"
2808
+ | ">>>"
2809
+ | "<<"
2810
+ | "&"
2811
+ | "|"
2812
+ | "^"
2813
+ | "+"
2814
+ | "-"
2815
+ | "*"
2816
+ | "**"
2817
+ | "/"
2818
+ | "%"
2667
2819
  ): (
2668
2820
  target: any,
2669
2821
  propertyKey: string,
2670
2822
  descriptor: TypedPropertyDescriptor<any>
2671
2823
  ) => TypedPropertyDescriptor<any> | void;
2672
2824
  /** Annotates a method as an unary prefix operator overload for the specified `token`. */
2673
- export function prefix(token: "!" | "~" | "+" | "-" | "++" | "--"): (
2825
+ export function prefix(
2826
+ token: "!" | "~" | "+" | "-" | "++" | "--"
2827
+ ): (
2674
2828
  target: any,
2675
2829
  propertyKey: string,
2676
2830
  descriptor: TypedPropertyDescriptor<any>
2677
2831
  ) => TypedPropertyDescriptor<any> | void;
2678
2832
  /** Annotates a method as an unary postfix operator overload for the specified `token`. */
2679
- export function postfix(token: "++" | "--"): (
2833
+ export function postfix(
2834
+ token: "++" | "--"
2835
+ ): (
2680
2836
  target: any,
2681
2837
  propertyKey: string,
2682
2838
  descriptor: TypedPropertyDescriptor<any>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "warpo",
3
- "version": "2.2.5-beta-1",
3
+ "version": "2.3.0-alpha-0",
4
4
  "description": "next generation AssemblyScript compiler with optimizations",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,3 @@
1
+ # warpo additional type
2
+
3
+ Here we will put non-typescript standard libarary header.
@@ -1,7 +1,18 @@
1
1
  /// <reference path="../../assemblyscript/std/assembly/index.d.ts" />
2
2
 
3
3
  declare module "rt/index" {
4
- export function __collect(): void;
4
+ // allocate new object with size and rtid
5
+ function __new(size: usize, id: u32): usize;
6
+ // re-allocate a object
7
+ function __renew(ptr: usize, size: usize): usize;
8
+ // insert write barrier (only useful for incremental runtime)
9
+ function __link(parentPtr: usize, childPtr: usize, expectMultiple: bool): void;
10
+ // trigger full GC manually
11
+ function __collect(): void;
12
+ // pin an object to prevent being garbage collected
13
+ function __pin(ptr: usize): usize;
14
+ // cancel the pin operation
15
+ function __unpin(ptr: usize): void;
5
16
  }
6
17
 
7
18
  declare module "warpo/utf8/const_str" {