use mclangc::{ common::{Loc, loc::LocBox}, parser::{ ast::{ Ident, Program, statement::{Enum, Struct}, typ::Type } }, validator::predefined::{BuiltinType, load_builtin} }; mod constant; mod statc; mod type_alias; pub fn get_prog() -> Program { let mut prog = Program::default(); load_builtin(&mut prog); let loc = Loc::default(); prog.structs.insert(Ident::new("MyStruct"), LocBox::new(&loc, Struct { name: Ident::new("MyStruct"), fields: vec![ (Ident::new("foo"), LocBox::new(&loc, BuiltinType::usize())), (Ident::new("bar"), LocBox::new(&loc, BuiltinType::bool())), (Ident::new("baz"), LocBox::new(&loc, Type::Owned(Ident::new("str")).as_ref())), ] })); prog.enums.insert(Ident::new("MyEnum"), LocBox::new(&loc, Enum { name: Ident::new("MyEnum"), fields: vec![], })); prog.types.insert(Ident::new("MyType"), LocBox::new(&loc, Type::Owned(Ident::new("MyStruct")))); prog.types.insert(Ident::new("MyType2"), LocBox::new(&loc, Type::Owned(Ident::new("MyType")))); prog.types.insert(Ident::new("MyType3"), LocBox::new(&loc, Type::Owned(Ident::new("MyType2")).as_ref())); prog.types.insert(Ident::new("MyTypeInf"), LocBox::new(&loc, Type::Owned(Ident::new("MyTypeInf")))); prog.types.insert(Ident::new("MyTypeInfIndirect"), LocBox::new(&loc, Type::Owned(Ident::new("MyType4")))); prog.types.insert(Ident::new("MyType4"), LocBox::new(&loc, Type::Owned(Ident::new("MyType5")))); prog.types.insert(Ident::new("MyType5"), LocBox::new(&loc, Type::Owned(Ident::new("MyType4")))); prog }