summaryrefslogtreecommitdiff
path: root/src/reports
diff options
context:
space:
mode:
authorBen Bridle <ben@derelict.engineering>2025-03-25 10:59:30 +1300
committerBen Bridle <ben@derelict.engineering>2025-03-25 10:59:30 +1300
commit34ca33d86fd47ca912751bd8578e66f449639a7c (patch)
treeaa9036abfe7fec4c9cc570182e2bc0d496b1c966 /src/reports
parent24080dd75092ea5ef8c10fd179aa28b8db534c7f (diff)
downloadassembler-34ca33d86fd47ca912751bd8578e66f449639a7c.zip
Don't print original source in redefinition errors
The source context of the original definition of a redefined symbol was being printed when reporting a redefinition error. Since only the source code containing the redefinition was available, if the original definition was in a different file then the source context of the original definition would just pull from this source code and the context shown would be completely nonsensical.
Diffstat (limited to 'src/reports')
-rw-r--r--src/reports/resolver_error.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/reports/resolver_error.rs b/src/reports/resolver_error.rs
index 0fce3c4..81bec1b 100644
--- a/src/reports/resolver_error.rs
+++ b/src/reports/resolver_error.rs
@@ -14,12 +14,10 @@ impl<'a> ResolverError<'a> {
}
for redefinition in &self.resolver.redefinitions {
let definition = &self.resolver.definitions[redefinition.definition];
- let message = format!("Redefined symbol '{}'", definition.tracked.symbol.name);
+ let name = &definition.tracked.symbol.name;
+ let location = definition.tracked.symbol.source.location();
+ let message = format!("Redefined symbol '{name}' (defined at {location})", );
let context = redefinition.tracked.context(&self.resolver);
- let context = Context {
- source_code: context.source_code,
- source: &context.source.wrap(&definition.tracked.symbol.source)
- };
report_source_issue(LogLevel::Error, &context, &message);
}
}