mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 08:34:33 +00:00
fix passing functions by name
This commit is contained in:
parent
c51345ac8b
commit
020b6154f9
6 changed files with 372 additions and 297 deletions
|
@ -213,9 +213,24 @@ fn consume_expr(m: &VarMap, e: &Expr<'_>) -> bool {
|
|||
|
||||
impl<'a> Context<'a> {
|
||||
pub fn new(arena: &'a Bump, param_map: &'a ParamMap<'a>) -> Self {
|
||||
let mut vars = MutMap::default();
|
||||
|
||||
for (key, _) in param_map.into_iter() {
|
||||
if let crate::borrow::Key::Declaration(symbol) = key {
|
||||
vars.insert(
|
||||
*symbol,
|
||||
VarInfo {
|
||||
reference: false, // assume function symbols are global constants
|
||||
persistent: true, // assume function symbols are global constants
|
||||
consume: false, // no need to consume this variable
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Self {
|
||||
arena,
|
||||
vars: MutMap::default(),
|
||||
vars,
|
||||
jp_live_vars: MutMap::default(),
|
||||
local_context: LocalContext::default(),
|
||||
param_map,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue