first steps for init

This commit is contained in:
Folkert 2021-02-09 22:47:38 +01:00
parent 352008e8a0
commit b6ceaab341
5 changed files with 54 additions and 1 deletions

View file

@ -1,4 +1,4 @@
use crate::llvm::build_dict::{dict_empty, dict_len};
use crate::llvm::build_dict::{dict_empty, dict_insert, dict_len};
use crate::llvm::build_hash::hash;
use crate::llvm::build_list::{
allocate_list, empty_list, empty_polymorphic_list, list_append, list_concat, list_contains,
@ -3998,6 +3998,14 @@ fn run_low_level<'a, 'ctx, 'env>(
debug_assert_eq!(args.len(), 0);
dict_empty(env, scope)
}
DictInsert => {
debug_assert_eq!(args.len(), 3);
let (dict, _) = load_symbol_and_layout(scope, &args[0]);
let (key, key_layout) = load_symbol_and_layout(scope, &args[1]);
let (value, value_layout) = load_symbol_and_layout(scope, &args[2]);
dict_insert(env, scope, dict, key, key_layout, value, value_layout)
}
}
}

View file

@ -50,6 +50,18 @@ pub fn dict_empty<'a, 'ctx, 'env>(
zig_dict_to_struct(env, result).into()
}
pub fn dict_insert<'a, 'ctx, 'env>(
_env: &Env<'a, 'ctx, 'env>,
_scope: &Scope<'a, 'ctx>,
_dict: BasicValueEnum<'ctx>,
_key: BasicValueEnum<'ctx>,
_key_layout: &Layout<'a>,
_value: BasicValueEnum<'ctx>,
_value_layout: &Layout<'a>,
) -> BasicValueEnum<'ctx> {
todo!()
}
fn dict_symbol_to_i128<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
scope: &Scope<'a, 'ctx>,