-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change data representation of resource methods (#1070)
* Change data representation of resource methods This commit changes the representation of resources and their methods in the `wit-parser` crate as implemented originally in #1053. Previously methods related to a resource were strung as a separate list of methods from each `Resource` type which provided a nested view of functions for bindings generators to interpret. This representation, however, does not allow for methods or constructors to actually refer to the resource type itself because the resource type can't be created until the method list is created, a cyclic dependency. To handle this problem this commit removes the nested list of functions and instead places all resource methods and functions and such within the normal single list of functions within an interface. This represents a "flattened" version of all functions available within an interface or world and aligns with the WebAssembly representation of how these will work. The names of these functions are not valid identifiers and have the component-model mangling along the lines of `[method]foo.bar` for example. My hope is that in the future as bindings generators are worked on various helper methods can be added to automatically group functions based on their kind to avoid any issues. Otherwise though this will likely "break" all existing code generators when resources are introduced because the names aren't valid identifiers in any language. I think this is a good thing, however, as that way it can't be forgotten to handle the resources case and failures will be "loud" in theory. This commit changes a number of other miscellaneous details such as: * Type resolution no longer needs to consider types referenced by methods of resources as dependencies which reflects how this will all look in a wasm binary format where resources are declared before their member functions are declared. * Parsing has been updated to address some minor issues here and there and additionally has some new names to remove the old "value" concept which is no longer a thing. * Fix resources-in-worlds with methods Additionally be sure to update ids listed in `FunctionKind` during merging.
- Loading branch information
1 parent
2180971
commit 4b69456
Showing
23 changed files
with
391 additions
and
298 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.