From e85f4f9bd248e8ad29ad3a4754645a7bd4584b28 Mon Sep 17 00:00:00 2001 From: lyken Date: Tue, 18 Jun 2024 11:06:25 +0800 Subject: [PATCH] core: refactor top_level::builtins::get_builtins() --- nac3core/src/toplevel/builtins.rs | 13 +++++++------ nac3core/src/toplevel/mod.rs | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/nac3core/src/toplevel/builtins.rs b/nac3core/src/toplevel/builtins.rs index 6413d999d..ef6618bc6 100644 --- a/nac3core/src/toplevel/builtins.rs +++ b/nac3core/src/toplevel/builtins.rs @@ -269,14 +269,15 @@ fn create_fn_by_extern( } 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() .into_iter() - .map(|tld| Arc::new(RwLock::new(tld))); - - let ast_list: Vec>> = (0..top_level_def_list.len()).map(|_| None).collect(); - - izip!(top_level_def_list, ast_list).collect_vec() + .map(|tld| { + let tld = Arc::new(RwLock::new(tld)); + let ast = None; + (tld, ast) + }) + .collect() } /// A helper enum used by [`BuiltinBuilder`] diff --git a/nac3core/src/toplevel/mod.rs b/nac3core/src/toplevel/mod.rs index 21e2fac26..c08f287f3 100644 --- a/nac3core/src/toplevel/mod.rs +++ b/nac3core/src/toplevel/mod.rs @@ -20,7 +20,7 @@ use crate::{ }, }; use inkwell::values::BasicValueEnum; -use itertools::{izip, Itertools}; +use itertools::Itertools; use nac3parser::ast::{self, Location, Stmt, StrRef}; use parking_lot::RwLock;