Skip to content

Commit

Permalink
Fix struct and union
Browse files Browse the repository at this point in the history
  • Loading branch information
Victorious3 committed Oct 5, 2021
1 parent db58073 commit 87b0530
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/eval.pr
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ def get(mem: *, tpe: *typechecking::Type) -> compiler::Value {
return { kind = compiler::ValueKind::BOOL, tpe = tpe, i = (@(mem !*bool)) !int64 } !compiler::Value
case typechecking::TypeKind::POINTER:
return { kind = compiler::ValueKind::POINTER, tpe = tpe, i = @(mem !*int64) } !compiler::Value
case typechecking::TypeKind::STRUCT:
case typechecking::TypeKind::UNION:
let field = tpe.biggest_field
let values = allocate(compiler::Value, 1)
values[0] = get(mem, field.tpe)
return { kind = compiler::ValueKind::STRUCT, tpe = tpe, values = values } !compiler::Value
case typechecking::TypeKind::UNION:
case typechecking::TypeKind::STRUCT:
let values = allocate(compiler::Value, tpe.fields.size)
for var i in 0..tpe.fields.size {
let field = tpe.fields[i]
Expand Down

0 comments on commit 87b0530

Please sign in to comment.