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

@@ -1,8 +1,10 @@
use std::rc::Rc;
use itertools::Itertools;
use super::ProjectError;
use crate::representations::location::Location;
use crate::{Interner, VName};
use crate::VName;
/// Error produced for the statement `import *`
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
@@ -16,11 +18,11 @@ impl ProjectError for ImportAll {
fn description(&self) -> &str {
"a top-level glob import was used"
}
fn message(&self, i: &Interner) -> String {
format!("{} imports *", i.extern_all(&self.offender_mod).join("::"))
fn message(&self) -> String {
format!("{} imports *", self.offender_mod.iter().join("::"))
}
fn one_position(&self, _i: &Interner) -> Location {
fn one_position(&self) -> Location {
Location::File(self.offender_file.clone())
}
}