Remove trivial cast checker

I consider the added complexity not justified at this point, and it
interacts badly with the patches for issue #828. Feel free to discuss.
This commit is contained in:
Marijn Haverbeke 2011-12-22 13:47:30 +01:00
parent e31983a02e
commit e2e077c831
10 changed files with 36 additions and 194 deletions

View file

@ -1,5 +1,3 @@
import core::{str, option, int};
import std::map;
import codemap::span;
import ast::*;
@ -7,13 +5,6 @@ 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};
@ -198,14 +189,6 @@ pure fn is_call_expr(e: @expr) -> bool {
alt e.node { expr_call(_, _, _) { true } _ { false } }
}
pure fn is_tail_call_expr(e: @expr) -> bool {
alt e.node {
expr_call(_, _, _) { true }
expr_cast(inner_e, _) { is_call_expr(inner_e) }
_ { false }
}
}
fn is_constraint_arg(e: @expr) -> bool {
alt e.node {
expr_lit(_) { ret true; }

View file

@ -958,7 +958,7 @@ fn parse_bottom_expr(p: parser) -> @ast::expr {
let e = parse_expr(p);
// FIXME: Is this the right place for this check?
if /*check*/ ast_util::is_tail_call_expr(e) {
if /*check*/ast_util::is_call_expr(e) {
hi = e.span.hi;
ex = ast::expr_be(e);
} else { p.fatal("Non-call expression in tail call"); }