Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bin/wasm-tools/addr2line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl Opts {
}

pub fn run(&self) -> Result<()> {
let wasm = self.io.parse_input_wasm()?;
let wasm = self.io.get_input_wasm()?;

let mut modules = Addr2lineModules::parse(&wasm)
.context("failed to parse input and read custom sections")?;
Expand Down
6 changes: 3 additions & 3 deletions src/bin/wasm-tools/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl NewOpts {

/// Executes the application.
fn run(self) -> Result<()> {
let wasm = self.io.parse_input_wasm()?;
let wasm = self.io.get_input_wasm()?;
let mut encoder = ComponentEncoder::default()
.validate(!self.skip_validation)
.reject_legacy_names(self.reject_legacy_names);
Expand Down Expand Up @@ -389,7 +389,7 @@ impl EmbedOpts {
},
)
} else {
self.io.parse_input_wasm()?
self.io.get_input_wasm()?
};

embed_component_metadata(
Expand Down Expand Up @@ -1046,7 +1046,7 @@ impl UnbundleOpts {
}

fn run(self) -> Result<()> {
let input = self.io.parse_input_wasm()?;
let input = self.io.get_input_wasm()?;
if !wasmparser::Parser::is_component(&input) {
return self.io.output_wasm(&input, self.wat);
}
Expand Down
2 changes: 1 addition & 1 deletion src/bin/wasm-tools/demangle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl Opts {
}

pub fn run(&self) -> Result<()> {
let input = self.io.parse_input_wasm()?;
let input = self.io.get_input_wasm()?;
let mut module = wasm_encoder::Module::new();

for payload in Parser::new(0).parse_all(&input) {
Expand Down
2 changes: 1 addition & 1 deletion src/bin/wasm-tools/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl Opts {
}

pub fn run(&self) -> Result<()> {
let input = self.io.parse_input_wasm()?;
let input = self.io.get_input_wasm()?;
let output = self.io.output_writer()?;
let mut d = Dump::new(&input, output);
d.run()?;
Expand Down
4 changes: 2 additions & 2 deletions src/bin/wasm-tools/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl ShowOpts {
}

pub fn run(&self) -> Result<()> {
let input = self.io.parse_input_wasm()?;
let input = self.io.get_input_wasm()?;
let mut output = self.io.output_writer()?;

let payload = wasm_metadata::Payload::from_binary(&input)?;
Expand Down Expand Up @@ -82,7 +82,7 @@ impl AddOpts {
}

pub fn run(&self) -> Result<()> {
let input = self.io.parse_input_wasm()?;
let input = self.io.get_input_wasm()?;

let output = self.add_metadata.to_wasm(&input)?;

Expand Down
2 changes: 1 addition & 1 deletion src/bin/wasm-tools/mutate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl Opts {
}

pub fn run(mut self) -> Result<()> {
let input_wasm = self.io.parse_input_wasm()?;
let input_wasm = self.io.get_input_wasm()?;

// Currently `self.wasm_mutate` is typed as `'static` for the input wasm
// due to how this subcommand is defined. To get the input wasm to live
Expand Down
2 changes: 1 addition & 1 deletion src/bin/wasm-tools/objdump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl Opts {
}

pub fn run(&self) -> Result<()> {
let input = self.io.parse_input_wasm()?;
let input = self.io.get_input_wasm()?;

let mut printer = Printer {
indices: Vec::new(),
Expand Down
2 changes: 1 addition & 1 deletion src/bin/wasm-tools/print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl Opts {
}

pub fn run(&self) -> Result<()> {
let wasm = self.io.parse_input_wasm()?;
let wasm = self.io.get_input_wasm()?;

let mut config = wasmprinter::Config::new();
config.print_offsets(self.print_offsets);
Expand Down
2 changes: 1 addition & 1 deletion src/bin/wasm-tools/shrink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl Opts {
}

pub fn run(self) -> Result<()> {
let input = self.io.parse_input_wasm()?;
let input = self.io.get_input_wasm()?;
let initial_size = input.len();

// Prerequisites for the predicate.
Expand Down
2 changes: 1 addition & 1 deletion src/bin/wasm-tools/strip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl Opts {
}

pub fn run(&self) -> Result<()> {
let input = self.io.parse_input_wasm()?;
let input = self.io.get_input_wasm()?;
let to_delete = regex::RegexSet::new(self.delete.iter())?;

let strip_custom_section = |name: &str| {
Expand Down
4 changes: 4 additions & 0 deletions tests/cli/dangling_if.wat.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(module
(type (;0;) (func))
(func (;0;) (type 0)
if ;; label = @1
4 changes: 1 addition & 3 deletions tests/cli/dump/select.wat
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
;; FAIL: dump %
;; This fails because wasmprinter can't (yet) print an invalid multi-value select.
;; Can be changed back to a "RUN" test once that code lands.
;; RUN: dump %

(module
(func
Expand Down
1 change: 0 additions & 1 deletion tests/cli/dump/select.wat.stderr

This file was deleted.

21 changes: 21 additions & 0 deletions tests/cli/dump/select.wat.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
0x0 | 00 61 73 6d | version 1 (Module)
| 01 00 00 00
0x8 | 01 04 | type section
0xa | 01 | 1 count
--- rec group 0 (implicit) ---
0xb | 60 00 00 | [type 0] SubType { is_final: true, supertype_idx: None, composite_type: CompositeType { inner: Func(FuncType { params: [], results: [] }), shared: false } }
0xe | 03 02 | func section
0x10 | 01 | 1 count
0x11 | 00 | [func 0] type 0
0x12 | 0a 0e | code section
0x14 | 01 | 1 count
============== func 0 ====================
0x15 | 0c | size of function
0x16 | 00 | 0 local blocks
0x17 | 1b | select
0x18 | 1c 00 | ??
0x1a | 1c 01 7f | typed_select ty:I32
0x1d | 1c 02 | ??
0x1f | 7f | i64_div_s
0x20 | 7f | i64_div_s
0x21 | 0b | end
1 change: 1 addition & 0 deletions tests/cli/print-code-section-overflow.wat.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(module
2 changes: 1 addition & 1 deletion tests/cli/print-dont-reserve-the-world.wat.stderr
Original file line number Diff line number Diff line change
@@ -1 +1 @@
error: unexpected end-of-file (at offset 0xf)
error: function section has non-zero count but code section is absent (at offset 0xf)
1 change: 1 addition & 0 deletions tests/cli/print-dont-reserve-the-world.wat.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(module
2 changes: 1 addition & 1 deletion tests/cli/print-locals-overflow.wat.stderr
Original file line number Diff line number Diff line change
@@ -1 +1 @@
error: control frames remain at end of function body or expression (at offset 0x1d)
error: function exceeds the maximum number of locals that can be printed
3 changes: 3 additions & 0 deletions tests/cli/print-locals-overflow.wat.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(module
(type (;0;) (func))
(func (;0;) (type 0)
3 changes: 3 additions & 0 deletions tests/cli/print-no-panic-dangling-else.wat.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(module
(type (;0;) (func))
(func (;0;) (type 0)
4 changes: 4 additions & 0 deletions tests/cli/print-no-panic-double-end.wat.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(module
(type (;0;) (func))
(func (;0;) (type 0)
end
4 changes: 4 additions & 0 deletions tests/cli/print-with-too-many-ends.wat.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(module
(type (;0;) (func))
(func (;0;) (type 0)
end