Skip to content

Conversation

@pchickey
Copy link
Contributor

  • Friendly public API to Document and Module - expose a getter and an iterator for each kind of definition in each, rather than expose the internal Vec/HashMap<Id, Entry> datastructures.
  • Implement PartialEq and Eq for all AST nodes. The Document and Module implementations are implemented manually, and are not sensitive to the order of definitions.
  • Make a standalone parse(&str) -> Result<Document,...> function available. This uses MockFs under the hood.
  • Factor out IO to a separate module in the crate. Add variants of error reporting that looks up the location of the error using WitxIo
  • Add a Render trait that converts AST nodes back into s-expressions. A separate SExpr enum is used because it needs to own Strings, rather than have refs (&'a str) and Location throughout. Implement Display to render SExprs to text. This allows the validated AST to be serialized to a single string or file.

Pat Hickey added 2 commits September 24, 2019 13:56
…l invariants

the definitions/entries pattern involves upgrading Weak into Rc and also
its not super intuitive, especially given ive written zero (0) docs.
This is a bit nicer to use
Copy link
Member

@sunfishcode sunfishcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@pchickey
Copy link
Contributor Author

Thanks for all the helpful review comments!

@pchickey pchickey merged commit 650581b into master Sep 26, 2019
@pchickey pchickey deleted the pch/witx_better_api branch September 26, 2019 23:17
@pchickey
Copy link
Contributor Author

Published as witx 0.2.0

pchickey pushed a commit that referenced this pull request Sep 27, 2019
dan pointed this out in the review for PR #96 but I somehow lost
the commit in a rebase.
pchickey pushed a commit that referenced this pull request Sep 30, 2019
dan pointed this out in the review for PR #96 but I somehow lost
the commit in a rebase.
pchickey pushed a commit that referenced this pull request Oct 2, 2019
…101)

* witx crate: fix equality impl for document, module

dan pointed this out in the review for PR #96 but I somehow lost
the commit in a rebase.

* witx crate: calculate module type signature of an interface func

* witx crate: rename moduletype to core / WebAssembly type
yoshuawuyts added a commit to yoshuawuyts/WASI that referenced this pull request Nov 25, 2025
yoshuawuyts pushed a commit to yoshuawuyts/WASI that referenced this pull request Nov 25, 2025
* witx tool: improve public api so you don't have to know about internal invariants

the definitions/entries pattern involves upgrading Weak into Rc and also
its not super intuitive, especially given ive written zero (0) docs.
This is a bit nicer to use

* witx: add render trait, make sure it roundtrips by implementing Eq

* witx crate: IntRepr variants are U8, U16... to reflect syntax as "u8"...

* witx crate: doc comments
yoshuawuyts pushed a commit to yoshuawuyts/WASI that referenced this pull request Nov 25, 2025
…ebAssembly#101)

* witx crate: fix equality impl for document, module

dan pointed this out in the review for PR WebAssembly#96 but I somehow lost
the commit in a rebase.

* witx crate: calculate module type signature of an interface func

* witx crate: rename moduletype to core / WebAssembly type
yoshuawuyts pushed a commit to yoshuawuyts/WASI that referenced this pull request Nov 25, 2025
* Document that `monotonic-clock.now` doesn't wrap.

584 years ought to be enough for anyone.

* Document that implementations should pick a low start value.
yoshuawuyts pushed a commit to yoshuawuyts/WASI that referenced this pull request Nov 25, 2025
* witx tool: improve public api so you don't have to know about internal invariants

the definitions/entries pattern involves upgrading Weak into Rc and also
its not super intuitive, especially given ive written zero (0) docs.
This is a bit nicer to use

* witx: add render trait, make sure it roundtrips by implementing Eq

* witx crate: IntRepr variants are U8, U16... to reflect syntax as "u8"...

* witx crate: doc comments
yoshuawuyts pushed a commit to yoshuawuyts/WASI that referenced this pull request Nov 25, 2025
…ebAssembly#101)

* witx crate: fix equality impl for document, module

dan pointed this out in the review for PR WebAssembly#96 but I somehow lost
the commit in a rebase.

* witx crate: calculate module type signature of an interface func

* witx crate: rename moduletype to core / WebAssembly type
yoshuawuyts pushed a commit to yoshuawuyts/WASI that referenced this pull request Nov 25, 2025
Update release candidate version to 0.2.0-rc-2024-01-16
yoshuawuyts pushed a commit to yoshuawuyts/WASI that referenced this pull request Nov 25, 2025
* witx tool: improve public api so you don't have to know about internal invariants

the definitions/entries pattern involves upgrading Weak into Rc and also
its not super intuitive, especially given ive written zero (0) docs.
This is a bit nicer to use

* witx: add render trait, make sure it roundtrips by implementing Eq

* witx crate: IntRepr variants are U8, U16... to reflect syntax as "u8"...

* witx crate: doc comments
yoshuawuyts pushed a commit to yoshuawuyts/WASI that referenced this pull request Nov 25, 2025
…ebAssembly#101)

* witx crate: fix equality impl for document, module

dan pointed this out in the review for PR WebAssembly#96 but I somehow lost
the commit in a rebase.

* witx crate: calculate module type signature of an interface func

* witx crate: rename moduletype to core / WebAssembly type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants