Skip to content

Commit 263139e

Browse files
committed
Include examples from files
1 parent 673603b commit 263139e

2 files changed

Lines changed: 13 additions & 20 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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+
)

component-model/src/language-support/language-agnostic.md

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,16 @@ and simply adds two numbers.
1616
2. 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

3123
3. 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

4430
4. Use `wasm-tools` to create a binary core module with component metadata embedded inside it:
4531

0 commit comments

Comments
 (0)