Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(wit-bindgen-go): align flags decoding #157

Merged

Conversation

tchap
Copy link
Contributor

@tchap tchap commented Jun 28, 2024

Flags are now encoded/decoded as bitmaps according to the binary encoding spec.

To decode flags, ReadFromIndex is now being generated as a standalone method so that it can be tested.

Basic tests added for both encoding and decoding.

@tchap tchap requested a review from rvolosatovs as a code owner June 28, 2024 09:03
@tchap
Copy link
Contributor Author

tchap commented Jun 28, 2024

Let me know when this is OK, I will squash the commits and update the commit message.

crates/wit-bindgen-go/src/interface.rs Outdated Show resolved Hide resolved
crates/wit-bindgen-go/src/interface.rs Outdated Show resolved Hide resolved
crates/wit-bindgen-go/src/interface.rs Show resolved Hide resolved
tests/go/types_test.go Outdated Show resolved Hide resolved
@rvolosatovs
Copy link
Member

btw, just a note here - I've just realized that WebAssembly/component-model#370 is a thing and the change was already merged in wasm-tools bytecodealliance/wasm-tools#1635
We could probably always read/write a LE uint32 or uint64 if that's more convenient, but I think I actually prefer the raw byte approach as done here

Copy link
Member

@rvolosatovs rvolosatovs left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@rvolosatovs
Copy link
Member

Let me know when this is OK, I will squash the commits and update the commit message.

feel free to squash/rebase if you wish!

Flags encoding/decoding in Go is now rewritten
to use the correct binary encoding.

Flag structs now contain an addition ReadFromIndex
method that can be used for decoding. This makes
the generated code more testable.
@tchap tchap force-pushed the feature/wit-bindgen-go-flags branch from e54cae7 to 9e8caeb Compare June 28, 2024 13:35
@tchap
Copy link
Contributor Author

tchap commented Jun 28, 2024

feel free to squash/rebase if you wish!

Done.

@rvolosatovs rvolosatovs added this pull request to the merge queue Jun 28, 2024
Merged via the queue into bytecodealliance:main with commit 4fd3c34 Jun 28, 2024
25 checks passed
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.

None yet

2 participants