Skip to content

Commit 948b5ab

Browse files
author
blake2-ppc
committed
trans: Change @ast::Expr -> &ast::Expr where possible
1 parent 92e7bb6 commit 948b5ab

File tree

9 files changed

+56
-56
lines changed

9 files changed

+56
-56
lines changed

src/librustc/middle/dataflow.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
422422
}
423423

424424
fn walk_expr(&mut self,
425-
expr: @ast::Expr,
425+
expr: &ast::Expr,
426426
in_out: &mut [uint],
427427
loop_scopes: &mut ~[LoopScope]) {
428428
debug!("DataFlowContext::walk_expr(expr=%s, in_out=%s)",
@@ -744,7 +744,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
744744
}
745745

746746
fn pop_scopes(&mut self,
747-
from_expr: @ast::Expr,
747+
from_expr: &ast::Expr,
748748
to_scope: &mut LoopScope,
749749
in_out: &mut [uint]) {
750750
//! Whenever you have a `break` or a `loop` statement, flow
@@ -778,7 +778,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
778778
}
779779

780780
fn break_from_to(&mut self,
781-
from_expr: @ast::Expr,
781+
from_expr: &ast::Expr,
782782
to_scope: &mut LoopScope,
783783
in_out: &mut [uint]) {
784784
self.pop_scopes(from_expr, to_scope, in_out);
@@ -811,7 +811,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
811811
fn walk_call(&mut self,
812812
_callee_id: ast::NodeId,
813813
call_id: ast::NodeId,
814-
arg0: @ast::Expr,
814+
arg0: &ast::Expr,
815815
args: &[@ast::Expr],
816816
in_out: &mut [uint],
817817
loop_scopes: &mut ~[LoopScope]) {
@@ -865,7 +865,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
865865
}
866866

867867
fn find_scope<'a>(&self,
868-
expr: @ast::Expr,
868+
expr: &ast::Expr,
869869
label: Option<ast::Name>,
870870
loop_scopes: &'a mut ~[LoopScope]) -> &'a mut LoopScope {
871871
let index = match label {
@@ -899,7 +899,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
899899
&mut loop_scopes[index]
900900
}
901901

902-
fn is_method_call(&self, expr: @ast::Expr) -> bool {
902+
fn is_method_call(&self, expr: &ast::Expr) -> bool {
903903
self.dfcx.method_map.contains_key(&expr.id)
904904
}
905905

src/librustc/middle/trans/_match.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,7 @@ fn insert_lllocals(bcx: @mut Block,
13981398
}
13991399

14001400
fn compile_guard(bcx: @mut Block,
1401-
guard_expr: @ast::Expr,
1401+
guard_expr: &ast::Expr,
14021402
data: &ArmData,
14031403
m: &[Match],
14041404
vals: &[ValueRef],
@@ -1826,7 +1826,7 @@ fn compile_submatch_continue(mut bcx: @mut Block,
18261826

18271827
pub fn trans_match(bcx: @mut Block,
18281828
match_expr: &ast::Expr,
1829-
discr_expr: @ast::Expr,
1829+
discr_expr: &ast::Expr,
18301830
arms: &[ast::Arm],
18311831
dest: Dest) -> @mut Block {
18321832
let _icx = push_ctxt("match::trans_match");
@@ -1876,7 +1876,7 @@ fn create_bindings_map(bcx: @mut Block, pat: @ast::Pat) -> BindingsMap {
18761876
}
18771877

18781878
fn trans_match_inner(scope_cx: @mut Block,
1879-
discr_expr: @ast::Expr,
1879+
discr_expr: &ast::Expr,
18801880
arms: &[ast::Arm],
18811881
dest: Dest) -> @mut Block {
18821882
let _icx = push_ctxt("match::trans_match_inner");

src/librustc/middle/trans/callee.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub struct Callee {
7777
data: CalleeData
7878
}
7979

80-
pub fn trans(bcx: @mut Block, expr: @ast::Expr) -> Callee {
80+
pub fn trans(bcx: @mut Block, expr: &ast::Expr) -> Callee {
8181
let _icx = push_ctxt("trans_callee");
8282
debug!("callee::trans(expr=%s)", expr.repr(bcx.tcx()));
8383

@@ -92,7 +92,7 @@ pub fn trans(bcx: @mut Block, expr: @ast::Expr) -> Callee {
9292
// any other expressions are closures:
9393
return datum_callee(bcx, expr);
9494

95-
fn datum_callee(bcx: @mut Block, expr: @ast::Expr) -> Callee {
95+
fn datum_callee(bcx: @mut Block, expr: &ast::Expr) -> Callee {
9696
let DatumBlock {bcx, datum} = expr::trans_to_datum(bcx, expr);
9797
match ty::get(datum.ty).sty {
9898
ty::ty_bare_fn(*) => {
@@ -115,7 +115,7 @@ pub fn trans(bcx: @mut Block, expr: @ast::Expr) -> Callee {
115115
return Callee {bcx: bcx, data: Fn(fd)};
116116
}
117117

118-
fn trans_def(bcx: @mut Block, def: ast::Def, ref_expr: @ast::Expr) -> Callee {
118+
fn trans_def(bcx: @mut Block, def: ast::Def, ref_expr: &ast::Expr) -> Callee {
119119
match def {
120120
ast::DefFn(did, _) |
121121
ast::DefStaticMethod(did, ast::FromImpl(_), _) => {
@@ -447,8 +447,8 @@ pub fn trans_fn_ref_with_vtables(
447447
// Translating calls
448448

449449
pub fn trans_call(in_cx: @mut Block,
450-
call_ex: @ast::Expr,
451-
f: @ast::Expr,
450+
call_ex: &ast::Expr,
451+
f: &ast::Expr,
452452
args: CallArgs,
453453
id: ast::NodeId,
454454
dest: expr::Dest)
@@ -465,9 +465,9 @@ pub fn trans_call(in_cx: @mut Block,
465465
}
466466

467467
pub fn trans_method_call(in_cx: @mut Block,
468-
call_ex: @ast::Expr,
468+
call_ex: &ast::Expr,
469469
callee_id: ast::NodeId,
470-
rcvr: @ast::Expr,
470+
rcvr: &ast::Expr,
471471
args: CallArgs,
472472
dest: expr::Dest)
473473
-> @mut Block {
@@ -834,7 +834,7 @@ pub enum AutorefArg {
834834
pub fn trans_arg_expr(bcx: @mut Block,
835835
formal_arg_ty: ty::t,
836836
self_mode: ty::SelfMode,
837-
arg_expr: @ast::Expr,
837+
arg_expr: &ast::Expr,
838838
temp_cleanups: &mut ~[ValueRef],
839839
autoref_arg: AutorefArg) -> Result {
840840
let _icx = push_ctxt("trans_arg_expr");

src/librustc/middle/trans/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ impl Block {
670670
ast_map::node_id_to_str(self.tcx().items, id, self.sess().intr())
671671
}
672672

673-
pub fn expr_to_str(&self, e: @ast::Expr) -> ~str {
673+
pub fn expr_to_str(&self, e: &ast::Expr) -> ~str {
674674
e.repr(self.tcx())
675675
}
676676

src/librustc/middle/trans/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ pub fn get_const_val(cx: @mut CrateContext,
177177
!cx.non_inlineable_statics.contains(&def_id.node))
178178
}
179179

180-
pub fn const_expr(cx: @mut CrateContext, e: @ast::Expr) -> (ValueRef, bool) {
180+
pub fn const_expr(cx: @mut CrateContext, e: &ast::Expr) -> (ValueRef, bool) {
181181
let (llconst, inlineable) = const_expr_unadjusted(cx, e);
182182
let mut llconst = llconst;
183183
let mut inlineable = inlineable;

src/librustc/middle/trans/controlflow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub fn trans_block(bcx: @mut Block, b: &ast::Block, dest: expr::Dest) -> @mut Bl
4545
}
4646

4747
pub fn trans_if(bcx: @mut Block,
48-
cond: @ast::Expr,
48+
cond: &ast::Expr,
4949
thn: &ast::Block,
5050
els: Option<@ast::Expr>,
5151
dest: expr::Dest)
@@ -158,7 +158,7 @@ pub fn join_blocks(parent_bcx: @mut Block, in_cxs: &[@mut Block]) -> @mut Block
158158
return out;
159159
}
160160

161-
pub fn trans_while(bcx: @mut Block, cond: @ast::Expr, body: &ast::Block) -> @mut Block {
161+
pub fn trans_while(bcx: @mut Block, cond: &ast::Expr, body: &ast::Block) -> @mut Block {
162162
let _icx = push_ctxt("trans_while");
163163
let next_bcx = sub_block(bcx, "while next");
164164

src/librustc/middle/trans/expr.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ fn drop_and_cancel_clean(bcx: @mut Block, dat: Datum) -> @mut Block {
181181
return bcx;
182182
}
183183

184-
pub fn trans_to_datum(bcx: @mut Block, expr: @ast::Expr) -> DatumBlock {
184+
pub fn trans_to_datum(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
185185
debug!("trans_to_datum(expr=%s)", bcx.expr_to_str(expr));
186186

187187
let mut bcx = bcx;
@@ -307,7 +307,7 @@ pub fn trans_to_datum(bcx: @mut Block, expr: @ast::Expr) -> DatumBlock {
307307

308308
fn auto_borrow_obj(mut bcx: @mut Block,
309309
autoderefs: uint,
310-
expr: @ast::Expr,
310+
expr: &ast::Expr,
311311
source_datum: Datum) -> DatumBlock {
312312
let tcx = bcx.tcx();
313313
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 {
419419
}
420420
}
421421

422-
pub fn trans_into(bcx: @mut Block, expr: @ast::Expr, dest: Dest) -> @mut Block {
422+
pub fn trans_into(bcx: @mut Block, expr: &ast::Expr, dest: Dest) -> @mut Block {
423423
if bcx.tcx().adjustments.contains_key(&expr.id) {
424424
// use trans_to_datum, which is mildly less efficient but
425425
// which will perform the adjustments:
@@ -477,7 +477,7 @@ pub fn trans_into(bcx: @mut Block, expr: @ast::Expr, dest: Dest) -> @mut Block {
477477
};
478478
}
479479

480-
fn trans_lvalue(bcx: @mut Block, expr: @ast::Expr) -> DatumBlock {
480+
fn trans_lvalue(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
481481
/*!
482482
*
483483
* Translates an lvalue expression, always yielding a by-ref
@@ -496,7 +496,7 @@ fn trans_lvalue(bcx: @mut Block, expr: @ast::Expr) -> DatumBlock {
496496
};
497497
}
498498

499-
fn trans_to_datum_unadjusted(bcx: @mut Block, expr: @ast::Expr) -> DatumBlock {
499+
fn trans_to_datum_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
500500
/*!
501501
* Translates an expression into a datum. If this expression
502502
* 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 {
562562
}
563563
}
564564

565-
fn trans_rvalue_datum_unadjusted(bcx: @mut Block, expr: @ast::Expr) -> DatumBlock {
565+
fn trans_rvalue_datum_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
566566
let _icx = push_ctxt("trans_rvalue_datum_unadjusted");
567567

568568
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
615615
}
616616
}
617617

618-
fn trans_rvalue_stmt_unadjusted(bcx: @mut Block, expr: @ast::Expr) -> @mut Block {
618+
fn trans_rvalue_stmt_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> @mut Block {
619619
let mut bcx = bcx;
620620
let _icx = push_ctxt("trans_rvalue_stmt");
621621

@@ -669,7 +669,7 @@ fn trans_rvalue_stmt_unadjusted(bcx: @mut Block, expr: @ast::Expr) -> @mut Block
669669
};
670670
}
671671

672-
fn trans_rvalue_dps_unadjusted(bcx: @mut Block, expr: @ast::Expr,
672+
fn trans_rvalue_dps_unadjusted(bcx: @mut Block, expr: &ast::Expr,
673673
dest: Dest) -> @mut Block {
674674
let _icx = push_ctxt("trans_rvalue_dps_unadjusted");
675675
let tcx = bcx.tcx();
@@ -878,7 +878,7 @@ fn trans_def_datum_unadjusted(bcx: @mut Block,
878878
}
879879
}
880880

881-
fn trans_lvalue_unadjusted(bcx: @mut Block, expr: @ast::Expr) -> DatumBlock {
881+
fn trans_lvalue_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
882882
/*!
883883
*
884884
* Translates an lvalue expression, always yielding a by-ref
@@ -918,7 +918,7 @@ fn trans_lvalue_unadjusted(bcx: @mut Block, expr: @ast::Expr) -> DatumBlock {
918918
};
919919

920920
fn trans_rec_field(bcx: @mut Block,
921-
base: @ast::Expr,
921+
base: &ast::Expr,
922922
field: ast::Ident) -> DatumBlock {
923923
//! Translates `base.field`.
924924
@@ -942,8 +942,8 @@ fn trans_lvalue_unadjusted(bcx: @mut Block, expr: @ast::Expr) -> DatumBlock {
942942

943943
fn trans_index(bcx: @mut Block,
944944
index_expr: &ast::Expr,
945-
base: @ast::Expr,
946-
idx: @ast::Expr) -> DatumBlock {
945+
base: &ast::Expr,
946+
idx: &ast::Expr) -> DatumBlock {
947947
//! Translates `base[idx]`.
948948
949949
let _icx = push_ctxt("trans_index");
@@ -1321,7 +1321,7 @@ fn trans_adt(bcx: @mut Block, repr: &adt::Repr, discr: ty::Disr,
13211321
}
13221322

13231323

1324-
fn trans_immediate_lit(bcx: @mut Block, expr: @ast::Expr,
1324+
fn trans_immediate_lit(bcx: @mut Block, expr: &ast::Expr,
13251325
lit: ast::lit) -> DatumBlock {
13261326
// must not be a string constant, that is a RvalueDpsExpr
13271327
let _icx = push_ctxt("trans_immediate_lit");
@@ -1332,7 +1332,7 @@ fn trans_immediate_lit(bcx: @mut Block, expr: @ast::Expr,
13321332
fn trans_unary_datum(bcx: @mut Block,
13331333
un_expr: &ast::Expr,
13341334
op: ast::UnOp,
1335-
sub_expr: @ast::Expr) -> DatumBlock {
1335+
sub_expr: &ast::Expr) -> DatumBlock {
13361336
let _icx = push_ctxt("trans_unary_datum");
13371337

13381338
// if deref, would be LvalueExpr
@@ -1391,7 +1391,7 @@ fn trans_unary_datum(bcx: @mut Block,
13911391

13921392
fn trans_boxed_expr(bcx: @mut Block,
13931393
box_ty: ty::t,
1394-
contents: @ast::Expr,
1394+
contents: &ast::Expr,
13951395
contents_ty: ty::t,
13961396
heap: heap) -> DatumBlock {
13971397
let _icx = push_ctxt("trans_boxed_expr");
@@ -1416,7 +1416,7 @@ fn trans_unary_datum(bcx: @mut Block,
14161416
}
14171417

14181418
fn trans_addr_of(bcx: @mut Block, expr: &ast::Expr,
1419-
subexpr: @ast::Expr) -> DatumBlock {
1419+
subexpr: &ast::Expr) -> DatumBlock {
14201420
let _icx = push_ctxt("trans_addr_of");
14211421
let mut bcx = bcx;
14221422
let sub_datum = unpack_datum!(bcx, trans_to_datum(bcx, subexpr));
@@ -1532,8 +1532,8 @@ enum lazy_binop_ty { lazy_and, lazy_or }
15321532
fn trans_lazy_binop(bcx: @mut Block,
15331533
binop_expr: &ast::Expr,
15341534
op: lazy_binop_ty,
1535-
a: @ast::Expr,
1536-
b: @ast::Expr) -> DatumBlock {
1535+
a: &ast::Expr,
1536+
b: &ast::Expr) -> DatumBlock {
15371537
let _icx = push_ctxt("trans_lazy_binop");
15381538
let binop_ty = expr_ty(bcx, binop_expr);
15391539
let bcx = bcx;
@@ -1577,8 +1577,8 @@ fn trans_lazy_binop(bcx: @mut Block,
15771577
fn trans_binary(bcx: @mut Block,
15781578
binop_expr: &ast::Expr,
15791579
op: ast::BinOp,
1580-
lhs: @ast::Expr,
1581-
rhs: @ast::Expr) -> DatumBlock
1580+
lhs: &ast::Expr,
1581+
rhs: &ast::Expr) -> DatumBlock
15821582
{
15831583
let _icx = push_ctxt("trans_binary");
15841584

@@ -1603,7 +1603,7 @@ fn trans_binary(bcx: @mut Block,
16031603
fn trans_overloaded_op(bcx: @mut Block,
16041604
expr: &ast::Expr,
16051605
callee_id: ast::NodeId,
1606-
rcvr: @ast::Expr,
1606+
rcvr: &ast::Expr,
16071607
args: ~[@ast::Expr],
16081608
ret_ty: ty::t,
16091609
dest: Dest)
@@ -1679,7 +1679,7 @@ pub fn cast_type_kind(t: ty::t) -> cast_kind {
16791679
}
16801680
}
16811681

1682-
fn trans_imm_cast(bcx: @mut Block, expr: @ast::Expr,
1682+
fn trans_imm_cast(bcx: @mut Block, expr: &ast::Expr,
16831683
id: ast::NodeId) -> DatumBlock {
16841684
let _icx = push_ctxt("trans_cast");
16851685
let ccx = bcx.ccx();
@@ -1748,10 +1748,10 @@ fn trans_imm_cast(bcx: @mut Block, expr: @ast::Expr,
17481748
}
17491749

17501750
fn trans_assign_op(bcx: @mut Block,
1751-
expr: @ast::Expr,
1751+
expr: &ast::Expr,
17521752
callee_id: ast::NodeId,
17531753
op: ast::BinOp,
1754-
dst: @ast::Expr,
1754+
dst: &ast::Expr,
17551755
src: @ast::Expr) -> @mut Block
17561756
{
17571757
let _icx = push_ctxt("trans_assign_op");

0 commit comments

Comments
 (0)