mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 15:21:12 +00:00
Handle builtin defs in canonicalize_module_defs
This commit is contained in:
parent
468deebaa3
commit
6b183b1bcc
2 changed files with 13 additions and 12 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
use crate::builtins;
|
||||||
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;
|
||||||
|
@ -259,6 +260,15 @@ pub fn canonicalize_module_defs<'a>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add builtin defs (e.g. List.get) to the module's defs
|
||||||
|
let builtin_defs = builtins::builtin_defs(var_store);
|
||||||
|
|
||||||
|
for (symbol, def) in builtin_defs {
|
||||||
|
if references.contains(&symbol) {
|
||||||
|
declarations.push(Declaration::Builtin(def));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Ok(ModuleOutput {
|
Ok(ModuleOutput {
|
||||||
aliases,
|
aliases,
|
||||||
rigid_variables,
|
rigid_variables,
|
||||||
|
|
|
@ -2020,7 +2020,8 @@ fn parse_and_constrain<'a>(
|
||||||
let module_id = header.module_id;
|
let module_id = header.module_id;
|
||||||
|
|
||||||
// Generate documentation information
|
// Generate documentation information
|
||||||
// TODO: store timing information?
|
// TODO: store timing information
|
||||||
|
// TODO: only run this if we're doing a doc gen pass!
|
||||||
let module_docs = crate::docs::generate_module_docs(
|
let module_docs = crate::docs::generate_module_docs(
|
||||||
header.module_name,
|
header.module_name,
|
||||||
&header.exposed_ident_ids,
|
&header.exposed_ident_ids,
|
||||||
|
@ -2041,17 +2042,7 @@ fn parse_and_constrain<'a>(
|
||||||
);
|
);
|
||||||
let canonicalize_end = SystemTime::now();
|
let canonicalize_end = SystemTime::now();
|
||||||
let (module, declarations, ident_ids, constraint, problems) = match canonicalized {
|
let (module, declarations, ident_ids, constraint, problems) = match canonicalized {
|
||||||
Ok(mut module_output) => {
|
Ok(module_output) => {
|
||||||
// Add builtin defs (e.g. List.get) to the module's defs
|
|
||||||
let builtin_defs = roc_can::builtins::builtin_defs(&mut var_store);
|
|
||||||
let references = &module_output.references;
|
|
||||||
|
|
||||||
for (symbol, def) in builtin_defs {
|
|
||||||
if references.contains(&symbol) {
|
|
||||||
module_output.declarations.push(Declaration::Builtin(def));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let constraint = constrain_module(&module_output, module_id, mode, &mut var_store);
|
let constraint = constrain_module(&module_output, module_id, mode, &mut var_store);
|
||||||
|
|
||||||
// Now that we're done with parsing, canonicalization, and constraint gen,
|
// Now that we're done with parsing, canonicalization, and constraint gen,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue