diff options
| -rw-r--r-- | lib/xixanta/src/assembler.rs | 9 | ||||
| -rw-r--r-- | tests/expected/unused_definition.txt | 2 |
2 files changed, 8 insertions, 3 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; diff --git a/tests/expected/unused_definition.txt b/tests/expected/unused_definition.txt index 8e851b0..3d76553 100644 --- a/tests/expected/unused_definition.txt +++ b/tests/expected/unused_definition.txt @@ -1 +1 @@ -error: variable 'Var' is unused (def.s) +error: variable 'Var' is unused (def.s: line 2) |
