This commit is contained in:
Anton-4 2021-10-13 12:37:30 +02:00
parent 810c7dce80
commit 4828c9ba62
19 changed files with 177 additions and 143 deletions

View file

@ -1,4 +1,4 @@
use roc_module::symbol::{IdentId};
use roc_module::symbol::IdentId;
use snafu::{Backtrace, Snafu};
use crate::lang::core::ast::ASTNodeId;

View file

@ -1,9 +1,7 @@
use roc_module::symbol::IdentId;
use crate::{
lang::core::{
expr::{expr2::Expr2, expr2_to_string::expr2_to_string},
},
lang::core::expr::{expr2::Expr2, expr2_to_string::expr2_to_string},
mem_pool::pool::{NodeId, Pool},
};

View file

@ -1,14 +1,10 @@
use bumpalo::collections::Vec as BumpVec;
use bumpalo::Bump;
use roc_module::ident::{Ident, IdentStr};
use roc_parse::{parser::SyntaxError};
use roc_parse::parser::SyntaxError;
use roc_region::all::Region;
use crate::lang::{
core::{expr::expr_to_expr2::loc_expr_to_expr2},
env::Env,
scope::Scope,
};
use crate::lang::{core::expr::expr_to_expr2::loc_expr_to_expr2, env::Env, scope::Scope};
use super::def2::Def2;

View file

@ -108,11 +108,11 @@ pub enum Expr2 {
},
Closure {
args: PoolVec<(Variable, NodeId<Pattern2>)>, // 8B
uniq_symbol: Symbol, // 8B This is a globally uniqe symbol for the function, not the name of the function
body_id: ExprId, // 4B
function_type: Variable, // 4B
recursive: Recursive, // 1B
extra: NodeId<ClosureExtra>, // 4B
uniq_symbol: Symbol, // 8B This is a globally uniqe symbol for the function, not the name of the function
body_id: ExprId, // 4B
function_type: Variable, // 4B
recursive: Recursive, // 1B
extra: NodeId<ClosureExtra>, // 4B
},
// Product Types
Record {

View file

@ -18,13 +18,13 @@ pub enum FunctionDef {
arguments: PoolVec<(PatternId, Type2)>, // 8B
rigids: NodeId<Rigids>, // 4B
return_type: TypeId, // 4B
body_id: ExprId, // 4B
body_id: ExprId, // 4B
},
NoAnnotation {
name: Symbol, // 8B
arguments: PoolVec<(PatternId, Variable)>, // 8B
return_var: Variable, // 4B
body_id: ExprId, // 4B
body_id: ExprId, // 4B
},
}

View file

@ -170,15 +170,14 @@ impl<'a> Env<'a> {
}
pub fn get_name_for_ident_id(&self, ident_id: IdentId) -> ASTResult<&str> {
Ok(
self.ident_ids.get_name(ident_id).with_context(||
IdentIdNotFound {
ident_id,
env_ident_ids_str: format!("{:?}", self.ident_ids),
}
)?
Ok(self
.ident_ids
.get_name(ident_id)
.with_context(|| IdentIdNotFound {
ident_id,
env_ident_ids_str: format!("{:?}", self.ident_ids),
})?
.as_inline_str()
.as_str()
)
.as_str())
}
}