提交 0c5a55f2 编写于 作者: T Tim Chevalier

add a function that returns the type of a local decl

上级 193c1fac
......@@ -1811,6 +1811,17 @@ fn expr_has_ty_params(&node_type_table ntt, &@ast::expr expr) -> bool {
ret ann_has_type_params(ntt, expr_ann(expr));
}
fn decl_local_ty(&ctxt cx, &@ast::decl d) -> t {
alt (d.node) {
case (ast::decl_local(?l)) {
ret ann_to_type(cx.node_types, l.ann);
}
case (_) {
cx.sess.bug("decl_local_ty called on an item decl");
}
}
}
fn stmt_ann(&@ast::stmt s) -> ast::ann {
alt (s.node) {
case (ast::stmt_decl(_, ?a)) { ret a; }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册