mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
make Tag arguments into symbols
This commit is contained in:
parent
a8bfd90a50
commit
2a0b010a74
3 changed files with 38 additions and 17 deletions
|
@ -453,11 +453,12 @@ pub fn build_expr<'a, 'ctx, 'env>(
|
|||
let mut field_types = Vec::with_capacity_in(num_fields, env.arena);
|
||||
let mut field_vals = Vec::with_capacity_in(num_fields, env.arena);
|
||||
|
||||
for (field_expr, field_layout) in it {
|
||||
for (field_symbol, field_layout) in it {
|
||||
// Zero-sized fields have no runtime representation.
|
||||
// The layout of the struct expects them to be dropped!
|
||||
if field_layout.stack_size(ptr_bytes) != 0 {
|
||||
let val = build_expr(env, layout_ids, &scope, parent, field_expr);
|
||||
let val = load_symbol(env, scope, field_symbol);
|
||||
|
||||
let field_type = basic_type_from_layout(
|
||||
env.arena,
|
||||
env.context,
|
||||
|
@ -507,13 +508,13 @@ pub fn build_expr<'a, 'ctx, 'env>(
|
|||
let mut field_types = Vec::with_capacity_in(num_fields, env.arena);
|
||||
let mut field_vals = Vec::with_capacity_in(num_fields, env.arena);
|
||||
|
||||
for (field_expr, field_layout) in arguments.iter() {
|
||||
for (field_symbol, field_layout) in arguments.iter() {
|
||||
let field_size = field_layout.stack_size(ptr_size);
|
||||
|
||||
// Zero-sized fields have no runtime representation.
|
||||
// The layout of the struct expects them to be dropped!
|
||||
if field_size != 0 {
|
||||
let val = build_expr(env, layout_ids, &scope, parent, field_expr);
|
||||
let val = load_symbol(env, scope, field_symbol);
|
||||
let field_type =
|
||||
basic_type_from_layout(env.arena, env.context, &field_layout, ptr_size);
|
||||
|
||||
|
@ -684,7 +685,7 @@ pub fn build_expr<'a, 'ctx, 'env>(
|
|||
None => panic!("There was no entry for {:?} in scope {:?}", symbol, scope),
|
||||
Some((layout, ptr)) => {
|
||||
match layout {
|
||||
Layout::Builtin(Builtin::List(Ownership::Owned, _elem_layout)) => {
|
||||
Layout::Builtin(Builtin::List(Ownership::Owned, _elem_layout)) if false => {
|
||||
// first run the body
|
||||
let body = build_expr(env, layout_ids, scope, parent, expr);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue