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

@@ -64,16 +64,16 @@ fn check_rec_expr(
let typ = (*class).into();
// in a template, the type must be known and identical
// outside template (in pattern) the type must be unknown
if let Some(known) = types.insert(*name, typ) {
if let Some(known) = types.insert(name.clone(), typ) {
if !in_template {
Err(RuleError::Multiple(*name))
Err(RuleError::Multiple(name.clone()))
} else if known != typ {
Err(RuleError::ArityMismatch(*name))
Err(RuleError::ArityMismatch(name.clone()))
} else {
Ok(())
}
} else if in_template {
Err(RuleError::Missing(*name))
Err(RuleError::Missing(name.clone()))
} else {
Ok(())
}