File tree Expand file tree Collapse file tree
examples/tutorial/wat/adder Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ (module
2+ (func $add (param $lhs i32 ) (param $rhs i32 ) (result i32 )
3+ local.get $lhs
4+ local.get $rhs
5+ i32.add )
6+ (export " docs:adder/add@0.1.0#add" (func $add ))
7+ )
Original file line number Diff line number Diff line change @@ -16,30 +16,16 @@ and simply adds two numbers.
16162 . The ` add ` function is defined inside the following world.
1717 Create a file called ` adder.wit ` whose contents are as follows:
1818
19- ``` wit
20- package docs:adder@0.1.0;
21-
22- interface add {
23- add: func(x: u32, y: u32) -> u32;
24- }
25-
26- world adder {
27- export add;
28- }
29- ```
19+ ``` wit
20+ {{#include ../../examples/tutorial/wit/adder/world.wit}}
21+ ```
3022
31233 . Define an ` add ` core module in WAT that exports an ` add ` function that adds two parameters.
3224 Create a file called ` add.wat ` whose contents are as follows:
3325
34- ``` wat
35- (module
36- (func $add (param $lhs i32) (param $rhs i32) (result i32)
37- local.get $lhs
38- local.get $rhs
39- i32.add)
40- (export "docs:adder/add@0.1.0#add" (func $add))
41- )
42- ```
26+ ``` wat
27+ {{#include ../../examples/tutorial/wat/adder/add.wat}}
28+ ```
4329
44304 . Use ` wasm-tools ` to create a binary core module with component metadata embedded inside it:
4531
You can’t perform that action at this time.
0 commit comments