mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 14:54:47 +00:00
Passed result layout down build expr function
This commit is contained in:
parent
5da2d78cb9
commit
0a1e297b0f
2 changed files with 7 additions and 3 deletions
|
@ -298,6 +298,7 @@ pub fn build_exp_expr<'a, 'ctx, 'env>(
|
||||||
layout_ids: &mut LayoutIds<'a>,
|
layout_ids: &mut LayoutIds<'a>,
|
||||||
scope: &Scope<'a, 'ctx>,
|
scope: &Scope<'a, 'ctx>,
|
||||||
parent: FunctionValue<'ctx>,
|
parent: FunctionValue<'ctx>,
|
||||||
|
layout: &Layout<'a>,
|
||||||
expr: &roc_mono::ir::Expr<'a>,
|
expr: &roc_mono::ir::Expr<'a>,
|
||||||
) -> BasicValueEnum<'ctx> {
|
) -> BasicValueEnum<'ctx> {
|
||||||
use roc_mono::ir::CallType::*;
|
use roc_mono::ir::CallType::*;
|
||||||
|
@ -305,7 +306,7 @@ pub fn build_exp_expr<'a, 'ctx, 'env>(
|
||||||
|
|
||||||
match expr {
|
match expr {
|
||||||
Literal(literal) => build_exp_literal(env, literal),
|
Literal(literal) => build_exp_literal(env, literal),
|
||||||
RunLowLevel(op, symbols) => run_low_level(env, scope, parent, *op, symbols),
|
RunLowLevel(op, symbols) => run_low_level(env, scope, parent, layout, *op, symbols),
|
||||||
|
|
||||||
FunctionCall {
|
FunctionCall {
|
||||||
call_type: ByName(name),
|
call_type: ByName(name),
|
||||||
|
@ -832,7 +833,7 @@ pub fn build_exp_stmt<'a, 'ctx, 'env>(
|
||||||
Let(symbol, expr, layout, cont) => {
|
Let(symbol, expr, layout, cont) => {
|
||||||
let context = &env.context;
|
let context = &env.context;
|
||||||
|
|
||||||
let val = build_exp_expr(env, layout_ids, &scope, parent, &expr);
|
let val = build_exp_expr(env, layout_ids, &scope, parent, layout, &expr);
|
||||||
let expr_bt = if let Layout::RecursivePointer = layout {
|
let expr_bt = if let Layout::RecursivePointer = layout {
|
||||||
match expr {
|
match expr {
|
||||||
Expr::AccessAtIndex { field_layouts, .. } => {
|
Expr::AccessAtIndex { field_layouts, .. } => {
|
||||||
|
@ -1496,6 +1497,7 @@ fn run_low_level<'a, 'ctx, 'env>(
|
||||||
env: &Env<'a, 'ctx, 'env>,
|
env: &Env<'a, 'ctx, 'env>,
|
||||||
scope: &Scope<'a, 'ctx>,
|
scope: &Scope<'a, 'ctx>,
|
||||||
parent: FunctionValue<'ctx>,
|
parent: FunctionValue<'ctx>,
|
||||||
|
layout: &Layout<'a>,
|
||||||
op: LowLevel,
|
op: LowLevel,
|
||||||
args: &[Symbol],
|
args: &[Symbol],
|
||||||
) -> BasicValueEnum<'ctx> {
|
) -> BasicValueEnum<'ctx> {
|
||||||
|
@ -1526,7 +1528,7 @@ fn run_low_level<'a, 'ctx, 'env>(
|
||||||
|
|
||||||
let (arg, arg_layout) = load_symbol_and_layout(env, scope, &args[0]);
|
let (arg, arg_layout) = load_symbol_and_layout(env, scope, &args[0]);
|
||||||
|
|
||||||
list_single(env, arg, arg_layout)
|
list_single(env, layout, arg, arg_layout)
|
||||||
}
|
}
|
||||||
ListRepeat => {
|
ListRepeat => {
|
||||||
// List.repeat : Int, elem -> List elem
|
// List.repeat : Int, elem -> List elem
|
||||||
|
|
|
@ -17,6 +17,7 @@ fn get_list_element_type<'a, 'b>(layout: &'b Layout<'a>) -> Option<&'b Layout<'a
|
||||||
/// List.single : a -> List a
|
/// List.single : a -> List a
|
||||||
pub fn list_single<'a, 'ctx, 'env>(
|
pub fn list_single<'a, 'ctx, 'env>(
|
||||||
env: &Env<'a, 'ctx, 'env>,
|
env: &Env<'a, 'ctx, 'env>,
|
||||||
|
layout: &Layout<'a>,
|
||||||
elem: BasicValueEnum<'ctx>,
|
elem: BasicValueEnum<'ctx>,
|
||||||
elem_layout: &Layout<'a>,
|
elem_layout: &Layout<'a>,
|
||||||
) -> BasicValueEnum<'ctx> {
|
) -> BasicValueEnum<'ctx> {
|
||||||
|
@ -1631,6 +1632,7 @@ pub fn clone_list<'a, 'ctx, 'env>(
|
||||||
|
|
||||||
pub fn allocate_list<'a, 'ctx, 'env>(
|
pub fn allocate_list<'a, 'ctx, 'env>(
|
||||||
env: &Env<'a, 'ctx, 'env>,
|
env: &Env<'a, 'ctx, 'env>,
|
||||||
|
// in_place: InPlace,
|
||||||
elem_layout: &Layout<'a>,
|
elem_layout: &Layout<'a>,
|
||||||
length: IntValue<'ctx>,
|
length: IntValue<'ctx>,
|
||||||
) -> PointerValue<'ctx> {
|
) -> PointerValue<'ctx> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue