diff options
Diffstat (limited to 'src/comp/syntax')
| -rw-r--r-- | src/comp/syntax/ast_util.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/comp/syntax/ast_util.rs b/src/comp/syntax/ast_util.rs index d8b52300e91..3129c28d4fa 100644 --- a/src/comp/syntax/ast_util.rs +++ b/src/comp/syntax/ast_util.rs @@ -1,4 +1,4 @@ -import std::{str, option}; +import std::{str, option, int, map}; import codemap::span; import ast::*; @@ -6,6 +6,13 @@ fn respan<copy T>(sp: span, t: T) -> spanned<T> { ret {node: t, span: sp}; } +fn new_node_hash<copy V>() -> map::hashmap<node_id, V> { + fn node_id_hash(&&i: node_id) -> uint { ret int::hash(i as int); } + fn node_id_eq(&&a: node_id, &&b: node_id) -> bool + { ret int::eq(a as int, b as int); } + ret map::mk_hashmap(node_id_hash, node_id_eq); +} + /* assuming that we're not in macro expansion */ fn mk_sp(lo: uint, hi: uint) -> span { ret {lo: lo, hi: hi, expanded_from: codemap::os_none}; |
