summaryrefslogtreecommitdiff
path: root/src/locators
diff options
context:
space:
mode:
authorBen Bridle <ben@derelict.engineering>2025-03-18 11:50:19 +1300
committerBen Bridle <ben@derelict.engineering>2025-03-18 11:50:29 +1300
commitf8a694267d3981b0437c05fc248406116ea9ec06 (patch)
treee7c0426f4278481490e269be7ccb0a710c22ebae /src/locators
parent87cdf5e88fd1d0aaddb91e216c47344effd63ed3 (diff)
downloadassembler-f8a694267d3981b0437c05fc248406116ea9ec06.zip
Large restructure
Files were moved to be better organised, error messages were changed to be more general, and a Compiler type was added to the library.
Diffstat (limited to 'src/locators')
-rw-r--r--src/locators/source.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/locators/source.rs b/src/locators/source.rs
index 7e5abd2..15a0809 100644
--- a/src/locators/source.rs
+++ b/src/locators/source.rs
@@ -19,8 +19,16 @@ impl SourceSpan {
}
/// Wrap this source span around a child source span.
- pub fn wrap(mut self, source: SourceSpan) -> Self {
- self.child = Some(Box::new(source)); self
+ pub fn wrap(&self, child: impl Into<SourceSpan>) -> Self {
+ let mut new = self.clone();
+ new.child = Some(Box::new(child.into()));
+ return new;
+ }
+}
+
+impl From<&SourceSpan> for SourceSpan {
+ fn from(source: &SourceSpan) -> Self {
+ source.clone()
}
}