mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
Use builtin defs in modules
This commit is contained in:
parent
e1fdabd5ef
commit
dd6973d75e
1 changed files with 10 additions and 1 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
use crate::builtins::builtin_defs;
|
||||||
use crate::def::{canonicalize_defs, sort_can_defs, Declaration};
|
use crate::def::{canonicalize_defs, sort_can_defs, Declaration};
|
||||||
use crate::env::Env;
|
use crate::env::Env;
|
||||||
use crate::expr::Output;
|
use crate::expr::Output;
|
||||||
|
@ -114,7 +115,7 @@ pub fn canonicalize_module_defs<'a>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let (defs, _scope, output, symbols_introduced) = canonicalize_defs(
|
let (mut defs, _scope, output, symbols_introduced) = canonicalize_defs(
|
||||||
&mut env,
|
&mut env,
|
||||||
Output::default(),
|
Output::default(),
|
||||||
var_store,
|
var_store,
|
||||||
|
@ -152,6 +153,14 @@ pub fn canonicalize_module_defs<'a>(
|
||||||
references.insert(*symbol);
|
references.insert(*symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add defs for any referenced builtins.
|
||||||
|
for (symbol, def) in builtin_defs(var_store) {
|
||||||
|
if output.references.lookups.contains(&symbol) || output.references.calls.contains(&symbol)
|
||||||
|
{
|
||||||
|
defs.can_defs_by_symbol.insert(symbol, def);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
match sort_can_defs(&mut env, defs, Output::default()) {
|
match sort_can_defs(&mut env, defs, Output::default()) {
|
||||||
(Ok(declarations), output) => {
|
(Ok(declarations), output) => {
|
||||||
use crate::def::Declaration::*;
|
use crate::def::Declaration::*;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue