@@ -196,7 +196,10 @@ fn store_imm(&@block_ctxt bcx, &dest dest, ValueRef llsrc, bool cast)
196
196
fn store_ptr ( & @block_ctxt bcx , & dest dest, ValueRef llsrcptr) -> @block_ctxt {
197
197
alt ( dest) {
198
198
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
+ }
200
203
dst_alias ( ?box) {
201
204
assert ( std:: option:: is_none ( * box) ) ;
202
205
* box = some ( llsrcptr) ;
@@ -423,6 +426,23 @@ fn trans_log(&@block_ctxt cx, &span sp, int level, &@ast::expr expr)
423
426
ret next_bcx;
424
427
}
425
428
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
+
426
446
fn trans_expr ( & @block_ctxt bcx , & dest dest, & @ast:: expr expr) -> @block_ctxt {
427
447
alt ( expr. node ) {
428
448
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 {
432
452
ast:: expr_binary ( ?op, ?lhs, ?rhs) {
433
453
ret trans_binary ( bcx, dest, expr. span , op, lhs, rhs) ;
434
454
}
455
+ ast:: expr_path ( ?path) { ret trans_path ( bcx, dest, path, expr. id ) ; }
435
456
_ { fail "unhandled expr type in trans_expr" ; }
436
457
}
437
458
}
0 commit comments