aboutsummaryrefslogtreecommitdiff
path: root/src/comp/middle
diff options
context:
space:
mode:
Diffstat (limited to 'src/comp/middle')
-rw-r--r--src/comp/middle/fold.rs37
-rw-r--r--src/comp/middle/trans.rs120
-rw-r--r--src/comp/middle/ty.rs9
-rw-r--r--src/comp/middle/typeck.rs34
4 files changed, 103 insertions, 97 deletions
diff --git a/src/comp/middle/fold.rs b/src/comp/middle/fold.rs
index 73b2cab3..e2f2e192 100644
--- a/src/comp/middle/fold.rs
+++ b/src/comp/middle/fold.rs
@@ -7,7 +7,6 @@ import util.common.new_str_hash;
import util.common.spanned;
import util.common.span;
import util.common.ty_mach;
-import util.common.append;
import front.ast;
import front.ast.fn_decl;
@@ -318,7 +317,7 @@ type ast_fold[ENV] =
fn fold_path[ENV](&ENV env, ast_fold[ENV] fld, &path p) -> path {
let vec[@ast.ty] tys_ = vec();
for (@ast.ty t in p.node.types) {
- append[@ast.ty](tys_, fold_ty(env, fld, t));
+ _vec.push[@ast.ty](tys_, fold_ty(env, fld, t));
}
let ast.path_ p_ = rec(idents=p.node.idents, types=tys_);
ret fld.fold_path(env, p.span, p_);
@@ -357,7 +356,7 @@ fn fold_ty[ENV](&ENV env, ast_fold[ENV] fld, @ty t) -> @ty {
case (ast.ty_tup(?elts)) {
let vec[@ty] elts_ = vec();
for (@ty elt in elts) {
- append[@ty](elts_,fold_ty(env, fld, elt));
+ _vec.push[@ty](elts_,fold_ty(env, fld, elt));
}
ret fld.fold_ty_tup(env_, t.span, elts_);
}
@@ -365,7 +364,7 @@ fn fold_ty[ENV](&ENV env, ast_fold[ENV] fld, @ty t) -> @ty {
case (ast.ty_rec(?flds)) {
let vec[ast.ty_field] flds_ = vec();
for (ast.ty_field f in flds) {
- append[ast.ty_field]
+ _vec.push[ast.ty_field]
(flds_, rec(ty=fold_ty(env, fld, f.ty) with f));
}
ret fld.fold_ty_rec(env_, t.span, flds_);
@@ -378,7 +377,7 @@ fn fold_ty[ENV](&ENV env, ast_fold[ENV] fld, @ty t) -> @ty {
m.inputs, m.output);
alt (tfn.node) {
case (ast.ty_fn(?p, ?ins, ?out)) {
- append[ast.ty_method]
+ _vec.push[ast.ty_method]
(meths_, rec(proto=p, inputs=ins, output=out
with m));
}
@@ -494,7 +493,7 @@ fn fold_pat[ENV](&ENV env, ast_fold[ENV] fld, @ast.pat p) -> @ast.pat {
fn fold_exprs[ENV](&ENV env, ast_fold[ENV] fld, vec[@expr] es) -> vec[@expr] {
let vec[@expr] exprs = vec();
for (@expr e in es) {
- append[@expr](exprs, fold_expr(env, fld, e));
+ _vec.push[@expr](exprs, fold_expr(env, fld, e));
}
ret exprs;
}
@@ -525,7 +524,7 @@ fn fold_expr[ENV](&ENV env, ast_fold[ENV] fld, &@expr e) -> @expr {
case (ast.expr_tup(?es, ?t)) {
let vec[ast.elt] elts = vec();
for (ast.elt e in es) {
- elts += fold_tup_elt[ENV](env, fld, e);
+ elts += vec(fold_tup_elt[ENV](env, fld, e));
}
ret fld.fold_expr_tup(env_, e.span, elts, t);
}
@@ -534,7 +533,7 @@ fn fold_expr[ENV](&ENV env, ast_fold[ENV] fld, &@expr e) -> @expr {
let vec[ast.field] fields = vec();
let option.t[@expr] b = none[@expr];
for (ast.field f in fs) {
- fields += fold_rec_field(env, fld, f);
+ fields += vec(fold_rec_field(env, fld, f));
}
alt (base) {
case (none[@ast.expr]) { }
@@ -557,7 +556,7 @@ fn fold_expr[ENV](&ENV env, ast_fold[ENV] fld, &@expr e) -> @expr {
for (option.t[@ast.expr] t_opt in args_opt) {
alt (t_opt) {
case (none[@ast.expr]) {
- aargs_opt += none[@ast.expr];
+ aargs_opt += vec(none[@ast.expr]);
}
case (some[@ast.expr](?e)) {
aargs_opt += vec(some(fold_expr(env_, fld, e)));
@@ -779,7 +778,7 @@ fn fold_block[ENV](&ENV env, ast_fold[ENV] fld, &block blk) -> block {
let vec[@ast.stmt] stmts = vec();
for (@ast.stmt s in blk.node.stmts) {
auto new_stmt = fold_stmt[ENV](env_, fld, s);
- append[@ast.stmt](stmts, new_stmt);
+ _vec.push[@ast.stmt](stmts, new_stmt);
ast.index_stmt(index, new_stmt);
}
@@ -812,7 +811,7 @@ fn fold_fn_decl[ENV](&ENV env, ast_fold[ENV] fld,
&ast.fn_decl decl) -> ast.fn_decl {
let vec[ast.arg] inputs = vec();
for (ast.arg a in decl.inputs) {
- inputs += fold_arg(env, fld, a);
+ inputs += vec(fold_arg(env, fld, a));
}
auto output = fold_ty[ENV](env, fld, decl.output);
ret fld.fold_fn_decl(env, decl.effect, inputs, output);
@@ -846,7 +845,7 @@ fn fold_obj[ENV](&ENV env, ast_fold[ENV] fld, &ast._obj ob) -> ast._obj {
let vec[ast.obj_field] fields = vec();
let vec[@ast.method] meths = vec();
for (ast.obj_field f in ob.fields) {
- fields += fold_obj_field(env, fld, f);
+ fields += vec(fold_obj_field(env, fld, f));
}
let option.t[block] dtor = none[block];
alt (ob.dtor) {
@@ -867,7 +866,7 @@ fn fold_obj[ENV](&ENV env, ast_fold[ENV] fld, &ast._obj ob) -> ast._obj {
m.node.ann),
span=m.span);
let ENV _env = fld.update_env_for_item(env, i);
- append[@ast.method](meths, fold_method(_env, fld, m));
+ _vec.push[@ast.method](meths, fold_method(_env, fld, m));
}
ret fld.fold_obj(env, fields, meths, dtor);
}
@@ -944,8 +943,8 @@ fn fold_item[ENV](&ENV env, ast_fold[ENV] fld, @item i) -> @item {
auto new_ty = fold_ty[ENV](env_, fld, va.ty);
new_args += vec(rec(ty=new_ty, id=va.id));
}
- new_variants += rec(name=v.name, args=new_args, id=v.id,
- ann=v.ann);
+ new_variants += vec(rec(name=v.name, args=new_args, id=v.id,
+ ann=v.ann));
}
ret fld.fold_item_tag(env_, i.span, ident, new_variants,
ty_params, id);
@@ -969,13 +968,13 @@ fn fold_mod[ENV](&ENV e, ast_fold[ENV] fld, &ast._mod m) -> ast._mod {
for (@view_item vi in m.view_items) {
auto new_vi = fold_view_item[ENV](e, fld, vi);
- append[@view_item](view_items, new_vi);
+ _vec.push[@view_item](view_items, new_vi);
ast.index_view_item(index, new_vi);
}
for (@item i in m.items) {
auto new_item = fold_item[ENV](e, fld, i);
- append[@item](items, new_item);
+ _vec.push[@item](items, new_item);
ast.index_item(index, new_item);
}
@@ -1009,12 +1008,12 @@ fn fold_native_mod[ENV](&ENV e, ast_fold[ENV] fld,
for (@view_item vi in m.view_items) {
auto new_vi = fold_view_item[ENV](e, fld, vi);
- append[@view_item](view_items, new_vi);
+ _vec.push[@view_item](view_items, new_vi);
}
for (@native_item i in m.items) {
auto new_item = fold_native_item[ENV](e, fld, i);
- append[@native_item](items, new_item);
+ _vec.push[@native_item](items, new_item);
ast.index_native_item(index, new_item);
}
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index d0569afc..7bea575f 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -20,7 +20,6 @@ import middle.ty.pat_ty;
import middle.ty.plain_ty;
import util.common;
-import util.common.append;
import util.common.istr;
import util.common.new_def_hash;
import util.common.new_str_hash;
@@ -476,7 +475,7 @@ fn type_of_explicit_args(@crate_ctxt cx,
for (ty.arg arg in inputs) {
if (ty.type_has_dynamic_size(arg.ty)) {
check (arg.mode == ast.alias);
- atys += T_typaram_ptr(cx.tn);
+ atys += vec(T_typaram_ptr(cx.tn));
} else {
let TypeRef t;
alt (arg.mode) {
@@ -487,7 +486,7 @@ fn type_of_explicit_args(@crate_ctxt cx,
t = type_of_inner(cx, arg.ty, false);
}
}
- atys += t;
+ atys += vec(t);
}
}
ret atys;
@@ -510,22 +509,22 @@ fn type_of_fn_full(@crate_ctxt cx,
// Arg 0: Output pointer.
if (ty.type_has_dynamic_size(output)) {
- atys += T_typaram_ptr(cx.tn);
+ atys += vec(T_typaram_ptr(cx.tn));
} else {
- atys += T_ptr(type_of_inner(cx, output, false));
+ atys += vec(T_ptr(type_of_inner(cx, output, false)));
}
// Arg 1: Task pointer.
- atys += T_taskptr(cx.tn);
+ atys += vec(T_taskptr(cx.tn));
// Arg 2: Env (closure-bindings / self-obj)
alt (obj_self) {
case (some[TypeRef](?t)) {
check (t as int != 0);
- atys += t;
+ atys += vec(t);
}
case (_) {
- atys += T_opaque_closure_ptr(cx.tn);
+ atys += vec(T_opaque_closure_ptr(cx.tn));
}
}
@@ -533,7 +532,7 @@ fn type_of_fn_full(@crate_ctxt cx,
if (obj_self == none[TypeRef]) {
auto i = 0u;
while (i < ty_param_count) {
- atys += T_ptr(T_tydesc(cx.tn));
+ atys += vec(T_ptr(T_tydesc(cx.tn)));
i += 1u;
}
}
@@ -542,10 +541,11 @@ fn type_of_fn_full(@crate_ctxt cx,
// If it's an iter, the 'output' type of the iter is actually the
// *input* type of the function we're given as our iter-block
// argument.
- atys += T_fn_pair(cx.tn,
+ atys +=
+ vec(T_fn_pair(cx.tn,
type_of_fn_full(cx, ast.proto_fn, none[TypeRef],
vec(rec(mode=ast.val, ty=output)),
- plain_ty(ty.ty_nil), 0u));
+ plain_ty(ty.ty_nil), 0u)));
}
// ... then explicit args.
@@ -568,12 +568,12 @@ fn type_of_native_fn(@crate_ctxt cx, ast.native_abi abi,
@ty.t output) -> TypeRef {
let vec[TypeRef] atys = vec();
if (abi == ast.native_abi_rust) {
- atys += T_taskptr(cx.tn);
+ atys += vec(T_taskptr(cx.tn));
auto t = ty.ty_native_fn(abi, inputs, output);
auto ty_param_count = ty.count_ty_params(plain_ty(t));
auto i = 0u;
while (i < ty_param_count) {
- atys += T_ptr(T_tydesc(cx.tn));
+ atys += vec(T_ptr(T_tydesc(cx.tn)));
i += 1u;
}
}
@@ -623,14 +623,14 @@ fn type_of_inner(@crate_ctxt cx, @ty.t t, bool boxed) -> TypeRef {
case (ty.ty_tup(?elts)) {
let vec[TypeRef] tys = vec();
for (@ty.t elt in elts) {
- tys += type_of_inner(cx, elt, boxed);
+ tys += vec(type_of_inner(cx, elt, boxed));
}
llty = T_struct(tys);
}
case (ty.ty_rec(?fields)) {
let vec[TypeRef] tys = vec();
for (ty.field f in fields) {
- tys += type_of_inner(cx, f.ty, boxed);
+ tys += vec(type_of_inner(cx, f.ty, boxed));
}
llty = T_struct(tys);
}
@@ -650,7 +650,7 @@ fn type_of_inner(@crate_ctxt cx, @ty.t t, bool boxed) -> TypeRef {
type_of_fn_full(cx, m.proto,
some[TypeRef](self_ty),
m.inputs, m.output, 0u);
- mtys += T_ptr(mty);
+ mtys += vec(T_ptr(mty));
}
let TypeRef vtbl = T_struct(mtys);
let TypeRef pair = T_struct(vec(T_ptr(vtbl),
@@ -870,10 +870,10 @@ fn trans_upcall2(builder b, @glue_fns glues, ValueRef lltaskptr,
let ValueRef llglue = glues.upcall_glues.(n);
let vec[ValueRef] call_args = vec(llupcall);
- call_args += b.PtrToInt(lltaskptr, T_int());
+ call_args += vec( b.PtrToInt(lltaskptr, T_int()));
for (ValueRef a in args) {
- call_args += b.ZExtOrBitCast(a, T_int());
+ call_args += vec(b.ZExtOrBitCast(a, T_int()));
}
ret b.FastCall(llglue, call_args);
@@ -1112,7 +1112,7 @@ fn GEP_tup_like(@block_ctxt cx, @ty.t t,
if (! ty.type_has_dynamic_size(t)) {
let vec[ValueRef] v = vec();
for (int i in ixs) {
- v += C_int(i);
+ v += vec(C_int(i));
}
ret res(cx, cx.build.GEP(base, v));
}
@@ -1159,8 +1159,8 @@ fn GEP_tup_like(@block_ctxt cx, @ty.t t,
let vec[@ty.t] prefix = vec();
let int i = 0;
while (i < ix) {
- append[@ty.t](prefix, ty.get_element_type(t, i as uint));
- i +=1 ;
+ _vec.push[@ty.t](prefix, ty.get_element_type(t, i as uint));
+ i += 1 ;
}
auto selected = ty.get_element_type(t, i as uint);
@@ -1310,8 +1310,8 @@ fn linearize_ty_params(@block_ctxt cx, @ty.t t)
}
}
if (!seen) {
- r.vals += r.cx.fcx.lltydescs.get(pid);
- r.defs += pid;
+ r.vals += vec(r.cx.fcx.lltydescs.get(pid));
+ r.defs += vec(pid);
}
}
case (_) { }
@@ -2365,7 +2365,7 @@ fn trans_unary(@block_ctxt cx, ast.unop op,
auto box_ty = node_ann_type(sub.bcx.fcx.ccx, a);
sub = trans_malloc_boxed(sub.bcx, e_ty);
find_scope_cx(cx).cleanups +=
- clean(bind drop_ty(_, sub.val, box_ty));
+ vec(clean(bind drop_ty(_, sub.val, box_ty)));
auto box = sub.val;
auto rc = sub.bcx.build.GEP(box,
@@ -2646,7 +2646,8 @@ fn trans_vec_add(@block_ctxt cx, @ty.t t,
r = copy_ty(r.bcx, INIT, tmp, lhs, t);
auto bcx = trans_vec_append(r.bcx, t, tmp, rhs).bcx;
tmp = load_scalar_or_boxed(bcx, tmp, t);
- find_scope_cx(cx).cleanups += clean(bind drop_ty(_, tmp, t));
+ find_scope_cx(cx).cleanups +=
+ vec(clean(bind drop_ty(_, tmp, t)));
ret res(bcx, tmp);
}
@@ -2800,9 +2801,9 @@ fn join_results(@block_ctxt parent_cx,
for (result r in ins) {
if (! is_terminated(r.bcx)) {
- live += r;
- vals += r.val;
- bbs += r.bcx.llbb;
+ live += vec(r);
+ vals += vec(r.val);
+ bbs += vec(r.bcx.llbb);
}
}
@@ -2875,7 +2876,8 @@ fn trans_for(@block_ctxt cx,
cx.build.Br(scope_cx.llbb);
auto local_res = alloc_local(scope_cx, local);
auto bcx = copy_ty(local_res.bcx, INIT, local_res.val, curr, t).bcx;
- scope_cx.cleanups += clean(bind drop_slot(_, local_res.val, t));
+ scope_cx.cleanups +=
+ vec(clean(bind drop_slot(_, local_res.val, t)));
bcx = trans_block(bcx, body).bcx;
bcx.build.Br(next_cx.llbb);
ret res(next_cx, C_nil());
@@ -3245,7 +3247,8 @@ fn trans_pat_binding(@block_ctxt cx, @ast.pat pat, ValueRef llval)
llvm.LLVMSetValueName(dst, _str.buf(id));
bcx.fcx.lllocals.insert(def_id, dst);
- bcx.cleanups += clean(bind drop_slot(_, dst, ty));
+ bcx.cleanups +=
+ vec(clean(bind drop_slot(_, dst, ty)));
ret copy_ty(bcx, INIT, dst, llval, ty);
}
@@ -3368,7 +3371,7 @@ fn lval_generic_fn(@block_ctxt cx,
for (@ty.t t in tys) {
auto td = get_tydesc(bcx, t);
bcx = td.bcx;
- append[ValueRef](tydescs, td.val);
+ _vec.push[ValueRef](tydescs, td.val);
}
auto gen = rec( item_type = tpt._1,
tydescs = tydescs );
@@ -3692,7 +3695,7 @@ fn trans_bind_thunk(@crate_ctxt cx,
val = bcx.build.PointerCast(val, llout_arg_ty);
}
- llargs += val;
+ llargs += vec(val);
b += 1;
}
@@ -3706,7 +3709,7 @@ fn trans_bind_thunk(@crate_ctxt cx,
llout_arg_ty);
}
- llargs += passed_arg;
+ llargs += vec(passed_arg);
a += 1u;
}
}
@@ -3750,7 +3753,7 @@ fn trans_bind(@block_ctxt cx, @ast.expr f,
case (none[@ast.expr]) {
}
case (some[@ast.expr](?e)) {
- append[@ast.expr](bound, e);
+ _vec.push[@ast.expr](bound, e);
}
}
}
@@ -3786,8 +3789,8 @@ fn trans_bind(@block_ctxt cx, @ast.expr f,
auto arg = trans_expr(bcx, e);
bcx = arg.bcx;
- append[ValueRef](bound_vals, arg.val);
- append[@ty.t](bound_tys, ty.expr_ty(e));
+ _vec.push[ValueRef](bound_vals, arg.val);
+ _vec.push[@ty.t](bound_tys, ty.expr_ty(e));
i += 1u;
}
@@ -3914,7 +3917,7 @@ fn trans_bind(@block_ctxt cx, @ast.expr f,
pair_box);
find_scope_cx(cx).cleanups +=
- clean(bind drop_slot(_, pair_v, pair_ty));
+ vec(clean(bind drop_slot(_, pair_v, pair_ty)));
ret res(bcx, pair_v);
}
@@ -3959,23 +3962,24 @@ fn trans_args(@block_ctxt cx,
}
}
if (ty.type_has_dynamic_size(retty)) {
- llargs += bcx.build.PointerCast(llretslot,
- T_typaram_ptr(cx.fcx.ccx.tn));
+ llargs += vec(bcx.build.PointerCast(llretslot,
+ T_typaram_ptr(cx.fcx.ccx.tn)));
} else if (ty.count_ty_params(retty) != 0u) {
// It's possible that the callee has some generic-ness somewhere in
// its return value -- say a method signature within an obj or a fn
// type deep in a structure -- which the caller has a concrete view
// of. If so, cast the caller's view of the restlot to the callee's
// view, for the sake of making a type-compatible call.
- llargs += cx.build.PointerCast(llretslot,
- T_ptr(type_of(bcx.fcx.ccx, retty)));
+ llargs +=
+ vec(cx.build.PointerCast(llretslot,
+ T_ptr(type_of(bcx.fcx.ccx, retty))));
} else {
- llargs += llretslot;
+ llargs += vec(llretslot);
}
// Arg 1: Task pointer.
- llargs += bcx.fcx.lltaskptr;
+ llargs += vec(bcx.fcx.lltaskptr);
// Arg 2: Env (closure-bindings / self-obj)
alt (llobj) {
@@ -3983,10 +3987,10 @@ fn trans_args(@block_ctxt cx,
// Every object is always found in memory,
// and not-yet-loaded (as part of an lval x.y
// doted method-call).
- llargs += bcx.build.Load(ob);
+ llargs += vec(bcx.build.Load(ob));
}
case (_) {
- llargs += llenv;
+ llargs += vec(llenv);
}
}
@@ -3997,7 +4001,7 @@ fn trans_args(@block_ctxt cx,
alt (lliterbody) {
case (none[ValueRef]) {}
case (some[ValueRef](?lli)) {
- llargs += lli;
+ llargs += vec(lli);
}
}
@@ -4054,7 +4058,7 @@ fn trans_args(@block_ctxt cx,
val = bcx.build.PointerCast(val, lldestty);
}
- llargs += val;
+ llargs += vec(val);
i += 1u;
}
@@ -4116,7 +4120,8 @@ fn trans_call(@block_ctxt cx, @ast.expr f,
// Retval doesn't correspond to anything really tangible in the frame,
// but it's a ref all the same, so we put a note here to drop it when
// we're done in this scope.
- find_scope_cx(cx).cleanups += clean(bind drop_ty(_, retval, ret_ty));
+ find_scope_cx(cx).cleanups +=
+ vec(clean(bind drop_ty(_, retval, ret_ty)));
}
ret res(bcx, retval);
@@ -4130,7 +4135,8 @@ fn trans_tup(@block_ctxt cx, vec[ast.elt] elts,
auto tup_val = tup_res.val;
bcx = tup_res.bcx;
- find_scope_cx(cx).cleanups += clean(bind drop_ty(_, tup_val, t));
+ find_scope_cx(cx).cleanups +=
+ vec(clean(bind drop_ty(_, tup_val, t)));
let int i = 0;
for (ast.elt e in elts) {
@@ -4171,7 +4177,8 @@ fn trans_vec(@block_ctxt cx, vec[@ast.expr] args,
auto llty = type_of(bcx.fcx.ccx, t);
auto vec_val = vi2p(bcx, sub.val, llty);
- find_scope_cx(bcx).cleanups += clean(bind drop_ty(_, vec_val, t));
+ find_scope_cx(bcx).cleanups +=
+ vec(clean(bind drop_ty(_, vec_val, t)));
auto body = bcx.build.GEP(vec_val, vec(C_int(0),
C_int(abi.vec_elt_data)));
@@ -4226,7 +4233,8 @@ fn trans_rec(@block_ctxt cx, vec[ast.field] fields,
auto rec_val = rec_res.val;
bcx = rec_res.bcx;
- find_scope_cx(cx).cleanups += clean(bind drop_ty(_, rec_val, t));
+ find_scope_cx(cx).cleanups +=
+ vec(clean(bind drop_ty(_, rec_val, t)));
let int i = 0;
auto base_val = C_nil();
@@ -4499,7 +4507,7 @@ fn trans_put(@block_ctxt cx, &option.t[@ast.expr] e) -> result {
llarg = bcx.build.Load(llarg);
}
- llargs += llarg;
+ llargs += vec(llarg);
}
}
@@ -4557,7 +4565,7 @@ fn init_local(@block_ctxt cx, @ast.local local) -> result {
auto bcx = cx;
find_scope_cx(cx).cleanups +=
- clean(bind drop_slot(_, llptr, ty));
+ vec(clean(bind drop_slot(_, llptr, ty)));
alt (local.init) {
case (some[@ast.expr](?e)) {
@@ -5026,7 +5034,7 @@ fn trans_vtbl(@crate_ctxt cx, TypeRef self_ty,
trans_fn(mcx, m.node.meth, m.node.id, some[TypeRef](self_ty),
ty_params, m.node.ann);
- methods += llfn;
+ methods += vec(llfn);
}
auto vtbl = C_struct(methods);
auto gvar = llvm.LLVMAddGlobal(cx.llmod,
@@ -5085,14 +5093,14 @@ fn trans_obj(@crate_ctxt cx, &ast._obj ob, ast.def_id oid,
// Malloc a box for the body and copy args in.
let vec[@ty.t] obj_fields = vec();
for (ty.arg a in arg_tys) {
- append[@ty.t](obj_fields, a.ty);
+ _vec.push[@ty.t](obj_fields, a.ty);
}
// Synthesize an obj body type.
auto tydesc_ty = plain_ty(ty.ty_type);
let vec[@ty.t] tps = vec();
for (ast.ty_param tp in ty_params) {
- append[@ty.t](tps, tydesc_ty);
+ _vec.push[@ty.t](tps, tydesc_ty);
}
let @ty.t typarams_ty = plain_ty(ty.ty_tup(tps));
diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs
index 0c540f5c..923d97ff 100644
--- a/src/comp/middle/ty.rs
+++ b/src/comp/middle/ty.rs
@@ -11,7 +11,6 @@ import driver.session;
import front.ast;
import front.ast.mutability;
import util.common;
-import util.common.append;
import util.common.new_def_hash;
import util.common.span;
@@ -756,7 +755,7 @@ fn field_num(session.session sess, &span sp, &ast.ident id) -> uint {
accum += (c as uint) - ('0' as uint);
} else {
auto s = "";
- s += c;
+ s += _str.unsafe_from_byte(c);
sess.span_err(sp,
"bad numeric field on tuple: "
+ " non-digit character: "
@@ -1104,7 +1103,7 @@ fn unify(@ty.t expected, @ty.t actual, &unify_handler handler)
alt (result) {
case (ures_ok(?rty)) {
- append[@ty.t](result_tps, rty);
+ _vec.push[@ty.t](result_tps, rty);
}
case (_) {
ret result;
@@ -1244,7 +1243,7 @@ fn unify(@ty.t expected, @ty.t actual, &unify_handler handler)
handler);
alt (result) {
case (ures_ok(?rty)) {
- append[@ty.t](result_elems,rty);
+ _vec.push[@ty.t](result_elems,rty);
}
case (_) {
ret result;
@@ -1301,7 +1300,7 @@ fn unify(@ty.t expected, @ty.t actual, &unify_handler handler)
handler);
alt (result) {
case (ures_ok(?rty)) {
- append[field]
+ _vec.push[field]
(result_fields,
rec(ty=rty with expected_field));
}
diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs
index 1818c4fd..6668c208 100644
--- a/src/comp/middle/typeck.rs
+++ b/src/comp/middle/typeck.rs
@@ -4,7 +4,6 @@ import front.ast.mutability;
import middle.fold;
import driver.session;
import util.common;
-import util.common.append;
import util.common.span;
import middle.ty;
@@ -320,14 +319,14 @@ fn ast_ty_to_ty(ty_getter getter, &@ast.ty ast_ty) -> @ty.t {
case (ast.ty_tup(?fields)) {
let vec[@ty.t] flds = vec();
for (@ast.ty field in fields) {
- append[@ty.t](flds, ast_ty_to_ty(getter, field));
+ _vec.push[@ty.t](flds, ast_ty_to_ty(getter, field));
}
sty = ty.ty_tup(flds);
}
case (ast.ty_rec(?fields)) {
let vec[field] flds = vec();
for (ast.ty_field f in fields) {
- append[field](flds, rec(ident=f.ident,
+ _vec.push[field](flds, rec(ident=f.ident,
ty=ast_ty_to_ty(getter, f.ty)));
}
sty = ty.ty_rec(flds);
@@ -371,7 +370,7 @@ fn ast_ty_to_ty(ty_getter getter, &@ast.ty ast_ty) -> @ty.t {
for (ast.ty_method m in meths) {
auto ins = _vec.map[ast.ty_arg, arg](f, m.inputs);
auto out = ast_ty_to_ty(getter, m.output);
- append[ty.method](tmeths,
+ _vec.push[ty.method](tmeths,
rec(proto=m.proto,
ident=m.ident,
inputs=ins,
@@ -565,7 +564,7 @@ fn collect_item_types(session.session sess, @ast.crate crate)
for (ast.obj_field f in obj_info.fields) {
auto g = bind getter(id_to_ty_item, item_to_ty, _);
auto t_field = ast_ty_to_ty(g, f.ty);
- append[arg](t_inputs, rec(mode=ast.alias, ty=t_field));
+ _vec.push[arg](t_inputs, rec(mode=ast.alias, ty=t_field));
}
auto t_fn = plain_ty(ty.ty_fn(ast.proto_fn, t_inputs, t_obj));
ret t_fn;
@@ -870,7 +869,7 @@ fn collect_item_types(session.session sess, @ast.crate crate)
with meth.node
);
m = @rec(node=m_ with *meth);
- append[@ast.method](methods, m);
+ _vec.push[@ast.method](methods, m);
}
auto g = bind getter(e.id_to_ty_item, e.item_to_ty, _);
for (ast.obj_field fld in ob.fields) {
@@ -879,7 +878,7 @@ fn collect_item_types(session.session sess, @ast.crate crate)
ann=ast.ann_type(fty, none[vec[@ty.t]])
with fld
);
- append[ast.obj_field](fields, f);
+ _vec.push[ast.obj_field](fields, f);
}
auto ob_ = rec(methods = methods,
@@ -1572,14 +1571,14 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
// FIXME: this breaks aliases. We need a ty_fn_arg.
auto arg_ty = rec(mode=ast.val, ty=expr_ty(a_0));
- append[arg](arg_tys_0, arg_ty);
+ _vec.push[arg](arg_tys_0, arg_ty);
}
case (none[@ast.expr]) {
args_0 += vec(none[@ast.expr]);
// FIXME: breaks aliases too?
auto typ = next_ty_var(fcx.ccx);
- append[arg](arg_tys_0, rec(mode=ast.val, ty=typ));
+ _vec.push[arg](arg_tys_0, rec(mode=ast.val, ty=typ));
}
}
}
@@ -1623,10 +1622,11 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
case (some[@ast.expr](?e_0)) {
auto arg_ty_1 = arg_tys_1.(i);
auto e_1 = demand_expr(fcx, arg_ty_1.ty, e_0);
- append[option.t[@ast.expr]](args_1, some[@ast.expr](e_1));
+ _vec.push[option.t[@ast.expr]](args_1,
+ some[@ast.expr](e_1));
}
case (none[@ast.expr]) {
- append[option.t[@ast.expr]](args_1, none[@ast.expr]);
+ _vec.push[option.t[@ast.expr]](args_1, none[@ast.expr]);
}
}
@@ -2114,7 +2114,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
auto expr_1 = check_expr(fcx, e);
auto expr_t = expr_ty(expr_1);
demand(fcx, expr.span, t, expr_t);
- append[@ast.expr](args_1,expr_1);
+ _vec.push[@ast.expr](args_1,expr_1);
}
auto ann = ast.ann_type(plain_ty(ty.ty_vec(t)), none[vec[@ty.t]]);
ret @fold.respan[ast.expr_](expr.span,
@@ -2131,8 +2131,8 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
if (e.mut == ast.mut) {
expr_t = @rec(mut=ast.mut with *expr_t);
}
- append[ast.elt](elts_1, rec(expr=expr_1 with e));
- append[@ty.t](elts_t, expr_t);
+ _vec.push[ast.elt](elts_1, rec(expr=expr_1 with e));
+ _vec.push[@ty.t](elts_t, expr_t);
}
auto ann = ast.ann_type(plain_ty(ty.ty_tup(elts_t)),
@@ -2160,8 +2160,8 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
if (f.mut == ast.mut) {
expr_t = @rec(mut=ast.mut with *expr_t);
}
- append[ast.field](fields_1, rec(expr=expr_1 with f));
- append[field](fields_t, rec(ident=f.ident, ty=expr_t));
+ _vec.push[ast.field](fields_1, rec(expr=expr_1 with f));
+ _vec.push[field](fields_t, rec(ident=f.ident, ty=expr_t));
}
auto ann = ast.ann_none;
@@ -2418,7 +2418,7 @@ fn check_stmt(&@fn_ctxt fcx, &@ast.stmt stmt) -> @ast.stmt {
fn check_block(&@fn_ctxt fcx, &ast.block block) -> ast.block {
let vec[@ast.stmt] stmts = vec();
for (@ast.stmt s in block.node.stmts) {
- append[@ast.stmt](stmts, check_stmt(fcx, s));
+ _vec.push[@ast.stmt](stmts, check_stmt(fcx, s));
}
auto expr = none[@ast.expr];