mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 07:41:12 +00:00
Revert "Only add builtins if they're referenced"
This reverts commit 8e9b02560e9b172def0e915631e1d116c64859f2.
This commit is contained in:
parent
d2a9d24626
commit
310595c108
1 changed files with 2 additions and 16 deletions
|
@ -1,7 +1,6 @@
|
||||||
use crate::def::Def;
|
use crate::def::Def;
|
||||||
use crate::expr::Expr;
|
use crate::expr::Expr;
|
||||||
use crate::expr::Recursive;
|
use crate::expr::Recursive;
|
||||||
use crate::procedure::References;
|
|
||||||
use roc_collections::all::SendMap;
|
use roc_collections::all::SendMap;
|
||||||
use roc_module::ident::TagName;
|
use roc_module::ident::TagName;
|
||||||
use roc_module::symbol::Symbol;
|
use roc_module::symbol::Symbol;
|
||||||
|
@ -26,21 +25,8 @@ use roc_types::subs::{VarStore, Variable};
|
||||||
/// delegates to the compiler-internal List.getUnsafe function to do the actual
|
/// delegates to the compiler-internal List.getUnsafe function to do the actual
|
||||||
/// lookup (if the bounds check passed). That internal function is hardcoded in code gen,
|
/// lookup (if the bounds check passed). That internal function is hardcoded in code gen,
|
||||||
/// which works fine because it doesn't involve any open tag unions.
|
/// which works fine because it doesn't involve any open tag unions.
|
||||||
pub fn builtin_defs(var_store: &VarStore, refs: &References) -> Vec<Def> {
|
pub fn builtin_defs(var_store: &VarStore) -> Vec<Def> {
|
||||||
let is_used = |symbol| refs.calls.contains(&symbol) || refs.lookups.contains(&symbol);
|
vec![/*list_get(var_store),*/ list_first(var_store)]
|
||||||
|
|
||||||
//
|
|
||||||
let mut builtins = Vec::with_capacity(20);
|
|
||||||
|
|
||||||
if is_used(Symbol::LIST_GET) {
|
|
||||||
builtins.push(list_get(var_store));
|
|
||||||
}
|
|
||||||
|
|
||||||
if is_used(Symbol::LIST_FIRST) {
|
|
||||||
builtins.push(list_first(var_store));
|
|
||||||
}
|
|
||||||
|
|
||||||
builtins
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// List.get : List elem, Int -> Result elem [ OutOfBounds ]*
|
/// List.get : List elem, Int -> Result elem [ OutOfBounds ]*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue