Move functions from syntax::ast to syntax::ast_util

This leaves syntax::ast just defining the AST, which strikes me as somewhat
nicer
This commit is contained in:
Brian Anderson 2011-08-21 21:44:41 -07:00
parent a3affaa20f
commit 152cbaade7
33 changed files with 358 additions and 314 deletions

View file

@ -1,5 +1,6 @@
import syntax::ast;
import syntax::ast_util;
import ast::ident;
import ast::fn_ident;
import ast::node_id;
@ -195,7 +196,7 @@ fn check_call(cx: &ctx, f: &@ast::expr, args: &[@ast::expr], sc: &scope) ->
if arg_t.mode == ty::mo_alias(true) {
alt path_def(cx, arg) {
some(def) {
let dnum = ast::def_id_of_def(def).node;
let dnum = ast_util::def_id_of_def(def).node;
if def_is_local(def, true) {
if is_immutable_alias(cx, sc, dnum) {
cx.tcx.sess.span_err(
@ -302,7 +303,7 @@ fn check_tail_call(cx: &ctx, call: &@ast::expr) {
alt args[i].node {
ast::expr_path(_) {
let def = cx.tcx.def_map.get(args[i].id);
let dnum = ast::def_id_of_def(def).node;
let dnum = ast_util::def_id_of_def(def).node;
alt cx.local_map.find(dnum) {
some(arg(ast::alias(mut))) {
if mut_a && !mut {
@ -352,7 +353,7 @@ fn check_alt(cx: &ctx, input: &@ast::expr, arms: &[ast::arm], sc: &scope,
}
fn arm_defnums(arm: &ast::arm) -> [node_id] {
ret ast::pat_binding_ids(arm.pats[0]);
ret ast_util::pat_binding_ids(arm.pats[0]);
}
fn check_for_each(cx: &ctx, local: &@ast::local, call: &@ast::expr,
@ -361,7 +362,7 @@ fn check_for_each(cx: &ctx, local: &@ast::local, call: &@ast::expr,
alt call.node {
ast::expr_call(f, args) {
let data = check_call(cx, f, args, sc);
let bindings = ast::pat_binding_ids(local.node.pat);
let bindings = ast_util::pat_binding_ids(local.node.pat);
let new_sc =
@{root_vars: data.root_vars,
block_defnum: bindings[vec::len(bindings) - 1u],
@ -393,7 +394,7 @@ fn check_for(cx: &ctx, local: &@ast::local, seq: &@ast::expr, blk: &ast::blk,
util::ppaux::ty_to_str(cx.tcx, seq_t));
}
}
let bindings = ast::pat_binding_ids(local.node.pat);
let bindings = ast_util::pat_binding_ids(local.node.pat);
let new_sc =
@{root_vars: root_def,
block_defnum: bindings[vec::len(bindings) - 1u],
@ -408,7 +409,7 @@ fn check_var(cx: &ctx, ex: &@ast::expr, p: &ast::path, id: ast::node_id,
assign: bool, sc: &scope) {
let def = cx.tcx.def_map.get(id);
if !def_is_local(def, true) { ret; }
let my_defnum = ast::def_id_of_def(def).node;
let my_defnum = ast_util::def_id_of_def(def).node;
let var_t = ty::expr_ty(cx.tcx, ex);
for r: restrict in *sc {
@ -429,7 +430,7 @@ fn check_var(cx: &ctx, ex: &@ast::expr, p: &ast::path, id: ast::node_id,
fn check_lval(cx: &@ctx, dest: &@ast::expr, sc: &scope, v: &vt<scope>) {
alt dest.node {
ast::expr_path(p) {
let dnum = ast::def_id_of_def(cx.tcx.def_map.get(dest.id)).node;
let dnum = ast_util::def_id_of_def(cx.tcx.def_map.get(dest.id)).node;
cx.mut_map.insert(dnum, ());
if is_immutable_alias(*cx, sc, dnum) {
cx.tcx.sess.span_err(dest.span, "assigning to immutable alias");
@ -515,15 +516,17 @@ fn test_scope(cx: &ctx, sc: &scope, r: &restrict, p: &ast::path) {
let msg =
alt prob {
overwritten(sp, wpt) {
{span: sp, msg: "overwriting " + ast::path_name(wpt)}
{span: sp, msg: "overwriting " + ast_util::path_name(wpt)}
}
val_taken(sp, vpt) {
{span: sp, msg: "taking the value of " + ast::path_name(vpt)}
{span: sp,
msg: "taking the value of " + ast_util::path_name(vpt)}
}
};
cx.tcx.sess.span_err(msg.span,
msg.msg + " will invalidate alias " +
ast::path_name(p) + ", which is still used");
ast_util::path_name(p) +
", which is still used");
}
}
@ -660,7 +663,7 @@ fn path_def(cx: &ctx, ex: &@ast::expr) -> option::t<ast::def> {
fn path_def_id(cx: &ctx, ex: &@ast::expr) -> option::t<ast::def_id> {
alt ex.node {
ast::expr_path(_) {
ret some(ast::def_id_of_def(cx.tcx.def_map.get(ex.id)));
ret some(ast_util::def_id_of_def(cx.tcx.def_map.get(ex.id)));
}
_ { ret none; }
}

View file

@ -125,9 +125,11 @@ fn node_span(node: &ast_node) -> codemap::span {
#[cfg(test)]
mod test {
import syntax::ast_util;
#[test]
fn test_node_span_item() {
let expected: codemap::span = mk_sp(20u, 30u);
let expected: codemap::span = ast_util::mk_sp(20u, 30u);
let node =
node_item(@{ident: "test",
attrs: [],
@ -139,7 +141,7 @@ mod test {
#[test]
fn test_node_span_obj_ctor() {
let expected: codemap::span = mk_sp(20u, 30u);
let expected: codemap::span = ast_util::mk_sp(20u, 30u);
let node =
node_obj_ctor(@{ident: "test",
attrs: [],
@ -151,7 +153,7 @@ mod test {
#[test]
fn test_node_span_native_item() {
let expected: codemap::span = mk_sp(20u, 30u);
let expected: codemap::span = ast_util::mk_sp(20u, 30u);
let node =
node_native_item(@{ident: "test",
attrs: [],
@ -163,7 +165,7 @@ mod test {
#[test]
fn test_node_span_expr() {
let expected: codemap::span = mk_sp(20u, 30u);
let expected: codemap::span = ast_util::mk_sp(20u, 30u);
let node = node_expr(@{id: 0, node: expr_break, span: expected});
assert (node_span(node) == expected);
}

View file

@ -1,4 +1,6 @@
import syntax::ast::*;
import syntax::ast_util::variant_def_ids;
import syntax::ast_util::dummy_sp;
import syntax::visit;
fn check_crate(tcx: &ty::ctxt, crate: &@crate) {

View file

@ -7,6 +7,7 @@ import std::option;
import std::int;
import std::option::*;
import syntax::ast;
import syntax::ast_util;
import syntax::visit;
import driver::session;
import middle::resolve;
@ -69,7 +70,7 @@ fn collect_freevars(def_map: &resolve::def_map, sess: &session::session,
};
let walk_local =
lambda (local: &@ast::local) {
for each b: @ast::pat in ast::pat_bindings(local.node.pat) {
for each b: @ast::pat in ast_util::pat_bindings(local.node.pat) {
set_add(decls, b.id);
}
};
@ -91,7 +92,7 @@ fn collect_freevars(def_map: &resolve::def_map, sess: &session::session,
let defs = new_int_hash();
for ref_id_: ast::node_id in *refs {
let ref_id = ref_id_;
let def_id = ast::def_id_of_def(def_map.get(ref_id)).node;
let def_id = ast_util::def_id_of_def(def_map.get(ref_id)).node;
if !decls.contains_key(def_id) && !defs.contains_key(def_id) {
canonical_refs += [ref_id];
set_add(defs, def_id);
@ -127,7 +128,7 @@ fn annotate_freevars(sess: &session::session, def_map: &resolve::def_map,
lambda (v: &visit::vt<()>) {
v.visit_block(body, (), v);
};
let bound = ast::pat_binding_ids(local.node.pat);
let bound = ast_util::pat_binding_ids(local.node.pat);
let vars = collect_freevars(def_map, sess, start_walk, bound);
freevars.insert(body.node.id, vars);
}
@ -166,7 +167,7 @@ fn def_lookup(tcx: &ty::ctxt, f: ast::node_id, id: ast::node_id) ->
alt tcx.def_map.find(id) {
none. { ret none; }
some(d) {
let did = ast::def_id_of_def(d);
let did = ast_util::def_id_of_def(d);
if f != -1 && is_freevar_of(tcx, did.node, f) {
ret some(ast::def_upvar(did, @d));
} else { ret some(d); }

View file

@ -72,6 +72,7 @@
import syntax::ast;
import syntax::ast_util;
import syntax::visit;
import std::vec;
@ -142,7 +143,8 @@ fn check_expr(tcx: &ty::ctxt, e: &@ast::expr) {
// that all the types we're supplying as typarams conform to the
// typaram kind constraints on that item.
if vec::len(tpt.params) != 0u {
let callee_def = ast::def_id_of_def(tcx.def_map.get(callee.id));
let callee_def = ast_util::def_id_of_def(
tcx.def_map.get(callee.id));
let item_tk = ty::lookup_item_type(tcx, callee_def);
let i = 0;
assert (vec::len(item_tk.kinds) == vec::len(tpt.params));

View file

@ -1,13 +1,14 @@
import syntax::ast;
import syntax::ast::*;
import syntax::ast_util;
import syntax::codemap;
import ast::ident;
import ast::fn_ident;
import ast::def;
import ast::def_id;
import ast::node_id;
import ast::local_def;
import syntax::ast_util::local_def;
import metadata::csearch;
import metadata::cstore;
@ -16,7 +17,7 @@ import util::common::*;
import std::map::new_int_hash;
import std::map::new_str_hash;
import syntax::codemap::span;
import syntax::ast::respan;
import syntax::ast_util::respan;
import middle::ty::constr_table;
import syntax::visit;
import visit::vt;
@ -321,7 +322,8 @@ fn resolve_names(e: &@env, c: &@ast::crate) {
}
_ {
e.sess.span_err(p.span,
"not a tag variant: " + ast::path_name(p));
"not a tag variant: " +
ast_util::path_name(p));
}
}
}
@ -739,7 +741,7 @@ fn lookup_in_ty_params(name: &ident, ty_params: &[ast::ty_param]) ->
fn lookup_in_pat(name: &ident, pat: &@ast::pat) -> option::t<def_id> {
let found = none;
for each bound in ast::pat_bindings(pat) {
for each bound in ast_util::pat_bindings(pat) {
let p_name = alt bound.node { ast::pat_bind(n) { n } };
if str::eq(p_name, name) { found = some(local_def(bound.id)); }
}
@ -891,7 +893,7 @@ fn lookup_in_mod_strict(e: &env, sc: &scopes, m: def, sp: &span, name: &ident,
fn lookup_in_mod(e: &env, m: &def, sp: &span, name: &ident, ns: namespace,
dr: dir) -> option::t<def> {
let defid = ast::def_id_of_def(m);
let defid = ast_util::def_id_of_def(m);
if defid.crate != ast::local_crate {
// examining a module in an external crate
@ -946,7 +948,7 @@ fn lookup_in_local_native_mod(e: &env, node_id: node_id, sp: &span,
fn lookup_in_local_mod(e: &env, node_id: node_id, sp: &span, id: &ident,
ns: namespace, dr: dir) -> option::t<def> {
let info = e.mod_map.get(node_id);
if dr == outside && !ast::is_exported(id, option::get(info.m)) {
if dr == outside && !ast_util::is_exported(id, option::get(info.m)) {
// if we're in a native mod, then dr==inside, so info.m is some _mod
ret none::<def>; // name is not visible
@ -1173,7 +1175,7 @@ fn ns_for_def(d: def) -> namespace {
fn lookup_external(e: &env, cnum: int, ids: &[ident], ns: namespace) ->
option::t<def> {
for d: def in csearch::lookup_defs(e.sess.get_cstore(), cnum, ids) {
e.ext_map.insert(ast::def_id_of_def(d), ids);
e.ext_map.insert(ast_util::def_id_of_def(d), ids);
if ns == ns_for_def(d) { ret some(d); }
}
ret none::<def>;
@ -1273,7 +1275,7 @@ fn check_item(e: &@env, i: &@ast::item, x: &(), v: &vt<()>) {
}
fn check_pat(ch: checker, p: &@ast::pat) {
for each p in ast::pat_bindings(p) {
for each p in ast_util::pat_bindings(p) {
let ident = alt p.node { pat_bind(n) { n } };
add_name(ch, p.span, ident);
}
@ -1321,7 +1323,7 @@ fn check_block(e: &@env, b: &ast::blk, x: &(), v: &vt<()>) {
ast::decl_local(locs) {
let local_values = checker(*e, "value");
for loc in locs {
for each p in ast::pat_bindings(loc.node.pat) {
for each p in ast_util::pat_bindings(loc.node.pat) {
let ident = alt p.node { pat_bind(n) { n } };
add_name(local_values, p.span, ident);
check_name(values, p.span, ident);

View file

@ -21,7 +21,7 @@ import middle::ty;
import middle::ty::field;
import middle::ty::mt;
import syntax::ast;
import syntax::ast::dummy_sp;
import syntax::ast_util::dummy_sp;
import syntax::codemap::span;
import syntax::util::interner;
import util::common;

View file

@ -25,6 +25,7 @@ import std::fs;
import std::time;
import std::vec;
import syntax::ast;
import syntax::ast_util;
import driver::session;
import middle::ty;
import middle::freevars::*;
@ -3478,7 +3479,7 @@ fn trans_if(cx: &@block_ctxt, cond: &@ast::expr, thn: &ast::blk,
some(elexpr) {
alt elexpr.node {
ast::expr_if(_, _, _) {
let elseif_blk = ast::block_from_expr(elexpr);
let elseif_blk = ast_util::block_from_expr(elexpr);
trans_block(else_cx, elseif_blk, output)
}
ast::expr_block(blk) { trans_block(else_cx, blk, output) }
@ -3722,7 +3723,8 @@ fn load_environment(enclosing_cx: &@block_ctxt, fcx: &@fn_ctxt, envty: ty::t,
bcx = upvarptr.bcx;
let llupvarptr = upvarptr.val;
if !copying { llupvarptr = bcx.build.Load(llupvarptr); }
let def_id = ast::def_id_of_def(bcx_tcx(bcx).def_map.get(upvar_id));
let def_id = ast_util::def_id_of_def(bcx_tcx(bcx).
def_map.get(upvar_id));
fcx.llupvars.insert(def_id.node, llupvarptr);
i += 1u;
}
@ -4980,7 +4982,7 @@ fn trans_expr_out(cx: &@block_ctxt, e: &@ast::expr, output: out_method) ->
output);
}
ast::expr_ternary(_, _, _) {
ret trans_expr_out(cx, ast::ternary_to_if(e), output);
ret trans_expr_out(cx, ast_util::ternary_to_if(e), output);
}
ast::expr_for(decl, seq, body) { ret trans_for(cx, decl, seq, body); }
ast::expr_for_each(decl, seq, body) {
@ -5463,7 +5465,7 @@ fn build_return(bcx: &@block_ctxt) { bcx.build.Br(bcx_fcx(bcx).llreturn); }
fn trans_be(cx: &@block_ctxt, e: &@ast::expr) -> result {
// FIXME: This should be a typestate precondition
assert (ast::is_call_expr(e));
assert (ast_util::is_call_expr(e));
// FIXME: Turn this into a real tail call once
// calling convention issues are settled
@ -6208,8 +6210,8 @@ fn trans_tag_variant(cx: @local_ctxt, tag_id: ast::node_id,
i = 0u;
for va: ast::variant_arg in variant.node.args {
let rslt =
GEP_tag(bcx, llblobptr, ast::local_def(tag_id),
ast::local_def(variant.node.id), ty_param_substs,
GEP_tag(bcx, llblobptr, ast_util::local_def(tag_id),
ast_util::local_def(variant.node.id), ty_param_substs,
i as int);
bcx = rslt.bcx;
let lldestptr = rslt.val;

View file

@ -14,7 +14,8 @@ import trans::new_scope_block_ctxt;
import trans::load_if_immediate;
import ty::pat_ty;
import syntax::ast;
import syntax::ast::dummy_sp;
import syntax::ast_util;
import syntax::ast_util::dummy_sp;
import syntax::ast::def_id;
import syntax::codemap::span;
import util::common::lit_eq;
@ -44,7 +45,7 @@ fn trans_opt(bcx: &@block_ctxt, o: &opt) -> result {
}
fn variant_opt(ccx: &@crate_ctxt, pat_id: ast::node_id) -> opt {
let vdef = ast::variant_def_ids(ccx.tcx.def_map.get(pat_id));
let vdef = ast_util::variant_def_ids(ccx.tcx.def_map.get(pat_id));
let variants = ty::tag_variants(ccx.tcx, vdef.tg);
let i = 0u;
for v: ty::variant_info in variants {
@ -500,7 +501,7 @@ fn trans_alt(cx: &@block_ctxt, expr: &@ast::expr, arms: &[ast::arm],
for a: ast::arm in arms {
let body = new_scope_block_ctxt(cx, "case_body");
let id_map = ast::pat_id_map(a.pats[0]);
let id_map = ast_util::pat_id_map(a.pats[0]);
bodies += [body];
for p: @ast::pat in a.pats {
match += [@{pats: [p],
@ -532,7 +533,8 @@ fn trans_alt(cx: &@block_ctxt, expr: &@ast::expr, arms: &[ast::arm],
let arm_results = [];
for a: ast::arm in arms {
let body_cx = bodies[i];
if make_phi_bindings(body_cx, exit_map, ast::pat_id_map(a.pats[0])) {
if make_phi_bindings(body_cx, exit_map,
ast_util::pat_id_map(a.pats[0])) {
let block_res = trans::trans_block(body_cx, a.body, output);
arm_results += [block_res];
} else { // Unreachable
@ -562,7 +564,7 @@ fn bind_irrefutable_pat(bcx: @block_ctxt, pat: &@ast::pat, val: ValueRef,
}
ast::pat_tag(_, sub) {
if vec::len(sub) == 0u { ret bcx; }
let vdefs = ast::variant_def_ids(ccx.tcx.def_map.get(pat.id));
let vdefs = ast_util::variant_def_ids(ccx.tcx.def_map.get(pat.id));
let args = extract_variant_args(bcx, pat.id, vdefs, val);
let i = 0;
for argval: ValueRef in args.vals {

View file

@ -15,6 +15,7 @@ import back::abi;
import back::link::mangle_internal_name_by_path;
import back::link::mangle_internal_name_by_path_and_seq;
import syntax::ast;
import syntax::ast_util;
import syntax::codemap::span;
import trans_common::*;
@ -231,7 +232,7 @@ fn trans_anon_obj(bcx: @block_ctxt, sp: &span, anon_obj: &ast::anon_obj,
// methods, not inner ones.
let wrapper_obj: ast::_obj =
{fields:
std::vec::map(ast::obj_field_from_anon_obj_field,
std::vec::map(ast_util::obj_field_from_anon_obj_field,
additional_fields),
methods: anon_obj.methods};

View file

@ -5,6 +5,7 @@ import std::option::none;
import std::int;
import std::uint;
import syntax::ast::*;
import syntax::ast_util::pat_binding_ids;
import syntax::visit;
import syntax::codemap::span;
import std::map::new_str_hash;

View file

@ -6,6 +6,7 @@ import std::option::*;
import std::int;
import std::uint;
import syntax::ast::*;
import syntax::ast_util::*;
import syntax::codemap::span;
import syntax::visit;
import util::common;

View file

@ -11,7 +11,7 @@ import ast::ident;
import ast::fn_ident;
import ast::node_id;
import ast::def_id;
import ast::local_def;
import syntax::ast_util::local_def;
import ast::ty_param;
import ast::crate;
import ast::return;

View file

@ -2,6 +2,7 @@ import std::uint;
import std::int;
import std::vec;
import syntax::ast::*;
import syntax::ast_util::*;
import util::ppaux::fn_ident_to_string;
import std::option::*;
import syntax::visit;
@ -9,7 +10,7 @@ import aux::*;
import std::map::new_int_hash;
import util::common::new_def_hash;
import syntax::codemap::span;
import syntax::ast::respan;
import syntax::ast_util::respan;
type ctxt = {cs: @mutable [sp_constr], tcx: ty::ctxt};

View file

@ -17,6 +17,7 @@ import bitvectors::relax_precond_block;
import bitvectors::gen;
import tritv::*;
import syntax::ast::*;
import syntax::ast_util::*;
import syntax::visit;
import std::map::new_int_hash;
import util::common::new_def_hash;

View file

@ -15,6 +15,7 @@ import tritv::ttrue;
import bitvectors::*;
import syntax::ast::*;
import syntax::ast_util::*;
import middle::ty::expr_ty;
import middle::ty::type_is_nil;
import middle::ty::type_is_bot;

View file

@ -13,6 +13,7 @@ import std::smallintmap;
import driver::session;
import syntax::ast;
import syntax::ast::*;
import syntax::ast_util;
import syntax::codemap::span;
import metadata::csearch;
import util::common::*;
@ -416,7 +417,8 @@ fn mk_ctxt(s: session::session, dm: resolve::def_map,
has_pointer_cache: map::mk_hashmap(ty::hash_ty, ty::eq_ty),
kind_cache: map::mk_hashmap(ty::hash_ty, ty::eq_ty),
owns_heap_mem_cache: map::mk_hashmap(ty::hash_ty, ty::eq_ty),
ast_ty_to_ty_cache: map::mk_hashmap(ast::hash_ty, ast::eq_ty)};
ast_ty_to_ty_cache: map::mk_hashmap(ast_util::hash_ty,
ast_util::eq_ty)};
populate_type_store(cx);
ret cx;
}
@ -2716,7 +2718,7 @@ fn tag_variants(cx: &ctxt, id: &ast::def_id) -> [variant_info] {
result +=
[{args: arg_tys,
ctor_ty: ctor_ty,
id: ast::local_def(did)}];
id: ast_util::local_def(did)}];
}
ret result;
}
@ -2873,8 +2875,10 @@ fn ast_constr_to_constr<T>(tcx: ty::ctxt, c: &@ast::constr_general<T>) ->
@ty::constr_general<T> {
alt tcx.def_map.find(c.node.id) {
some(ast::def_fn(pred_id, ast::pure_fn.)) {
ret @respan(c.span,
{path: c.node.path, args: c.node.args, id: pred_id});
ret @ast_util::respan(c.span,
{path: c.node.path,
args: c.node.args,
id: pred_id});
}
_ {
tcx.sess.span_fatal(c.span,

View file

@ -1,7 +1,8 @@
import syntax::ast;
import syntax::ast_util;
import ast::mutability;
import ast::local_def;
import ast::respan;
import syntax::ast_util::local_def;
import syntax::ast_util::respan;
import ast::spanned;
import syntax::visit;
import metadata::csearch;
@ -708,14 +709,14 @@ mod collect {
let convert = bind ast_ty_to_ty(cx.tcx, get, _);
let f = bind ty_of_arg(cx, _);
ret ty_of_native_fn_decl(cx, convert, f, fn_decl, abi, params,
ast::local_def(it.id));
ast_util::local_def(it.id));
}
ast::native_item_ty. {
alt cx.tcx.tcache.find(local_def(it.id)) {
some(tpt) { ret tpt; }
none. { }
}
let t = ty::mk_native(cx.tcx, ast::local_def(it.id));
let t = ty::mk_native(cx.tcx, ast_util::local_def(it.id));
let tpt = {kinds: no_kinds, ty: t};
cx.tcx.tcache.insert(local_def(it.id), tpt);
ret tpt;
@ -1329,7 +1330,7 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast::pat_id_map, pat: &@ast::pat,
ast::pat_tag(path, subpats) {
// Typecheck the path.
let v_def = lookup_def(fcx, path.span, pat.id);
let v_def_ids = ast::variant_def_ids(v_def);
let v_def_ids = ast_util::variant_def_ids(v_def);
let tag_tpt = ty::lookup_item_type(fcx.ccx.tcx, v_def_ids.tg);
let path_tpot = instantiate_path(fcx, path, tag_tpt, pat.span);
@ -1727,7 +1728,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, unify: &unifier,
}
}
for operand: @ast::expr in operands {
if !ast::is_constraint_arg(operand) {
if !ast_util::is_constraint_arg(operand) {
let s =
"Constraint args must be \
slot variables or literals";
@ -1776,7 +1777,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, unify: &unifier,
binop: ast::binop) {
let resolved_t = resolve_type_vars_if_possible(fcx, ty);
if !ty::is_binopable(fcx.ccx.tcx, resolved_t, binop) {
let binopstr = ast::binop_to_str(binop);
let binopstr = ast_util::binop_to_str(binop);
let t_str = ty_to_str(fcx.ccx.tcx, resolved_t);
let errmsg =
"binary operation " + binopstr +
@ -1798,7 +1799,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, unify: &unifier,
bot = check_expr_with(fcx, lhs, lhs_t);
let rhs_bot = check_expr_with(fcx, rhs, lhs_t);
if !ast::lazy_binop(binop) { bot |= rhs_bot; }
if !ast_util::lazy_binop(binop) { bot |= rhs_bot; }
check_binop_type_compat(fcx, expr.span, lhs_t, binop);
@ -1928,7 +1929,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, unify: &unifier,
}
ast::expr_be(e) {
// FIXME: prove instead of assert
assert (ast::is_call_expr(e));
assert (ast_util::is_call_expr(e));
check_expr_with(fcx, e, fcx.ret_ty);
bot = true;
write::nil_ty(tcx, id);
@ -1947,7 +1948,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, unify: &unifier,
check_then_else(fcx, thn, elsopt, id, expr.span);
}
ast::expr_ternary(_, _, _) {
bot = check_expr(fcx, ast::ternary_to_if(expr));
bot = check_expr(fcx, ast_util::ternary_to_if(expr));
}
ast::expr_assert(e) {
bot = check_expr_with(fcx, e, ty::mk_bool(tcx));
@ -2029,7 +2030,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, unify: &unifier,
// bindings.
let pattern_ty = ty::expr_ty(tcx, expr);
for arm: ast::arm in arms {
let id_map = ast::pat_id_map(arm.pats[0]);
let id_map = ast_util::pat_id_map(arm.pats[0]);
for p: @ast::pat in arm.pats {
check_pat(fcx, id_map, p, pattern_ty);
}
@ -2392,7 +2393,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, unify: &unifier,
}
fcx.ccx.obj_infos +=
[anon_obj(vec::map(ast::obj_field_from_anon_obj_field,
[anon_obj(vec::map(ast_util::obj_field_from_anon_obj_field,
fields), inner_obj_sty)];
// Whenever an outer method overrides an inner, we need to remove
@ -2499,7 +2500,7 @@ fn check_decl_local(fcx: &@fn_ctxt, local: &@ast::local) -> bool {
}
_ {/* fall through */ }
}
let id_map = ast::pat_id_map(local.node.pat);
let id_map = ast_util::pat_id_map(local.node.pat);
check_pat(fcx, id_map, local.node.pat, t);
}
}