diff options
| author | Miquel Sabaté Solà <mssola@mssola.com> | 2026-07-07 23:25:49 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <mssola@mssola.com> | 2026-07-07 23:26:50 +0200 |
| commit | 2b1356d371b52d68243ddebbfcf3f65047c2fd76 (patch) | |
| tree | 162b56abce5811fd46694a95c25ea61ec6dd6593 /lib/xixanta | |
| parent | 6b43fd7c0773bd97c4bd80145a17d67062afd4ea (diff) | |
| download | tools.nes-2b1356d371b52d68243ddebbfcf3f65047c2fd76.tar.gz tools.nes-2b1356d371b52d68243ddebbfcf3f65047c2fd76.zip | |
Be more specific on unused objects
It was downright lazy from my end to not inspect the line of the object
that was being unused. Fix this by trying to fetch the bundle's node.
This right now applies to variable definitions. Objects like macro
arguments are pending to be done.
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Diffstat (limited to 'lib/xixanta')
| -rw-r--r-- | lib/xixanta/src/assembler.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/xixanta/src/assembler.rs b/lib/xixanta/src/assembler.rs index 6ad2294..bc74d9e 100644 --- a/lib/xixanta/src/assembler.rs +++ b/lib/xixanta/src/assembler.rs @@ -1230,15 +1230,20 @@ impl<'a> Assembler<'a> { global: true, }); } else { + let (line, global) = match &bundle.node { + Some(n) => (n.value.line, false), + None => (0, true), + }; + // Otherwise, we cannot exactly pin down whether this is // harmless or not. Hence, just issue a warning and let // the programmer decide on this. self.warnings.push(Error { - line: 0, + line, message: format!("{} '{full_name}' is unused", bundle.object_type), source, expanded_from: self.macro_context.clone(), - global: true, + global, }); } continue; |
