Skip to content

Commit e97d22a

Browse files
authored
Merge pull request #173 from alexcrichton/fix-some-examples
Fix some examples of resources
2 parents b43881a + 8defaa8 commit e97d22a

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

design/mvp/Explainer.md

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -682,12 +682,12 @@ declarators to be used by subsequent declarators in the type:
682682
```wasm
683683
(component
684684
(import "fancy-fs" (instance $fancy-fs
685-
(export "fs" (instance $fs
686-
(export "file" (type $file (sub resource)))
687-
...
685+
(export $fs "fs" (instance
686+
(export "file" (type (sub resource)))
687+
;; ...
688688
))
689689
(alias export $fs "file" (type $file))
690-
(export "fancy-op" (func (param (borrow $file))))
690+
(export "fancy-op" (func (param "f" (borrow $file))))
691691
))
692692
)
693693
```
@@ -702,19 +702,19 @@ definitions:
702702
(component $C
703703
(type $T (list (tuple string bool)))
704704
(type $U (option $T))
705-
(type $G (func (param (list $T)) (result $U)))
705+
(type $G (func (param "x" (list $T)) (result $U)))
706706
(type $D (component
707707
(alias outer $C $T (type $C_T))
708708
(type $L (list $C_T))
709-
(import "f" (func (param $L) (result (list u8))))
709+
(import "f" (func (param "x" $L) (result (list u8))))
710710
(import "g" (func (type $G)))
711-
(export "g" (func (type $G)))
711+
(export "g2" (func (type $G)))
712712
(export "h" (func (result $U)))
713713
(import "T" (type $T (sub resource)))
714-
(import "i" (func (param (list (own $T)))))
715-
(export "T" (type $T' (eq $T)))
716-
(export "U" (type $U (sub resource)))
717-
(export "j" (func (param (borrow $T')) (result (own $U))))
714+
(import "i" (func (param "x" (list (own $T)))))
715+
(export $T' "T2" (type (eq $T)))
716+
(export $U' "U" (type (sub resource)))
717+
(export "j" (func (param "x" (borrow $T')) (result (own $U'))))
718718
))
719719
)
720720
```
@@ -829,10 +829,10 @@ the following component:
829829
(component $C
830830
(import "T1" (type $T1 (sub resource)))
831831
(import "T2" (type $T2 (sub resource)))
832-
(import "T3" (type $T3 (eq $T2))
833-
(type $ListT1 (list $T1))
834-
(type $ListT2 (list $T2))
835-
(type $ListT3 (list $T3))
832+
(import "T3" (type $T3 (eq $T2)))
833+
(type $ListT1 (list (own $T1)))
834+
(type $ListT2 (list (own $T2)))
835+
(type $ListT3 (list (own $T3)))
836836
)
837837
```
838838
the types `$T2` and `$T3` are equal to each other but not to `$T1`. By the
@@ -873,14 +873,14 @@ as well. For example, in this component:
873873
```wasm
874874
(component
875875
(import "C" (component $C
876-
(export "T1" (type $T1 (sub resource)))
877-
(export "T2" (type $T2 (sub resource)))
878-
(export "T3" (type $T3 (eq $T2)))
876+
(export "T1" (type (sub resource)))
877+
(export $T2 "T2" (type (sub resource)))
878+
(export "T3" (type (eq $T2)))
879879
))
880880
(instance $c (instantiate $C))
881-
(type $T1 (alias export $i "T1"))
882-
(type $T2 (alias export $i "T2"))
883-
(type $T3 (alias export $i "T3"))
881+
(alias export $c "T1" (type $T1))
882+
(alias export $c "T2" (type $T2))
883+
(alias export $c "T3" (type $T3))
884884
)
885885
```
886886
the types `$T2` and `$T3` are equal to each other but not to `$T1`. These
@@ -961,6 +961,7 @@ following component:
961961
(type $r (resource (rep i32)))
962962
(export $r1 "r1" (type $r))
963963
(export "r2" (type $r1))
964+
)
964965
```
965966
is assigned the following `componenttype`:
966967
```wasm

0 commit comments

Comments
 (0)