Handle native types in calls.
This commit is contained in:
parent
fae6870d05
commit
da8058ff83
@ -1445,6 +1445,7 @@ fn make_drop_glue(@block_ctxt cx, ValueRef v, @ty.t t) -> result {
|
||||
bind drop_ty(_, _, _));
|
||||
|
||||
} else if (ty.type_is_scalar(t) ||
|
||||
ty.type_is_native(t) ||
|
||||
ty.type_is_nil(t)) {
|
||||
ret res(cx, C_nil());
|
||||
}
|
||||
@ -1927,7 +1928,7 @@ fn copy_ty(@block_ctxt cx,
|
||||
ValueRef dst,
|
||||
ValueRef src,
|
||||
@ty.t t) -> result {
|
||||
if (ty.type_is_scalar(t)) {
|
||||
if (ty.type_is_scalar(t) || ty.type_is_native(t)) {
|
||||
ret res(cx, cx.build.Store(src, dst));
|
||||
|
||||
} else if (ty.type_is_nil(t)) {
|
||||
@ -3795,7 +3796,7 @@ fn trans_expr(@block_ctxt cx, @ast.expr e) -> result {
|
||||
fn load_scalar_or_boxed(@block_ctxt cx,
|
||||
ValueRef v,
|
||||
@ty.t t) -> ValueRef {
|
||||
if (ty.type_is_scalar(t) || ty.type_is_boxed(t)) {
|
||||
if (ty.type_is_scalar(t) || ty.type_is_boxed(t) || ty.type_is_native(t)) {
|
||||
ret cx.build.Load(v);
|
||||
} else {
|
||||
ret v;
|
||||
|
@ -465,6 +465,16 @@ fn type_is_scalar(@t ty) -> bool {
|
||||
fail;
|
||||
}
|
||||
|
||||
// FIXME: should we just return true for native types in
|
||||
// type_is_scalar?
|
||||
fn type_is_native(@t ty) -> bool {
|
||||
alt (ty.struct) {
|
||||
case (ty_native) { ret true; }
|
||||
case (_) { ret false; }
|
||||
}
|
||||
fail;
|
||||
}
|
||||
|
||||
fn type_has_dynamic_size(@t ty) -> bool {
|
||||
alt (ty.struct) {
|
||||
case (ty_tup(?ts)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user