提交 865dcb66 编写于 作者: B Brian Anderson

Parse unique box types

Issue #409
上级 be1feaa9
......@@ -285,6 +285,9 @@ fn instantiate(tcx: ty::ctxt, sp: span, getter: ty_getter,
ast::ty_box(mt) {
typ = ty::mk_box(tcx, ast_mt_to_mt(tcx, getter, mt));
}
ast::ty_uniq(mt) {
typ = ty::mk_uniq(tcx, ast_ty_to_ty(tcx, getter, mt.ty));
}
ast::ty_vec(mt) {
typ = ty::mk_vec(tcx, ast_mt_to_mt(tcx, getter, mt));
}
......
......@@ -307,6 +307,7 @@
ty_char;
ty_str;
ty_box(mt);
ty_uniq(mt);
ty_vec(mt);
ty_ptr(mt);
ty_task;
......
......@@ -540,6 +540,11 @@ fn parse_ty(p: parser, colons_before_params: bool) -> @ast::ty {
let mt = parse_mt(p);
hi = mt.ty.span.hi;
t = ast::ty_box(mt);
} else if p.peek() == token::TILDE {
p.bump();
let mt = parse_mt(p);
hi = mt.ty.span.hi;
t = ast::ty_uniq(mt);
} else if p.peek() == token::BINOP(token::STAR) {
p.bump();
let mt = parse_mt(p);
......
......@@ -260,6 +260,7 @@ fn print_type(s: ps, ty: @ast::ty) {
ast::ty_char. { word(s.s, "char"); }
ast::ty_str. { word(s.s, "str"); }
ast::ty_box(mt) { word(s.s, "@"); print_mt(s, mt); }
ast::ty_uniq(mt) { word(s.s, "~"); print_mt(s, mt); }
ast::ty_vec(mt) {
word(s.s, "[");
alt mt.mut {
......
......@@ -121,6 +121,7 @@ fn visit_ty<E>(t: @ty, e: E, v: vt<E>) {
ty_char. {/* no-op */ }
ty_str. {/* no-op */ }
ty_box(mt) { v.visit_ty(mt.ty, e, v); }
ty_uniq(mt) { v.visit_ty(mt.ty, e, v); }
ty_vec(mt) { v.visit_ty(mt.ty, e, v); }
ty_ptr(mt) { v.visit_ty(mt.ty, e, v); }
ty_port(t) { v.visit_ty(t, e, v); }
......
fn main() {
let _: ~int;
}
fn f(i: ~int) -> ~int {
fail;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册