提交 ad592787 编写于 作者: J Jared Roesch

Add a macro invocation to the type AST

Reapplied the changes from https://github.com/freebroccolo/rust/commit/dc64b731d7f66c2b43d5e5e8c721be7bd3b59540
to a clean branch of master
上级 6afb8f58
......@@ -1662,6 +1662,9 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx>,
// handled specially and will not descend into this routine.
this.ty_infer(None, None, None, ast_ty.span)
}
ast::TyMac(_) => {
tcx.sess.span_bug(m.span, "unexpanded type macro found conversion")
}
};
tcx.ast_ty_to_ty_cache.borrow_mut().insert(ast_ty.id, typ);
......
......@@ -1611,6 +1611,9 @@ fn clean(&self, cx: &DocContext) -> Type {
TyTypeof(..) => {
panic!("Unimplemented type {:?}", self.node)
},
TyMac(..) => {
cx.tcx().sess.span_bug(m.span, "unexpanded type macro found during cleaning")
}
}
}
}
......
......@@ -1471,6 +1471,8 @@ pub enum Ty_ {
/// TyInfer means the type should be inferred instead of it having been
/// specified. This can appear anywhere in a type.
TyInfer,
// A macro in the type position.
TyMac(Mac)
}
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
......
......@@ -429,6 +429,9 @@ pub fn noop_fold_ty<T: Folder>(t: P<Ty>, fld: &mut T) -> P<Ty> {
TyPolyTraitRef(bounds) => {
TyPolyTraitRef(bounds.move_map(|b| fld.fold_ty_param_bound(b)))
}
TyMac(mac) => {
TyMac(fld.fold_mac(mac))
}
},
span: fld.new_span(span)
})
......
......@@ -734,6 +734,9 @@ pub fn print_type(&mut self, ty: &ast::Ty) -> io::Result<()> {
ast::TyInfer => {
try!(word(&mut self.s, "_"));
}
ast::TyMac(ref m) => {
try!(self.print_mac(m, token::Paren));
}
}
self.end()
}
......
......@@ -405,6 +405,9 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty) {
visitor.visit_expr(&**expression)
}
TyInfer => {}
TyMac(ref mac) => {
visitor.visit_mac(mac)
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册