forked from M-Labs/nac3
1
0
Fork 0

core: refactor top_level::builtins::get_builtins()

This commit is contained in:
lyken 2024-06-18 11:06:25 +08:00
parent ce3e9bf4fe
commit e85f4f9bd2
2 changed files with 8 additions and 7 deletions

View File

@ -269,14 +269,15 @@ fn create_fn_by_extern(
} }
pub fn get_builtins(unifier: &mut Unifier, primitives: &PrimitiveStore) -> BuiltinInfo { pub fn get_builtins(unifier: &mut Unifier, primitives: &PrimitiveStore) -> BuiltinInfo {
let top_level_def_list = BuiltinBuilder::new(unifier, primitives) BuiltinBuilder::new(unifier, primitives)
.build_all_builtins() .build_all_builtins()
.into_iter() .into_iter()
.map(|tld| Arc::new(RwLock::new(tld))); .map(|tld| {
let tld = Arc::new(RwLock::new(tld));
let ast_list: Vec<Option<Stmt<()>>> = (0..top_level_def_list.len()).map(|_| None).collect(); let ast = None;
(tld, ast)
izip!(top_level_def_list, ast_list).collect_vec() })
.collect()
} }
/// A helper enum used by [`BuiltinBuilder`] /// A helper enum used by [`BuiltinBuilder`]

View File

@ -20,7 +20,7 @@ use crate::{
}, },
}; };
use inkwell::values::BasicValueEnum; use inkwell::values::BasicValueEnum;
use itertools::{izip, Itertools}; use itertools::Itertools;
use nac3parser::ast::{self, Location, Stmt, StrRef}; use nac3parser::ast::{self, Location, Stmt, StrRef};
use parking_lot::RwLock; use parking_lot::RwLock;