diff options
| author | Luuk de Gram <luuk@degram.dev> | 2021-07-31 16:01:37 +0200 |
|---|---|---|
| committer | Luuk de Gram <luuk@degram.dev> | 2021-08-01 11:07:23 +0200 |
| commit | 61de59e121ebd5ad2a8af871ddb1d785c3694481 (patch) | |
| tree | 3faaf644c970ce194adfd77be0778d8939852d6a /src/Module.zig | |
| parent | e58976542b096df6cbb2088b6c7a690d7b95c50a (diff) | |
| download | zig-61de59e121ebd5ad2a8af871ddb1d785c3694481.tar.gz zig-61de59e121ebd5ad2a8af871ddb1d785c3694481.zip | |
wasm: Implement optionals
This uses the same approach as error unions,
meaning it's a `WValue` with its tag set to `multi_value`.
The initial index of the multi_value will contain the null-tag, used to check if the value
is null or not. The other values will be the payload.
To support the `.?` shorthand syntax, we save the result from checking the null-tag
into a new local, which can then be loaded later in the block to either hit `unreachable` or
set the actual payload value.
Currently, it seems `.?` and `orelse unreachable` results in different AIR structure.
TODO: Is this expected?
Diffstat (limited to 'src/Module.zig')
0 files changed, 0 insertions, 0 deletions
