wip canonical builtins in modules

This commit is contained in:
Richard Feldman 2020-04-30 20:31:36 -04:00
parent dd3dc45b7a
commit a1750567ff
4 changed files with 63 additions and 26 deletions

View file

@ -1,8 +1,8 @@
use crate::ident::Ident;
use inlinable_string::InlinableString;
use roc_collections::all::{default_hasher, ImMap, MutMap};
use roc_collections::all::{default_hasher, ImMap, MutMap, MutSet};
use roc_region::all::Region;
use std::collections::HashMap;
use std::collections::{HashMap, HashSet};
use std::{fmt, u32};
// TODO: benchmark this as { ident_id: u32, module_id: u32 } and see if perf stays the same
@ -496,6 +496,16 @@ macro_rules! define_builtins {
self.0 < $total
}
pub fn default_imports() -> MutSet<ModuleId> {
let mut all = HashSet::with_capacity_and_hasher($total, default_hasher());
$(
all.insert(ModuleId($module_id));
)+
all
}
$(
pub const $module_const: ModuleId = ModuleId($module_id);
)+