From 4ec36c07c787ecd152b34e41dca5f2c90e66592a Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Tue, 29 Oct 2024 11:40:14 +1300 Subject: Write line and column information to symbols file Previously only the path to the source file was being written, not the location of the symbol within the file. --- src/translators/symbols_generator.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/translators/symbols_generator.rs b/src/translators/symbols_generator.rs index 06bbaa8..6db1d46 100644 --- a/src/translators/symbols_generator.rs +++ b/src/translators/symbols_generator.rs @@ -11,16 +11,9 @@ pub fn generate_symbols_file(semantic_tokens: &[SemanticToken]) -> String { let address = token.bytecode.location.address; if address > 0xffff { break; } let name = &definition.name; - let path = match &token.source.in_source { - Some(source) => &source.path, - None => &token.source.in_merged.path, - }; - if let Some(path) = path { - let path = path.as_os_str().to_string_lossy(); - symbols.push_str(&format!("{address:04x} {name} {path}\n")); - } else { - symbols.push_str(&format!("{address:04x} {name}\n")); - } + let location = token.source.in_source.as_ref() + .unwrap_or(&token.source.in_merged); + symbols.push_str(&format!("{address:04x} {name} {location}\n")); } } -- cgit v1.2.3-70-g09d2