trans: Change @ast::Expr -> &ast::Expr where possible

This commit is contained in:
blake2-ppc 2013-09-30 19:37:17 +02:00
parent 92e7bb67a8
commit 948b5ab87a
9 changed files with 56 additions and 56 deletions

View File

@ -422,7 +422,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
}
fn walk_expr(&mut self,
expr: @ast::Expr,
expr: &ast::Expr,
in_out: &mut [uint],
loop_scopes: &mut ~[LoopScope]) {
debug!("DataFlowContext::walk_expr(expr=%s, in_out=%s)",
@ -744,7 +744,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
}
fn pop_scopes(&mut self,
from_expr: @ast::Expr,
from_expr: &ast::Expr,
to_scope: &mut LoopScope,
in_out: &mut [uint]) {
//! Whenever you have a `break` or a `loop` statement, flow
@ -778,7 +778,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
}
fn break_from_to(&mut self,
from_expr: @ast::Expr,
from_expr: &ast::Expr,
to_scope: &mut LoopScope,
in_out: &mut [uint]) {
self.pop_scopes(from_expr, to_scope, in_out);
@ -811,7 +811,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
fn walk_call(&mut self,
_callee_id: ast::NodeId,
call_id: ast::NodeId,
arg0: @ast::Expr,
arg0: &ast::Expr,
args: &[@ast::Expr],
in_out: &mut [uint],
loop_scopes: &mut ~[LoopScope]) {
@ -865,7 +865,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
}
fn find_scope<'a>(&self,
expr: @ast::Expr,
expr: &ast::Expr,
label: Option<ast::Name>,
loop_scopes: &'a mut ~[LoopScope]) -> &'a mut LoopScope {
let index = match label {
@ -899,7 +899,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
&mut loop_scopes[index]
}
fn is_method_call(&self, expr: @ast::Expr) -> bool {
fn is_method_call(&self, expr: &ast::Expr) -> bool {
self.dfcx.method_map.contains_key(&expr.id)
}

View File

@ -1398,7 +1398,7 @@ fn insert_lllocals(bcx: @mut Block,
}
fn compile_guard(bcx: @mut Block,
guard_expr: @ast::Expr,
guard_expr: &ast::Expr,
data: &ArmData,
m: &[Match],
vals: &[ValueRef],
@ -1826,7 +1826,7 @@ fn compile_submatch_continue(mut bcx: @mut Block,
pub fn trans_match(bcx: @mut Block,
match_expr: &ast::Expr,
discr_expr: @ast::Expr,
discr_expr: &ast::Expr,
arms: &[ast::Arm],
dest: Dest) -> @mut Block {
let _icx = push_ctxt("match::trans_match");
@ -1876,7 +1876,7 @@ fn create_bindings_map(bcx: @mut Block, pat: @ast::Pat) -> BindingsMap {
}
fn trans_match_inner(scope_cx: @mut Block,
discr_expr: @ast::Expr,
discr_expr: &ast::Expr,
arms: &[ast::Arm],
dest: Dest) -> @mut Block {
let _icx = push_ctxt("match::trans_match_inner");

View File

@ -77,7 +77,7 @@ pub struct Callee {
data: CalleeData
}
pub fn trans(bcx: @mut Block, expr: @ast::Expr) -> Callee {
pub fn trans(bcx: @mut Block, expr: &ast::Expr) -> Callee {
let _icx = push_ctxt("trans_callee");
debug!("callee::trans(expr=%s)", expr.repr(bcx.tcx()));
@ -92,7 +92,7 @@ pub fn trans(bcx: @mut Block, expr: @ast::Expr) -> Callee {
// any other expressions are closures:
return datum_callee(bcx, expr);
fn datum_callee(bcx: @mut Block, expr: @ast::Expr) -> Callee {
fn datum_callee(bcx: @mut Block, expr: &ast::Expr) -> Callee {
let DatumBlock {bcx, datum} = expr::trans_to_datum(bcx, expr);
match ty::get(datum.ty).sty {
ty::ty_bare_fn(*) => {
@ -115,7 +115,7 @@ pub fn trans(bcx: @mut Block, expr: @ast::Expr) -> Callee {
return Callee {bcx: bcx, data: Fn(fd)};
}
fn trans_def(bcx: @mut Block, def: ast::Def, ref_expr: @ast::Expr) -> Callee {
fn trans_def(bcx: @mut Block, def: ast::Def, ref_expr: &ast::Expr) -> Callee {
match def {
ast::DefFn(did, _) |
ast::DefStaticMethod(did, ast::FromImpl(_), _) => {
@ -447,8 +447,8 @@ pub fn trans_fn_ref_with_vtables(
// Translating calls
pub fn trans_call(in_cx: @mut Block,
call_ex: @ast::Expr,
f: @ast::Expr,
call_ex: &ast::Expr,
f: &ast::Expr,
args: CallArgs,
id: ast::NodeId,
dest: expr::Dest)
@ -465,9 +465,9 @@ pub fn trans_call(in_cx: @mut Block,
}
pub fn trans_method_call(in_cx: @mut Block,
call_ex: @ast::Expr,
call_ex: &ast::Expr,
callee_id: ast::NodeId,
rcvr: @ast::Expr,
rcvr: &ast::Expr,
args: CallArgs,
dest: expr::Dest)
-> @mut Block {
@ -834,7 +834,7 @@ pub enum AutorefArg {
pub fn trans_arg_expr(bcx: @mut Block,
formal_arg_ty: ty::t,
self_mode: ty::SelfMode,
arg_expr: @ast::Expr,
arg_expr: &ast::Expr,
temp_cleanups: &mut ~[ValueRef],
autoref_arg: AutorefArg) -> Result {
let _icx = push_ctxt("trans_arg_expr");

View File

@ -670,7 +670,7 @@ impl Block {
ast_map::node_id_to_str(self.tcx().items, id, self.sess().intr())
}
pub fn expr_to_str(&self, e: @ast::Expr) -> ~str {
pub fn expr_to_str(&self, e: &ast::Expr) -> ~str {
e.repr(self.tcx())
}

View File

@ -177,7 +177,7 @@ pub fn get_const_val(cx: @mut CrateContext,
!cx.non_inlineable_statics.contains(&def_id.node))
}
pub fn const_expr(cx: @mut CrateContext, e: @ast::Expr) -> (ValueRef, bool) {
pub fn const_expr(cx: @mut CrateContext, e: &ast::Expr) -> (ValueRef, bool) {
let (llconst, inlineable) = const_expr_unadjusted(cx, e);
let mut llconst = llconst;
let mut inlineable = inlineable;

View File

@ -45,7 +45,7 @@ pub fn trans_block(bcx: @mut Block, b: &ast::Block, dest: expr::Dest) -> @mut Bl
}
pub fn trans_if(bcx: @mut Block,
cond: @ast::Expr,
cond: &ast::Expr,
thn: &ast::Block,
els: Option<@ast::Expr>,
dest: expr::Dest)
@ -158,7 +158,7 @@ pub fn join_blocks(parent_bcx: @mut Block, in_cxs: &[@mut Block]) -> @mut Block
return out;
}
pub fn trans_while(bcx: @mut Block, cond: @ast::Expr, body: &ast::Block) -> @mut Block {
pub fn trans_while(bcx: @mut Block, cond: &ast::Expr, body: &ast::Block) -> @mut Block {
let _icx = push_ctxt("trans_while");
let next_bcx = sub_block(bcx, "while next");

View File

@ -181,7 +181,7 @@ fn drop_and_cancel_clean(bcx: @mut Block, dat: Datum) -> @mut Block {
return bcx;
}
pub fn trans_to_datum(bcx: @mut Block, expr: @ast::Expr) -> DatumBlock {
pub fn trans_to_datum(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
debug!("trans_to_datum(expr=%s)", bcx.expr_to_str(expr));
let mut bcx = bcx;
@ -307,7 +307,7 @@ pub fn trans_to_datum(bcx: @mut Block, expr: @ast::Expr) -> DatumBlock {
fn auto_borrow_obj(mut bcx: @mut Block,
autoderefs: uint,
expr: @ast::Expr,
expr: &ast::Expr,
source_datum: Datum) -> DatumBlock {
let tcx = bcx.tcx();
let target_obj_ty = expr_ty_adjusted(bcx, expr);
@ -419,7 +419,7 @@ pub fn trans_to_datum(bcx: @mut Block, expr: @ast::Expr) -> DatumBlock {
}
}
pub fn trans_into(bcx: @mut Block, expr: @ast::Expr, dest: Dest) -> @mut Block {
pub fn trans_into(bcx: @mut Block, expr: &ast::Expr, dest: Dest) -> @mut Block {
if bcx.tcx().adjustments.contains_key(&expr.id) {
// use trans_to_datum, which is mildly less efficient but
// which will perform the adjustments:
@ -477,7 +477,7 @@ pub fn trans_into(bcx: @mut Block, expr: @ast::Expr, dest: Dest) -> @mut Block {
};
}
fn trans_lvalue(bcx: @mut Block, expr: @ast::Expr) -> DatumBlock {
fn trans_lvalue(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
/*!
*
* Translates an lvalue expression, always yielding a by-ref
@ -496,7 +496,7 @@ fn trans_lvalue(bcx: @mut Block, expr: @ast::Expr) -> DatumBlock {
};
}
fn trans_to_datum_unadjusted(bcx: @mut Block, expr: @ast::Expr) -> DatumBlock {
fn trans_to_datum_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
/*!
* Translates an expression into a datum. If this expression
* is an rvalue, this will result in a temporary value being
@ -562,7 +562,7 @@ fn trans_to_datum_unadjusted(bcx: @mut Block, expr: @ast::Expr) -> DatumBlock {
}
}
fn trans_rvalue_datum_unadjusted(bcx: @mut Block, expr: @ast::Expr) -> DatumBlock {
fn trans_rvalue_datum_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
let _icx = push_ctxt("trans_rvalue_datum_unadjusted");
trace_span!(bcx, expr.span, shorten(bcx.expr_to_str(expr)));
@ -615,7 +615,7 @@ fn trans_rvalue_datum_unadjusted(bcx: @mut Block, expr: @ast::Expr) -> DatumBloc
}
}
fn trans_rvalue_stmt_unadjusted(bcx: @mut Block, expr: @ast::Expr) -> @mut Block {
fn trans_rvalue_stmt_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> @mut Block {
let mut bcx = bcx;
let _icx = push_ctxt("trans_rvalue_stmt");
@ -669,7 +669,7 @@ fn trans_rvalue_stmt_unadjusted(bcx: @mut Block, expr: @ast::Expr) -> @mut Block
};
}
fn trans_rvalue_dps_unadjusted(bcx: @mut Block, expr: @ast::Expr,
fn trans_rvalue_dps_unadjusted(bcx: @mut Block, expr: &ast::Expr,
dest: Dest) -> @mut Block {
let _icx = push_ctxt("trans_rvalue_dps_unadjusted");
let tcx = bcx.tcx();
@ -878,7 +878,7 @@ fn trans_def_datum_unadjusted(bcx: @mut Block,
}
}
fn trans_lvalue_unadjusted(bcx: @mut Block, expr: @ast::Expr) -> DatumBlock {
fn trans_lvalue_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
/*!
*
* Translates an lvalue expression, always yielding a by-ref
@ -918,7 +918,7 @@ fn trans_lvalue_unadjusted(bcx: @mut Block, expr: @ast::Expr) -> DatumBlock {
};
fn trans_rec_field(bcx: @mut Block,
base: @ast::Expr,
base: &ast::Expr,
field: ast::Ident) -> DatumBlock {
//! Translates `base.field`.
@ -942,8 +942,8 @@ fn trans_lvalue_unadjusted(bcx: @mut Block, expr: @ast::Expr) -> DatumBlock {
fn trans_index(bcx: @mut Block,
index_expr: &ast::Expr,
base: @ast::Expr,
idx: @ast::Expr) -> DatumBlock {
base: &ast::Expr,
idx: &ast::Expr) -> DatumBlock {
//! Translates `base[idx]`.
let _icx = push_ctxt("trans_index");
@ -1321,7 +1321,7 @@ fn trans_adt(bcx: @mut Block, repr: &adt::Repr, discr: ty::Disr,
}
fn trans_immediate_lit(bcx: @mut Block, expr: @ast::Expr,
fn trans_immediate_lit(bcx: @mut Block, expr: &ast::Expr,
lit: ast::lit) -> DatumBlock {
// must not be a string constant, that is a RvalueDpsExpr
let _icx = push_ctxt("trans_immediate_lit");
@ -1332,7 +1332,7 @@ fn trans_immediate_lit(bcx: @mut Block, expr: @ast::Expr,
fn trans_unary_datum(bcx: @mut Block,
un_expr: &ast::Expr,
op: ast::UnOp,
sub_expr: @ast::Expr) -> DatumBlock {
sub_expr: &ast::Expr) -> DatumBlock {
let _icx = push_ctxt("trans_unary_datum");
// if deref, would be LvalueExpr
@ -1391,7 +1391,7 @@ fn trans_unary_datum(bcx: @mut Block,
fn trans_boxed_expr(bcx: @mut Block,
box_ty: ty::t,
contents: @ast::Expr,
contents: &ast::Expr,
contents_ty: ty::t,
heap: heap) -> DatumBlock {
let _icx = push_ctxt("trans_boxed_expr");
@ -1416,7 +1416,7 @@ fn trans_unary_datum(bcx: @mut Block,
}
fn trans_addr_of(bcx: @mut Block, expr: &ast::Expr,
subexpr: @ast::Expr) -> DatumBlock {
subexpr: &ast::Expr) -> DatumBlock {
let _icx = push_ctxt("trans_addr_of");
let mut bcx = bcx;
let sub_datum = unpack_datum!(bcx, trans_to_datum(bcx, subexpr));
@ -1532,8 +1532,8 @@ enum lazy_binop_ty { lazy_and, lazy_or }
fn trans_lazy_binop(bcx: @mut Block,
binop_expr: &ast::Expr,
op: lazy_binop_ty,
a: @ast::Expr,
b: @ast::Expr) -> DatumBlock {
a: &ast::Expr,
b: &ast::Expr) -> DatumBlock {
let _icx = push_ctxt("trans_lazy_binop");
let binop_ty = expr_ty(bcx, binop_expr);
let bcx = bcx;
@ -1577,8 +1577,8 @@ fn trans_lazy_binop(bcx: @mut Block,
fn trans_binary(bcx: @mut Block,
binop_expr: &ast::Expr,
op: ast::BinOp,
lhs: @ast::Expr,
rhs: @ast::Expr) -> DatumBlock
lhs: &ast::Expr,
rhs: &ast::Expr) -> DatumBlock
{
let _icx = push_ctxt("trans_binary");
@ -1603,7 +1603,7 @@ fn trans_binary(bcx: @mut Block,
fn trans_overloaded_op(bcx: @mut Block,
expr: &ast::Expr,
callee_id: ast::NodeId,
rcvr: @ast::Expr,
rcvr: &ast::Expr,
args: ~[@ast::Expr],
ret_ty: ty::t,
dest: Dest)
@ -1679,7 +1679,7 @@ pub fn cast_type_kind(t: ty::t) -> cast_kind {
}
}
fn trans_imm_cast(bcx: @mut Block, expr: @ast::Expr,
fn trans_imm_cast(bcx: @mut Block, expr: &ast::Expr,
id: ast::NodeId) -> DatumBlock {
let _icx = push_ctxt("trans_cast");
let ccx = bcx.ccx();
@ -1748,10 +1748,10 @@ fn trans_imm_cast(bcx: @mut Block, expr: @ast::Expr,
}
fn trans_assign_op(bcx: @mut Block,
expr: @ast::Expr,
expr: &ast::Expr,
callee_id: ast::NodeId,
op: ast::BinOp,
dst: @ast::Expr,
dst: &ast::Expr,
src: @ast::Expr) -> @mut Block
{
let _icx = push_ctxt("trans_assign_op");

View File

@ -139,7 +139,7 @@ pub fn trans_method(ccx: @mut CrateContext,
}
pub fn trans_self_arg(bcx: @mut Block,
base: @ast::Expr,
base: &ast::Expr,
temp_cleanups: &mut ~[ValueRef],
mentry: typeck::method_map_entry) -> Result {
let _icx = push_ctxt("impl::trans_self_arg");
@ -156,7 +156,7 @@ pub fn trans_self_arg(bcx: @mut Block,
pub fn trans_method_callee(bcx: @mut Block,
callee_id: ast::NodeId,
this: @ast::Expr,
this: &ast::Expr,
mentry: typeck::method_map_entry)
-> Callee {
let _icx = push_ctxt("impl::trans_method_callee");
@ -313,7 +313,7 @@ pub fn method_with_name(ccx: &mut CrateContext,
pub fn trans_monomorphized_callee(bcx: @mut Block,
callee_id: ast::NodeId,
base: @ast::Expr,
base: &ast::Expr,
mentry: typeck::method_map_entry,
trait_id: ast::DefId,
n_method: uint,
@ -420,7 +420,7 @@ pub fn combine_impl_and_methods_tps(bcx: @mut Block,
pub fn trans_trait_callee(bcx: @mut Block,
callee_id: ast::NodeId,
n_method: uint,
self_expr: @ast::Expr)
self_expr: &ast::Expr)
-> Callee {
/*!
* Create a method callee where the method is coming from a trait
@ -630,7 +630,7 @@ fn emit_vtable_methods(bcx: @mut Block,
}
pub fn trans_trait_cast(bcx: @mut Block,
val: @ast::Expr,
val: &ast::Expr,
id: ast::NodeId,
dest: expr::Dest,
_store: ty::TraitStore)

View File

@ -158,7 +158,7 @@ impl VecTypes {
}
pub fn trans_fixed_vstore(bcx: @mut Block,
vstore_expr: @ast::Expr,
vstore_expr: &ast::Expr,
content_expr: &ast::Expr,
dest: expr::Dest)
-> @mut Block {
@ -187,8 +187,8 @@ pub fn trans_fixed_vstore(bcx: @mut Block,
}
pub fn trans_slice_vstore(bcx: @mut Block,
vstore_expr: @ast::Expr,
content_expr: @ast::Expr,
vstore_expr: &ast::Expr,
content_expr: &ast::Expr,
dest: expr::Dest)
-> @mut Block {
//!
@ -246,7 +246,7 @@ pub fn trans_slice_vstore(bcx: @mut Block,
}
pub fn trans_lit_str(bcx: @mut Block,
lit_expr: @ast::Expr,
lit_expr: &ast::Expr,
str_lit: @str,
dest: Dest)
-> @mut Block {
@ -280,7 +280,7 @@ pub fn trans_lit_str(bcx: @mut Block,
}
pub fn trans_uniq_or_managed_vstore(bcx: @mut Block, heap: heap, vstore_expr: @ast::Expr,
pub fn trans_uniq_or_managed_vstore(bcx: @mut Block, heap: heap, vstore_expr: &ast::Expr,
content_expr: &ast::Expr) -> DatumBlock {
//!
//
@ -343,7 +343,7 @@ pub fn trans_uniq_or_managed_vstore(bcx: @mut Block, heap: heap, vstore_expr: @a
pub fn write_content(bcx: @mut Block,
vt: &VecTypes,
vstore_expr: @ast::Expr,
vstore_expr: &ast::Expr,
content_expr: &ast::Expr,
dest: Dest)
-> @mut Block {