Skip to content

Commit

Permalink
Merge pull request #15 from ydnar/ydnar/worldly-functions
Browse files Browse the repository at this point in the history
wit: do not serialize non-freestanding functions in world WIT
  • Loading branch information
ydnar authored Oct 30, 2023
2 parents 856eae9 + 8cc279b commit 8a936d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 0 additions & 1 deletion testdata/wit-parser/resources.wit.json.golden.wit
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ interface i {
}

world w {
import [constructor]c: func() -> own<c>;
resource a;
resource b;
resource c {
Expand Down
5 changes: 5 additions & 0 deletions wit/wit.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ func (w *World) WIT(ctx Node, name string) string {
b.WriteString(" {")
n := 0
for _, name := range codec.SortedKeys(w.Imports) {
if f, ok := w.Imports[name].(*Function); ok {
if _, ok := f.Kind.(*Freestanding); !ok {
continue
}
}
if n == 0 {
b.WriteRune('\n')
}
Expand Down

0 comments on commit 8a936d0

Please sign in to comment.