mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
fix compile issues
This commit is contained in:
parent
07d4f8dc15
commit
4e9387cbda
4 changed files with 35 additions and 14 deletions
|
@ -93,7 +93,10 @@ fn jit_to_ast_help<'a>(
|
||||||
),
|
),
|
||||||
Layout::Builtin(Builtin::EmptyList) => {
|
Layout::Builtin(Builtin::EmptyList) => {
|
||||||
Ok(run_jit_function!(lib, main_fn_name, &'static str, |_| {
|
Ok(run_jit_function!(lib, main_fn_name, &'static str, |_| {
|
||||||
Expr::List(&[])
|
Expr::List {
|
||||||
|
items: &[],
|
||||||
|
final_comments: &[],
|
||||||
|
}
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
Layout::Builtin(Builtin::List(_, elem_layout)) => Ok(run_jit_function!(
|
Layout::Builtin(Builtin::List(_, elem_layout)) => Ok(run_jit_function!(
|
||||||
|
@ -251,7 +254,10 @@ fn ptr_to_ast<'a>(
|
||||||
|
|
||||||
num_to_ast(env, f64_to_ast(env.arena, num), content)
|
num_to_ast(env, f64_to_ast(env.arena, num), content)
|
||||||
}
|
}
|
||||||
Layout::Builtin(Builtin::EmptyList) => Expr::List(&[]),
|
Layout::Builtin(Builtin::EmptyList) => Expr::List {
|
||||||
|
items: &[],
|
||||||
|
final_comments: &[],
|
||||||
|
},
|
||||||
Layout::Builtin(Builtin::List(_, elem_layout)) => {
|
Layout::Builtin(Builtin::List(_, elem_layout)) => {
|
||||||
// Turn the (ptr, len) wrapper struct into actual ptr and len values.
|
// Turn the (ptr, len) wrapper struct into actual ptr and len values.
|
||||||
let len = unsafe { *(ptr.offset(env.ptr_bytes as isize) as *const usize) };
|
let len = unsafe { *(ptr.offset(env.ptr_bytes as isize) as *const usize) };
|
||||||
|
@ -331,7 +337,10 @@ fn list_to_ast<'a>(
|
||||||
|
|
||||||
let output = output.into_bump_slice();
|
let output = output.into_bump_slice();
|
||||||
|
|
||||||
Expr::List(output)
|
Expr::List {
|
||||||
|
items: output,
|
||||||
|
final_comments: &[],
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn single_tag_union_to_ast<'a>(
|
fn single_tag_union_to_ast<'a>(
|
||||||
|
|
|
@ -285,7 +285,9 @@ pub fn canonicalize_expr<'a>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast::Expr::Str(literal) => flatten_str_literal(env, var_store, scope, literal),
|
ast::Expr::Str(literal) => flatten_str_literal(env, var_store, scope, literal),
|
||||||
ast::Expr::List(loc_elems) => {
|
ast::Expr::List {
|
||||||
|
items: loc_elems, ..
|
||||||
|
} => {
|
||||||
if loc_elems.is_empty() {
|
if loc_elems.is_empty() {
|
||||||
(
|
(
|
||||||
List {
|
List {
|
||||||
|
|
|
@ -109,14 +109,24 @@ pub fn desugar_expr<'a>(arena: &'a Bump, loc_expr: &'a Located<Expr<'a>>) -> &'a
|
||||||
|
|
||||||
arena.alloc(Located { region, value })
|
arena.alloc(Located { region, value })
|
||||||
}
|
}
|
||||||
List(elems) | Nested(List(elems)) => {
|
List {
|
||||||
let mut new_elems = Vec::with_capacity_in(elems.len(), arena);
|
items,
|
||||||
|
final_comments,
|
||||||
|
}
|
||||||
|
| Nested(List {
|
||||||
|
items,
|
||||||
|
final_comments,
|
||||||
|
}) => {
|
||||||
|
let mut new_items = Vec::with_capacity_in(items.len(), arena);
|
||||||
|
|
||||||
for elem in elems.iter() {
|
for item in items.iter() {
|
||||||
new_elems.push(desugar_expr(arena, elem));
|
new_items.push(desugar_expr(arena, item));
|
||||||
}
|
}
|
||||||
let new_elems = new_elems.into_bump_slice();
|
let new_items = new_items.into_bump_slice();
|
||||||
let value: Expr<'a> = List(new_elems);
|
let value: Expr<'a> = List {
|
||||||
|
items: new_items,
|
||||||
|
final_comments,
|
||||||
|
};
|
||||||
|
|
||||||
arena.alloc(Located {
|
arena.alloc(Located {
|
||||||
region: loc_expr.region,
|
region: loc_expr.region,
|
||||||
|
|
|
@ -285,14 +285,14 @@ pub fn to_expr2<'a>(
|
||||||
|
|
||||||
Str(literal) => flatten_str_literal(env, scope, &literal),
|
Str(literal) => flatten_str_literal(env, scope, &literal),
|
||||||
|
|
||||||
List(elements) => {
|
List { items, .. } => {
|
||||||
let mut output = Output::default();
|
let mut output = Output::default();
|
||||||
let output_ref = &mut output;
|
let output_ref = &mut output;
|
||||||
|
|
||||||
let elems = PoolVec::with_capacity(elements.len() as u32, env.pool);
|
let elems = PoolVec::with_capacity(items.len() as u32, env.pool);
|
||||||
|
|
||||||
for (node_id, element) in elems.iter_node_ids().zip(elements.iter()) {
|
for (node_id, item) in elems.iter_node_ids().zip(items.iter()) {
|
||||||
let (expr, sub_output) = to_expr2(env, scope, &element.value, element.region);
|
let (expr, sub_output) = to_expr2(env, scope, &item.value, item.region);
|
||||||
|
|
||||||
output_ref.union(sub_output);
|
output_ref.union(sub_output);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue