Converted Interner to work with Rc-s

- Interner no longer contains unsafe code
- Tokens now hold a reference to the value they represent directly

This will enable many future improvements
This commit is contained in:
2023-08-19 14:03:05 +01:00
parent ab0b57b1b8
commit 0b887ced70
62 changed files with 592 additions and 762 deletions

View File

@@ -21,21 +21,23 @@ impl ProjectError for NotExported {
fn description(&self) -> &str {
"An import refers to a symbol that exists but isn't exported"
}
fn positions(&self, i: &Interner) -> BoxedIter<ErrorPosition> {
fn positions(&self) -> BoxedIter<ErrorPosition> {
Box::new(
[
ErrorPosition {
location: Location::File(Rc::new(i.extern_all(&self.file))),
location: Location::File(Rc::new(Interner::extern_all(&self.file))),
message: Some(format!(
"{} isn't exported",
i.extern_all(&self.subpath).join("::")
Interner::extern_all(&self.subpath).join("::")
)),
},
ErrorPosition {
location: Location::File(Rc::new(i.extern_all(&self.referrer_file))),
location: Location::File(Rc::new(Interner::extern_all(
&self.referrer_file,
))),
message: Some(format!(
"{} cannot see this symbol",
i.extern_all(&self.referrer_subpath).join("::")
Interner::extern_all(&self.referrer_subpath).join("::")
)),
},
]