From 29f7cdffa4688aa539be4f0f6d2eab7f5af8a2d6 Mon Sep 17 00:00:00 2001 From: Stefan Plantikow Date: Wed, 30 Nov 2011 17:58:08 +0100 Subject: ty: trans: added support for dropping trivial casts --- src/comp/syntax/ast_util.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/comp/syntax') 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(sp: span, t: T) -> spanned { ret {node: t, span: sp}; } +fn new_node_hash() -> map::hashmap { + 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}; -- cgit 1.4.1-3-g733a5