Skip to content

Commit a2b18f7

Browse files
authored
Update docs to align with 0.19.12 (#100)
1 parent 03c3581 commit a2b18f7

File tree

4 files changed

+28
-15
lines changed

4 files changed

+28
-15
lines changed

src/compiler.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ There are several flags that enable or disable specific WebAssembly or compiler
121121
--initialMemory Sets the initial memory size in pages.
122122
--maximumMemory Sets the maximum memory size in pages.
123123
--sharedMemory Declare memory as shared. Requires maximumMemory.
124+
--zeroFilledMemory Assume that imported memory is zero filled (requires --importMemory).
124125
--importTable Imports the function table from 'env.table'.
125126
--exportTable Exports the function table as 'table'.
126127
--runtime Specifies the runtime variant to include in the program.

src/loader.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,15 +243,23 @@ The following utility functions are mixed into the module's exports.
243243
Allocates a new string in the module's memory and returns a pointer to it. Requires `--exportRuntime` for access to `__new`.
244244

245245
* ```ts
246-
function __newArray(id: number, values: number[]): number
246+
function __newArray(
247+
id: number,
248+
values: valuesOrCapacity?: number[] | ArrayBufferView | number
249+
): number
247250
```
248-
Allocates a new array in the module's memory and returns a pointer to it. The `id` is the unique runtime id of the respective array class. If you are using `Int32Array` for example, the best way to know the id is an `export const Int32Array_ID = idof<Int32Array>()`. Requires `--exportRuntime` for access to `__new`.
251+
Allocates a new array in the module's memory and returns a pointer to it. The `id` is the unique runtime id of the respective array class. If you are using `Int32Array` for example, the best way to know the id is an `export const Int32Array_ID = idof<Int32Array>()`. Requires `--exportRuntime` for access to `__new`. The `values` parameter сan also be used to pre-allocate an otherwise empty array of a certain capacity.
249252

250253
* ```ts
251254
function __getString(ptr: number): string
252255
```
253256
Copies a string's value from the module's memory to a JavaScript string. `ptr` must not be zero.
254257

258+
* ```ts
259+
function __getFunction(ptr: number): ((...args: unknown[]) => unknown) | null
260+
```
261+
Gets a callable function object from the module's memory containing its table index. `ptr` must not be zero.
262+
255263
* ```ts
256264
function __getArrayBuffer(ptr: number): ArrayBuffer
257265
```

src/peculiarities.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Decorators work more like actual compiler annotations in AssemblyScript.
1515
| `@inline` | Requests inlining of a constant or function.
1616
| `@lazy` | Requests lazy compilation of a variable. Useful to avoid unnecessary globals.
1717
| `@global` | Registers an element to be part of the global scope.
18+
| `@final` | Annotates a class as final, that is it cannot be subclassed.
19+
| `@unmanaged` | Annotates a class as not tracked by GC, essentially C structs.
1820
| `@external` | Changes the external name of an imported element. `@external(module, name)` changes both the module and element name, `@external(name)` changes the element name only.
1921
| `@operator` | Annotates a method as a binary operator overload. See below.
2022
| `@operator.binary` | Alias of `@operator`.
@@ -76,10 +78,10 @@ __op(): T { ... }
7678

7779
| OP | Description | Notes
7880
| :----- | :--------------- | :-----
79-
| `"!"` | Logical NOT |
80-
| `"~"` | Bitwise NOT |
81-
| `"+"` | Unary plus |
82-
| `"-"` | Unary negation |
81+
| `"!"` | Logical NOT |
82+
| `"~"` | Bitwise NOT |
83+
| `"+"` | Unary plus |
84+
| `"-"` | Unary negation |
8385
| `"++"` | Prefix increment | Instance overload reassigns
8486
| `"--"` | Prefix decrement | Instance overload reassigns
8587

@@ -168,6 +170,7 @@ The following range limits are present as global constants for convenience:
168170
* ```ts
169171
const f32.MIN_VALUE: f32 = -3.40282347e+38
170172
const f32.MAX_VALUE: f32 = 3.40282347e+38
173+
const f32.MIN_NORMAL_VALUE: f32 = 1.17549435e-38
171174
const f32.MIN_SAFE_INTEGER: f32 = -16777215
172175
const f32.MAX_SAFE_INTEGER: f32 = 16777215
173176
const f32.EPSILON: f32 = 1.19209290e-07
@@ -176,6 +179,7 @@ The following range limits are present as global constants for convenience:
176179
* ```ts
177180
const f64.MIN_VALUE: f64 = -1.7976931348623157e+308
178181
const f64.MAX_VALUE: f64 = 1.7976931348623157e+308
182+
const f64.MIN_NORMAL_VALUE: f64 = 2.2250738585072014e-308
179183
const f64.MIN_SAFE_INTEGER: f64 = -9007199254740991
180184
const f64.MAX_SAFE_INTEGER: f64 = 9007199254740991
181185
const f64.EPSILON: f64 = 2.2204460492503131e-16

src/stdlib/console.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,34 @@ import "wasi";
1313
## Static members
1414

1515
* ```ts
16-
function assert<T>(assertion: T, message: string): void
16+
function assert<T>(assertion: T, message?: string): void
1717
```
1818
Logs `message` to console if `assertion` is false-ish.
1919

2020
* ```ts
21-
function log(message: string): void
21+
function log(message?: string): void
2222
```
2323
Outputs `message` to the console.
2424

2525
* ```ts
26-
function debug(message: string): void
27-
function info(message: string): void
28-
function warn(message: string): void
29-
function error(message: string): void
26+
function debug(message?: string): void
27+
function info(message?: string): void
28+
function warn(message?: string): void
29+
function error(message?: string): void
3030
```
3131
Outputs `message` to the console, prefixed with "Debug:", "Info:", "Warning:" or "Error:" respectively.
3232

3333
* ```ts
34-
function time(label: string): void
34+
function time(label?: string): void
3535
```
3636
Starts a new timer using the specified `label`.
3737

3838
* ```ts
39-
function timeLog(label: string): void
39+
function timeLog(label?: string): void
4040
```
4141
Logs the current value of a timer previously started with `console.time`.
4242

4343
* ```ts
44-
function timeEnd(label: string): void
44+
function timeEnd(label?: string): void
4545
```
4646
Logs the current value of a timer previously started with `console.time` and discards the timer.

0 commit comments

Comments
 (0)