rustc: Don't have type_of_arg() rely on the particular lie told by type_of()

This commit is contained in:
Patrick Walton 2011-03-02 16:13:33 -08:00
parent fc722b17c9
commit c19e4e1c29

View file

@ -621,11 +621,22 @@ fn type_of_inner(@crate_ctxt cx, @ty.t t) -> TypeRef {
}
fn type_of_arg(@crate_ctxt cx, &ty.arg arg) -> TypeRef {
auto ty = type_of_inner(cx, arg.ty);
if (arg.mode == ast.alias) {
ty = T_ptr(ty);
alt (arg.ty.struct) {
case (ty.ty_param(_)) {
if (arg.mode == ast.alias) {
ret T_typaram_ptr(cx.tn);
}
}
case (_) {
// fall through
}
}
ret ty;
auto typ = type_of_inner(cx, arg.ty);
if (arg.mode == ast.alias) {
typ = T_ptr(typ);
}
ret typ;
}
// Name sanitation. LLVM will happily accept identifiers with weird names, but