@@ -111,6 +111,10 @@ fn visit_expr(@ctx cx, &@ast::expr ex, &scope sc, &vt[scope] v) {
111
111
check_var ( * cx, ex, pt, ex. id , false , sc) ;
112
112
handled = false ;
113
113
}
114
+ case ( ast:: expr_swap ( ?lhs, ?rhs) ) {
115
+ check_lval ( cx, lhs, sc, v) ;
116
+ check_lval ( cx, rhs, sc, v) ;
117
+ }
114
118
case ( ast:: expr_move ( ?dest, ?src) ) {
115
119
check_assign ( cx, dest, src, sc, v) ;
116
120
}
@@ -376,11 +380,7 @@ fn check_var(&ctx cx, &@ast::expr ex, &ast::path p, ast::node_id id,
376
380
}
377
381
}
378
382
379
-
380
- // FIXME does not catch assigning to immutable object fields yet
381
- fn check_assign ( & @ctx cx , & @ast:: expr dest, & @ast:: expr src, & scope sc,
382
- & vt[ scope] v ) {
383
- visit_expr ( cx, src, sc, v) ;
383
+ fn check_lval ( & @ctx cx , & @ast:: expr dest, & scope sc, & vt[ scope] v ) {
384
384
alt ( dest. node ) {
385
385
case ( ast:: expr_path ( ?p) ) {
386
386
auto dnum = ast:: def_id_of_def ( cx. tcx . def_map . get ( dest. id ) ) . _1 ;
@@ -418,6 +418,13 @@ fn check_assign(&@ctx cx, &@ast::expr dest, &@ast::expr src, &scope sc,
418
418
}
419
419
}
420
420
421
+ fn check_assign ( & @ctx cx , & @ast:: expr dest, & @ast:: expr src, & scope sc,
422
+ & vt[ scope] v ) {
423
+ visit_expr ( cx, src, sc, v) ;
424
+ check_lval ( cx, dest, sc, v) ;
425
+ }
426
+
427
+
421
428
fn is_immutable_alias ( & @ctx cx , & scope sc, node_id dnum) -> bool {
422
429
alt ( cx. local_map . find ( dnum) ) {
423
430
case ( some ( arg ( ast:: alias ( false ) ) ) ) { ret true ; }
0 commit comments