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

Support .wat files in the explore command #8314

Merged
merged 2 commits into from
Apr 9, 2024

Conversation

adambratschikaye
Copy link
Contributor

Many on the wasmtime subcommands work with either .wasm or .wat files, but explore only works with .wasm. This change accepts .wat as well.

Many on the `wasmtime` subcommands work with either `.wasm` or `.wat`
files, but `explore` only works with `.wasm`. This change accepts `.wat`
as well.
@adambratschikaye adambratschikaye requested a review from a team as a code owner April 8, 2024 13:46
@adambratschikaye adambratschikaye requested review from alexcrichton and removed request for a team April 8, 2024 13:46
Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

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

Thanks! One nitpick below before we merge this.

Comment on lines 37 to 38
let wasm = wat::parse_bytes(&bytes)
.with_context(|| format!("failed to parse Wasm module: {}", self.module.display()))?;
Copy link
Member

Choose a reason for hiding this comment

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

Can you make sure that this also compiles and works for wasm binaries when the wat dependency isn't enabled? Something like the following:

                #[cfg(feature = "wat")]
                let bytes = wat::parse_bytes(bytes).map_err(|mut e| {
                    e.set_path(path);
                    e
                })?;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry I forgot wat was behind a feature. Fixed it now.

Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

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

Thanks very much!

@fitzgen fitzgen added this pull request to the merge queue Apr 9, 2024
Merged via the queue into bytecodealliance:main with commit b3cadb4 Apr 9, 2024
19 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.

2 participants