Skip to content

Commit 6b5114f

Browse files
authored
rust: fix local symbol parse and emit with locals (#167)
1 parent a1a6f89 commit 6b5114f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

bindings/rust/src/symbol.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ pub fn format_symbol_with(symbol: Symbol, options: SymbolFormatOptions) -> Strin
5050
..
5151
} = symbol;
5252

53+
// Handle local symbols first, to enforce simple formatting
54+
if scheme == "local" {
55+
if let Some(symbol) = descriptors
56+
.iter()
57+
.find_map(|desc| match desc.suffix.enum_value() {
58+
Ok(descriptor::Suffix::Local) => Some(format!("local {}", desc.name)),
59+
_ => None,
60+
})
61+
{
62+
return symbol;
63+
}
64+
}
65+
5366
if options.include_scheme {
5467
parts.push(scheme);
5568
}
@@ -524,6 +537,8 @@ mod test {
524537
..Default::default()
525538
})
526539
);
540+
541+
assert_eq!("local 7", format_symbol(Symbol::new_local(7)));
527542
}
528543

529544
#[test]

0 commit comments

Comments
 (0)