context: switch to BimapTypeDict

This commit is contained in:
Michael Sippel 2024-10-28 21:27:20 +01:00
parent af34fc9976
commit 50fe43df97
Signed by: senvas
GPG key ID: F96CF119C34B64A6

View file

@ -1,9 +1,15 @@
use {
r3vi::{view::{OuterViewPort, singleton::*}, buffer::{singleton::*}},
laddertypes::{TypeDict, TypeTerm, TypeID, MorphismType, MorphismBase, Morphism},
crate::{
repr_tree::{ReprTree, ReprTreeExt, GenericReprTreeMorphism},
edit_tree::EditTree
edit_tree::EditTree,
repr_tree::{GenericReprTreeMorphism, ReprTree, ReprTreeExt},
},
laddertypes::{
parser::ParseLadderType, sugar::SugaredTypeTerm, unparser::UnparseLadderType,
BimapTypeDict, Morphism, MorphismBase, MorphismType, TypeDict, TypeID, TypeTerm,
},
r3vi::{
buffer::singleton::*,
view::{singleton::*, OuterViewPort},
},
std::{
collections::HashMap,
@ -24,7 +30,7 @@ pub static TYPEID_vec : TypeID = TypeID::Fun(4);
#[derive(Clone)]
pub struct Context {
/// assigns a name to every type
pub type_dict: Arc<RwLock<TypeDict>>,
pub type_dict: Arc<RwLock<BimapTypeDict>>,
pub morphisms: laddertypes::morphism::MorphismBase< GenericReprTreeMorphism >,
@ -53,7 +59,7 @@ impl Context {
type_dict: match parent.as_ref() {
Some(p) => p.read().unwrap().type_dict.clone(),
None => {
let mut dict = TypeDict::new();
let mut dict = BimapTypeDict::new();
assert_eq!(TYPEID_edittree, dict.add_typename("EditTree".into()));
assert_eq!(TYPEID_char, dict.add_typename("Char".into()));
assert_eq!(TYPEID_u64, dict.add_typename("machine.UInt64".into()));