Skip to content

Commit 0c5a55f

Browse files
committed
add a function that returns the type of a local decl
1 parent 193c1fa commit 0c5a55f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/comp/middle/ty.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1811,6 +1811,17 @@ fn expr_has_ty_params(&node_type_table ntt, &@ast::expr expr) -> bool {
18111811
ret ann_has_type_params(ntt, expr_ann(expr));
18121812
}
18131813

1814+
fn decl_local_ty(&ctxt cx, &@ast::decl d) -> t {
1815+
alt (d.node) {
1816+
case (ast::decl_local(?l)) {
1817+
ret ann_to_type(cx.node_types, l.ann);
1818+
}
1819+
case (_) {
1820+
cx.sess.bug("decl_local_ty called on an item decl");
1821+
}
1822+
}
1823+
}
1824+
18141825
fn stmt_ann(&@ast::stmt s) -> ast::ann {
18151826
alt (s.node) {
18161827
case (ast::stmt_decl(_, ?a)) { ret a; }

0 commit comments

Comments
 (0)