extend with ty_send_type and ty_opaque_closure

This commit is contained in:
Niko Matsakis 2011-12-15 14:30:19 -08:00
parent b5e5043d5d
commit 52f76400b5
4 changed files with 11 additions and 2 deletions

View File

@ -294,6 +294,8 @@ fn parse_ty(st: @pstate, sd: str_def) -> ty::t {
'X' { ret ty::mk_var(st.tcx, parse_int(st)); }
'E' { let def = parse_def(st, sd); ret ty::mk_native(st.tcx, def); }
'Y' { ret ty::mk_type(st.tcx); }
'y' { ret ty::mk_send_type(st.tcx); }
'C' { ret ty::mk_opaque_closure(st.tcx); }
'#' {
let pos = parse_hex(st);
assert (next(st) as char == ':');

View File

@ -183,6 +183,8 @@ fn enc_sty(w: io::writer, cx: @ctxt, st: ty::sty) {
w.write_str(uint::str(id));
}
ty::ty_type. { w.write_char('Y'); }
ty::ty_send_type. { w.write_char('y'); }
ty::ty_opaque_closure. { w.write_char('C'); }
ty::ty_constr(ty, cs) {
w.write_str("A[");
enc_ty(w, cx, ty);

View File

@ -305,7 +305,7 @@ fn shape_of(ccx: @crate_ctxt, t: ty::t, ty_param_map: [uint],
ty::ty_int(ast::ty_i.) { s += [s_int(ccx.tcx)]; }
ty::ty_float(ast::ty_f.) { s += [s_float(ccx.tcx)]; }
ty::ty_uint(ast::ty_u.) | ty::ty_ptr(_) | ty::ty_type. |
ty::ty_native(_) { s += [s_uint(ccx.tcx)]; }
ty::ty_send_type. | ty::ty_native(_) { s += [s_uint(ccx.tcx)]; }
ty::ty_int(ast::ty_i8.) { s += [shape_i8]; }
ty::ty_uint(ast::ty_u16.) { s += [shape_u16]; }
ty::ty_int(ast::ty_i16.) { s += [shape_i16]; }

View File

@ -192,7 +192,7 @@ fn type_of_inner(cx: @crate_ctxt, sp: span, t: ty::t)
std::util::unreachable()
}
ty::ty_param(_, _) { T_typaram(cx.tn) }
ty::ty_type. { T_ptr(cx.tydesc_type) }
ty::ty_send_type. | ty::ty_type. { T_ptr(cx.tydesc_type) }
ty::ty_tup(elts) {
let tys = [];
for elt in elts {
@ -204,6 +204,11 @@ fn type_of_inner(cx: @crate_ctxt, sp: span, t: ty::t)
ty::ty_opaque_closure. {
T_opaque_closure(cx)
}
_ {
log_err ("type_of_inner not implemented for ",
ty::struct(cx.tcx, t));
fail "type_of_inner not implemented for this kind of type";
}
};
cx.lltypes.insert(t, llty);
ret llty;