mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-21 07:49:17 +03:00
fix: FunctionDef was size 40
This commit is contained in:
parent
510c70d326
commit
4f376819b2
@ -270,17 +270,17 @@ impl ShallowClone for ValueDef {
|
||||
#[derive(Debug)]
|
||||
pub enum FunctionDef {
|
||||
WithAnnotation {
|
||||
name: Symbol, // 8B
|
||||
arguments: PoolVec<(Pattern2, Type2)>, // 8B
|
||||
rigids: NodeId<Rigids>, // 4B
|
||||
return_type: TypeId, // 4B
|
||||
body: ExprId, // 4B
|
||||
name: Symbol, // 8B
|
||||
arguments: PoolVec<(PatternId, Type2)>, // 8B
|
||||
rigids: NodeId<Rigids>, // 4B
|
||||
return_type: TypeId, // 4B
|
||||
body: ExprId, // 4B
|
||||
},
|
||||
NoAnnotation {
|
||||
name: Symbol, // 8B
|
||||
arguments: PoolVec<(Pattern2, Variable)>, // 8B
|
||||
return_var: Variable, // 4B
|
||||
body: ExprId, // 4B
|
||||
name: Symbol, // 8B
|
||||
arguments: PoolVec<(PatternId, Variable)>, // 8B
|
||||
return_var: Variable, // 4B
|
||||
body: ExprId, // 4B
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -514,7 +514,7 @@ fn canonicalize_pending_def<'a>(
|
||||
// parent commit for the bug this fixed!
|
||||
let refs = References::new();
|
||||
|
||||
let arguments: PoolVec<(Pattern2, Type2)> =
|
||||
let arguments: PoolVec<(PatternId, Type2)> =
|
||||
PoolVec::with_capacity(closure_args.len() as u32, env.pool);
|
||||
|
||||
let return_type: TypeId;
|
||||
@ -551,9 +551,7 @@ fn canonicalize_pending_def<'a>(
|
||||
for (node_id, ((_, pattern_id), typ)) in
|
||||
arguments.iter_node_ids().zip(it.into_iter())
|
||||
{
|
||||
let pattern = &env.pool[pattern_id];
|
||||
|
||||
env.pool[node_id] = (pattern.shallow_clone(), typ);
|
||||
env.pool[node_id] = (pattern_id, typ);
|
||||
}
|
||||
|
||||
return_type = return_type_id;
|
||||
@ -683,16 +681,14 @@ fn canonicalize_pending_def<'a>(
|
||||
// parent commit for the bug this fixed!
|
||||
let refs = References::new();
|
||||
|
||||
let arguments: PoolVec<(Pattern2, Variable)> =
|
||||
let arguments: PoolVec<(PatternId, Variable)> =
|
||||
PoolVec::with_capacity(closure_args.len() as u32, env.pool);
|
||||
|
||||
let it: Vec<_> = closure_args.iter(env.pool).map(|(x, y)| (*x, *y)).collect();
|
||||
|
||||
for (node_id, (_, pattern_id)) in arguments.iter_node_ids().zip(it.into_iter())
|
||||
{
|
||||
let pattern = &env.pool[pattern_id];
|
||||
|
||||
env.pool[node_id] = (pattern.shallow_clone(), env.var_store.fresh());
|
||||
env.pool[node_id] = (pattern_id, env.var_store.fresh());
|
||||
}
|
||||
|
||||
let function_def = FunctionDef::NoAnnotation {
|
||||
|
@ -13,6 +13,7 @@
|
||||
use libc::{c_void, MAP_ANONYMOUS, MAP_PRIVATE, PROT_READ, PROT_WRITE};
|
||||
use roc_can::expected::Expected;
|
||||
use roc_can::expected::PExpected;
|
||||
use std::any::type_name;
|
||||
use std::cmp::Ordering;
|
||||
use std::marker::PhantomData;
|
||||
use std::mem::size_of;
|
||||
@ -322,7 +323,12 @@ impl<'a, T: 'a + Sized> PoolVec<T> {
|
||||
}
|
||||
|
||||
pub fn with_capacity(len: u32, pool: &mut Pool) -> Self {
|
||||
debug_assert!(size_of::<T>() <= NODE_BYTES, "{}", size_of::<T>());
|
||||
debug_assert!(
|
||||
size_of::<T>() <= NODE_BYTES,
|
||||
"{} has a size of {}",
|
||||
type_name::<T>(),
|
||||
size_of::<T>()
|
||||
);
|
||||
|
||||
if len == 0 {
|
||||
Self::empty(pool)
|
||||
|
Loading…
Reference in New Issue
Block a user