From d6573284876347cbeb3ab60383a7c65a3b202ea2 Mon Sep 17 00:00:00 2001 From: Nyeogmi Date: Sat, 17 Feb 2024 15:55:52 -0800 Subject: [PATCH] Rename interner to prototyper --- src/main.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main.rs b/src/main.rs index 6f3a637..e973561 100644 --- a/src/main.rs +++ b/src/main.rs @@ -37,8 +37,8 @@ impl Value { #[derive(Clone, Copy, Debug)] struct Object { index: u32 } struct Program { - blocks: Interner, - types: Interner, + blocks: Prototyper, + types: Prototyper, } struct BlockData { instructions: Vec } @@ -312,8 +312,8 @@ impl Op21 { impl Program { fn new() -> Program { let mut p = Self { - blocks: Interner::::new(), - types: Interner::::new(), + blocks: Prototyper::::new(), + types: Prototyper::::new(), }; let ty_null = p.type_prototype("null"); @@ -431,13 +431,13 @@ impl<'p> Heap<'p> { } } -struct Interner { +struct Prototyper { by_name: HashMap, names: Vec, values: Vec> } -impl Interner { +impl Prototyper { pub fn new() -> Self { Self { by_name: HashMap::new(), @@ -459,7 +459,7 @@ impl Interner { pub fn instantiate(&mut self, handle: u32, value: T) -> Result<(), &'static str> { let slot = self.values .get_mut(handle as usize) - .ok_or("handle was not prototyped on this interner")?; + .ok_or("handle was not prototyped on this prototyper")?; if slot.is_some() { return Err("can't instantiate handle twice") } @@ -471,7 +471,7 @@ impl Interner { match self.values.get(handle as usize) { Some(Some(h)) => Ok(h), Some(_) => Err("handle was prototyped but not instantiated"), - _ => Err("handle was not prototyped on this interner"), + _ => Err("handle was not prototyped on this prototyper"), } } @@ -479,7 +479,7 @@ impl Interner { match self.values.get_mut(handle as usize) { Some(Some(h)) => Ok(h), Some(_) => Err("handle was prototyped but not instantiated"), - _ => Err("handle was not prototyped on this interner"), + _ => Err("handle was not prototyped on this prototyper"), } } }