From 927969c710d94fea2ee75d1bc8523b17f96b9ad8 Mon Sep 17 00:00:00 2001 From: Peter Huene Date: Thu, 16 Jun 2022 17:32:15 -0700 Subject: [PATCH] wasmprinter: remove variant case identifiers. This commit removes the identifiers from variant cases; instead, a `refines` clause references the case by index. --- crates/wasmprinter/src/lib.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/crates/wasmprinter/src/lib.rs b/crates/wasmprinter/src/lib.rs index b31625c0a4..56d67c04f8 100644 --- a/crates/wasmprinter/src/lib.rs +++ b/crates/wasmprinter/src/lib.rs @@ -2318,11 +2318,9 @@ impl Printer { fn print_variant_type(&mut self, state: &State, cases: &[VariantCase]) -> Result<()> { self.start_group("variant"); - for (i, case) in cases.iter().enumerate() { + for case in cases { self.result.push(' '); self.start_group("case "); - // TODO: use the identifier from the name section when there is one - write!(&mut self.result, "$c{} ", i)?; self.print_str(case.name)?; self.result.push(' '); self.print_component_val_type(state, &case.ty)?; @@ -2330,8 +2328,7 @@ impl Printer { if let Some(refines) = case.refines { self.result.push(' '); self.start_group("refines "); - // TODO: use the identifier from the name section when there is one - write!(&mut self.result, "$c{}", refines)?; + write!(&mut self.result, "{}", refines)?; self.end_group(); } self.end_group()