Skip to content

Commit 4a5eeee

Browse files
committed
---
yaml --- r: 3990 b: refs/heads/master c: ce3d633 h: refs/heads/master v: v3
1 parent 835ed8a commit 4a5eeee

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 242ec22032f50a7919e0d02e168a3fe11e2cbc6a
2+
refs/heads/master: ce3d6339e0454b6353e863f226ddd2a3900f9e51

trunk/src/comp/middle/trans_dps.rs

+22-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,10 @@ fn store_imm(&@block_ctxt bcx, &dest dest, ValueRef llsrc, bool cast)
196196
fn store_ptr(&@block_ctxt bcx, &dest dest, ValueRef llsrcptr) -> @block_ctxt {
197197
alt (dest) {
198198
dst_nil { /* no-op */ }
199-
dst_imm(?box) { fail "dst_imm in store_ptr"; }
199+
dst_imm(?box) {
200+
assert (std::option::is_none(*box));
201+
*box = some(bcx.build.Load(llsrcptr));
202+
}
200203
dst_alias(?box) {
201204
assert (std::option::is_none(*box));
202205
*box = some(llsrcptr);
@@ -423,6 +426,23 @@ fn trans_log(&@block_ctxt cx, &span sp, int level, &@ast::expr expr)
423426
ret next_bcx;
424427
}
425428

429+
fn trans_path(&@block_ctxt bcx, &dest dest, &ast::path path, ast::node_id id)
430+
-> @block_ctxt {
431+
alt (bcx_tcx(bcx).def_map.get(id)) {
432+
ast::def_local(?def_id) {
433+
alt (bcx_fcx(bcx).lllocals.find(def_id._1)) {
434+
none { bcx_ccx(bcx).sess.unimpl("upvar in trans_path"); }
435+
some(?llptr) {
436+
// TODO: Copy hooks.
437+
store_ptr(bcx, dest, llptr);
438+
}
439+
}
440+
}
441+
_ { bcx_ccx(bcx).sess.unimpl("def variant in trans_dps::trans_path"); }
442+
}
443+
ret bcx;
444+
}
445+
426446
fn trans_expr(&@block_ctxt bcx, &dest dest, &@ast::expr expr) -> @block_ctxt {
427447
alt (expr.node) {
428448
ast::expr_lit(?lit) { trans_lit(bcx, dest, *lit); ret bcx; }
@@ -432,6 +452,7 @@ fn trans_expr(&@block_ctxt bcx, &dest dest, &@ast::expr expr) -> @block_ctxt {
432452
ast::expr_binary(?op, ?lhs, ?rhs) {
433453
ret trans_binary(bcx, dest, expr.span, op, lhs, rhs);
434454
}
455+
ast::expr_path(?path) { ret trans_path(bcx, dest, path, expr.id); }
435456
_ { fail "unhandled expr type in trans_expr"; }
436457
}
437458
}

0 commit comments

Comments
 (0)