Skip to content

Commit da8058f

Browse files
committed
Handle native types in calls.
1 parent fae6870 commit da8058f

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/comp/middle/trans.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,6 +1445,7 @@ fn make_drop_glue(@block_ctxt cx, ValueRef v, @ty.t t) -> result {
14451445
bind drop_ty(_, _, _));
14461446

14471447
} else if (ty.type_is_scalar(t) ||
1448+
ty.type_is_native(t) ||
14481449
ty.type_is_nil(t)) {
14491450
ret res(cx, C_nil());
14501451
}
@@ -1927,7 +1928,7 @@ fn copy_ty(@block_ctxt cx,
19271928
ValueRef dst,
19281929
ValueRef src,
19291930
@ty.t t) -> result {
1930-
if (ty.type_is_scalar(t)) {
1931+
if (ty.type_is_scalar(t) || ty.type_is_native(t)) {
19311932
ret res(cx, cx.build.Store(src, dst));
19321933

19331934
} else if (ty.type_is_nil(t)) {
@@ -3795,7 +3796,7 @@ fn trans_expr(@block_ctxt cx, @ast.expr e) -> result {
37953796
fn load_scalar_or_boxed(@block_ctxt cx,
37963797
ValueRef v,
37973798
@ty.t t) -> ValueRef {
3798-
if (ty.type_is_scalar(t) || ty.type_is_boxed(t)) {
3799+
if (ty.type_is_scalar(t) || ty.type_is_boxed(t) || ty.type_is_native(t)) {
37993800
ret cx.build.Load(v);
38003801
} else {
38013802
ret v;

src/comp/middle/ty.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,16 @@ fn type_is_scalar(@t ty) -> bool {
465465
fail;
466466
}
467467

468+
// FIXME: should we just return true for native types in
469+
// type_is_scalar?
470+
fn type_is_native(@t ty) -> bool {
471+
alt (ty.struct) {
472+
case (ty_native) { ret true; }
473+
case (_) { ret false; }
474+
}
475+
fail;
476+
}
477+
468478
fn type_has_dynamic_size(@t ty) -> bool {
469479
alt (ty.struct) {
470480
case (ty_tup(?ts)) {

0 commit comments

Comments
 (0)