More instances of Map renamed to Dict

This commit is contained in:
Chadtech 2020-12-08 01:40:08 -05:00
parent 197d3c3c81
commit 4dbd4fa893
4 changed files with 11 additions and 11 deletions

View File

@ -158,7 +158,7 @@ pub fn basic_type_from_layout<'ctx>(
Float64 => context.f64_type().as_basic_type_enum(),
Float32 => context.f32_type().as_basic_type_enum(),
Float16 => context.f16_type().as_basic_type_enum(),
Map(_, _) | EmptyMap => panic!("TODO layout_to_basic_type for Builtin::Map"),
Dict(_, _) | EmptyMap => panic!("TODO layout_to_basic_type for Builtin::Dict"),
Set(_) | EmptySet => panic!("TODO layout_to_basic_type for Builtin::Set"),
List(_, _) | Str | EmptyStr => collection(context, ptr_bytes).into(),
EmptyList => BasicTypeEnum::StructType(collection(context, ptr_bytes)),

View File

@ -400,7 +400,7 @@ fn decrement_refcount_builtin<'a, 'ctx, 'env>(
}
todo!();
}
Map(key_layout, value_layout) => {
Dict(key_layout, value_layout) => {
if key_layout.contains_refcounted() || value_layout.contains_refcounted() {
// TODO decrement all values
}
@ -483,7 +483,7 @@ fn increment_refcount_builtin<'a, 'ctx, 'env>(
}
todo!();
}
Map(key_layout, value_layout) => {
Dict(key_layout, value_layout) => {
if key_layout.contains_refcounted() || value_layout.contains_refcounted() {
// TODO decrement all values
}

View File

@ -278,7 +278,7 @@ pub enum Builtin<'a> {
Float32,
Float16,
Str,
Map(&'a Layout<'a>, &'a Layout<'a>),
Dict(&'a Layout<'a>, &'a Layout<'a>),
Set(&'a Layout<'a>),
List(MemoryMode, &'a Layout<'a>),
EmptyStr,
@ -627,8 +627,8 @@ impl<'a> Builtin<'a> {
/// Number of machine words in an empty one of these
pub const STR_WORDS: u32 = 2;
pub const MAP_WORDS: u32 = 6;
pub const SET_WORDS: u32 = Builtin::MAP_WORDS; // Set is an alias for Map with {} for value
pub const DICT_WORDS: u32 = 6;
pub const SET_WORDS: u32 = Builtin::DICT_WORDS; // Set is an alias for Map with {} for value
pub const LIST_WORDS: u32 = 2;
/// Layout of collection wrapper for List and Str - a struct of (pointer, length).
@ -653,7 +653,7 @@ impl<'a> Builtin<'a> {
Float32 => Builtin::F32_SIZE,
Float16 => Builtin::F16_SIZE,
Str | EmptyStr => Builtin::STR_WORDS * pointer_size,
Map(_, _) | EmptyMap => Builtin::MAP_WORDS * pointer_size,
Dict(_, _) | EmptyMap => Builtin::DICT_WORDS * pointer_size,
Set(_) | EmptySet => Builtin::SET_WORDS * pointer_size,
List(_, _) | EmptyList => Builtin::LIST_WORDS * pointer_size,
}
@ -678,7 +678,7 @@ impl<'a> Builtin<'a> {
Float32 => align_of::<f32>() as u32,
Float16 => align_of::<i16>() as u32,
Str | EmptyStr => pointer_size,
Map(_, _) | EmptyMap => pointer_size,
Dict(_, _) | EmptyMap => pointer_size,
Set(_) | EmptySet => pointer_size,
List(_, _) | EmptyList => pointer_size,
}
@ -690,7 +690,7 @@ impl<'a> Builtin<'a> {
match self {
Int128 | Int64 | Int32 | Int16 | Int8 | Int1 | Float128 | Float64 | Float32
| Float16 | EmptyStr | EmptyMap | EmptyList | EmptySet => true,
Str | Map(_, _) | Set(_) | List(_, _) => false,
Str | Dict(_, _) | Set(_) | List(_, _) => false,
}
}
@ -706,7 +706,7 @@ impl<'a> Builtin<'a> {
MemoryMode::Unique => element_layout.contains_refcounted(),
},
Str | Map(_, _) | Set(_) => true,
Str | Dict(_, _) | Set(_) => true,
}
}
}

View File

@ -48,7 +48,7 @@ fn main() {
generate(
vec![
PathBuf::from(r"../compiler/builtins/docs/Bool.roc"),
PathBuf::from(r"../compiler/builtins/docs/Map.roc"),
PathBuf::from(r"../compiler/builtins/docs/Dict.roc"),
// Not working
// PathBuf::from(r"../compiler/builtins/docs/List.roc"),
// Not working