summaryrefslogtreecommitdiff
path: root/src/translators/symbols_generator.rs
diff options
context:
space:
mode:
authorBen Bridle <bridle.benjamin@gmail.com>2024-10-29 11:40:14 +1300
committerBen Bridle <bridle.benjamin@gmail.com>2024-10-29 11:40:47 +1300
commit4ec36c07c787ecd152b34e41dca5f2c90e66592a (patch)
treef09b8b4f06d5f9091cceb611e760a6038532c3a2 /src/translators/symbols_generator.rs
parentdb2c08220e95729c1880953d00aaded693dc43c7 (diff)
downloadbedrock-asm-4ec36c07c787ecd152b34e41dca5f2c90e66592a.zip
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.
Diffstat (limited to 'src/translators/symbols_generator.rs')
-rw-r--r--src/translators/symbols_generator.rs13
1 files 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"));
}
}