mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 07:14:46 +00:00
Merge branch 'trunk' of github.com:rtfeldman/roc into str-split
This commit is contained in:
commit
415a37a891
86 changed files with 5156 additions and 2360 deletions
|
@ -25,7 +25,7 @@ pub struct Env<'a> {
|
|||
pub tailcallable_symbol: Option<Symbol>,
|
||||
|
||||
/// Symbols which were referenced by qualified lookups.
|
||||
pub referenced_symbols: MutSet<Symbol>,
|
||||
pub qualified_lookups: MutSet<Symbol>,
|
||||
|
||||
pub ident_ids: IdentIds,
|
||||
pub exposed_ident_ids: IdentIds,
|
||||
|
@ -46,7 +46,7 @@ impl<'a> Env<'a> {
|
|||
exposed_ident_ids,
|
||||
problems: Vec::new(),
|
||||
closures: MutMap::default(),
|
||||
referenced_symbols: MutSet::default(),
|
||||
qualified_lookups: MutSet::default(),
|
||||
tailcallable_symbol: None,
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ impl<'a> Env<'a> {
|
|||
Some(ident_id) => {
|
||||
let symbol = Symbol::new(module_id, *ident_id);
|
||||
|
||||
self.referenced_symbols.insert(symbol);
|
||||
self.qualified_lookups.insert(symbol);
|
||||
|
||||
Ok(symbol)
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ impl<'a> Env<'a> {
|
|||
Some(ident_id) => {
|
||||
let symbol = Symbol::new(module_id, *ident_id);
|
||||
|
||||
self.referenced_symbols.insert(symbol);
|
||||
self.qualified_lookups.insert(symbol);
|
||||
|
||||
Ok(symbol)
|
||||
}
|
||||
|
|
|
@ -126,6 +126,7 @@ pub enum Expr {
|
|||
},
|
||||
/// field accessor as a function, e.g. (.foo) expr
|
||||
Accessor {
|
||||
function_var: Variable,
|
||||
record_var: Variable,
|
||||
closure_var: Variable,
|
||||
ext_var: Variable,
|
||||
|
@ -550,6 +551,7 @@ pub fn canonicalize_expr<'a>(
|
|||
}
|
||||
ast::Expr::AccessorFunction(field) => (
|
||||
Accessor {
|
||||
function_var: var_store.fresh(),
|
||||
record_var: var_store.fresh(),
|
||||
ext_var: var_store.fresh(),
|
||||
closure_var: var_store.fresh(),
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
use crate::builtins::builtin_defs;
|
||||
use crate::def::{canonicalize_defs, sort_can_defs, Declaration};
|
||||
use crate::env::Env;
|
||||
use crate::expr::Output;
|
||||
|
@ -115,7 +114,7 @@ pub fn canonicalize_module_defs<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
let (mut defs, _scope, output, symbols_introduced) = canonicalize_defs(
|
||||
let (defs, _scope, output, symbols_introduced) = canonicalize_defs(
|
||||
&mut env,
|
||||
Output::default(),
|
||||
var_store,
|
||||
|
@ -149,17 +148,12 @@ pub fn canonicalize_module_defs<'a>(
|
|||
}
|
||||
|
||||
// Gather up all the symbols that were referenced from other modules.
|
||||
for symbol in env.referenced_symbols.iter() {
|
||||
for symbol in env.qualified_lookups.iter() {
|
||||
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);
|
||||
}
|
||||
}
|
||||
// NOTE previously we inserted builtin defs into the list of defs here
|
||||
// this is now done later, in file.rs.
|
||||
|
||||
match sort_can_defs(&mut env, defs, Output::default()) {
|
||||
(Ok(declarations), output) => {
|
||||
|
@ -250,6 +244,11 @@ pub fn canonicalize_module_defs<'a>(
|
|||
references.insert(symbol);
|
||||
}
|
||||
|
||||
// Gather up all the symbols that were referenced from other modules.
|
||||
for symbol in env.qualified_lookups.iter() {
|
||||
references.insert(*symbol);
|
||||
}
|
||||
|
||||
Ok(ModuleOutput {
|
||||
aliases,
|
||||
rigid_variables,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue