rustc: Add region-annoted type parameters to the AST; stub associated patterns

This commit is contained in:
Patrick Walton 2012-03-08 10:49:43 -08:00
parent c09e339133
commit 6224fdcd08
5 changed files with 933 additions and 834 deletions

File diff suppressed because it is too large Load Diff

View File

@ -319,6 +319,9 @@ fn ast_ty_to_ty(tcx: ty::ctxt, mode: mode, &&ast_ty: @ast::ty) -> ty::t {
ast::ty_ptr(mt) {
ty::mk_ptr(tcx, ast_mt_to_mt(tcx, mode, mt))
}
ast::ty_rptr(_,_) {
fail "TODO: regions";
}
ast::ty_tup(fields) {
let flds = vec::map(fields, bind ast_ty_to_ty(tcx, mode, _));
ty::mk_tup(tcx, flds)

View File

@ -339,6 +339,12 @@ enum prim_ty {
ty_bool,
}
enum region {
re_inferred,
re_named(ident),
re_self
}
enum ty_ {
ty_nil,
ty_bot, /* bottom type */
@ -346,6 +352,7 @@ enum ty_ {
ty_uniq(mt),
ty_vec(mt),
ty_ptr(mt),
ty_rptr(region, mt),
ty_rec([ty_field]),
ty_fn(proto, fn_decl),
ty_tup([@ty]),

View File

@ -479,6 +479,7 @@ fn noop_fold_ty(t: ty_, fld: ast_fold) -> ty_ {
ty_uniq(mt) {ty_uniq(fold_mt(mt, fld))}
ty_vec(mt) {ty_vec(fold_mt(mt, fld))}
ty_ptr(mt) {ty_ptr(fold_mt(mt, fld))}
ty_rptr(region, mt) {ty_rptr(region, fold_mt(mt, fld))}
ty_rec(fields) {ty_rec(vec::map(fields) {|f| fold_field(f, fld)})}
ty_fn(proto, decl) {ty_fn(proto, fold_fn_decl(decl, fld))}
ty_tup(tys) {ty_tup(vec::map(tys) {|ty| fld.fold_ty(ty)})}

View File

@ -332,6 +332,7 @@ fn print_type(s: ps, &&ty: @ast::ty) {
word(s.s, "]");
}
ast::ty_ptr(mt) { word(s.s, "*"); print_mt(s, mt); }
ast::ty_rptr(region, mt) { fail "TODO"; }
ast::ty_rec(fields) {
word(s.s, "{");
fn print_field(s: ps, f: ast::ty_field) {