@@ -297,12 +297,6 @@ fn stm_to_stmts(ctx: &Ctx, state: &mut State, stm: &Stm) -> Vec<Stmt> {
297
297
}
298
298
}
299
299
Some ( Dest { var, mutable } ) => {
300
- if ctx. debug {
301
- // Add a snapshot before we modify the destination
302
- let name = format ! ( "{}_{:?}" , var. clone( ) , stm. span. raw_span) ; // TODO: Use line number?
303
- let snapshot = Rc :: new ( StmtX :: Snapshot ( Rc :: new ( name) ) ) ;
304
- stmts. push ( snapshot) ;
305
- }
306
300
let x = suffix_local_id ( & var. clone ( ) ) ;
307
301
let mut overwrite = false ;
308
302
for arg in args. iter ( ) {
@@ -326,6 +320,12 @@ fn stm_to_stmts(ctx: &Ctx, state: &mut State, stm: &Stm) -> Vec<Stmt> {
326
320
let havoc = StmtX :: Havoc ( x. clone ( ) ) ;
327
321
stmts. push ( Rc :: new ( havoc) ) ;
328
322
}
323
+ if ctx. debug {
324
+ // Add a snapshot after we modify the destination
325
+ let name = format ! ( "{}_{:?}" , var. clone( ) , stm. span. raw_span) ; // TODO: Use line number?
326
+ let snapshot = Rc :: new ( StmtX :: Snapshot ( Rc :: new ( name) ) ) ;
327
+ stmts. push ( snapshot) ;
328
+ }
329
329
}
330
330
}
331
331
if func. x . ensure . len ( ) > 0 {
@@ -355,8 +355,9 @@ fn stm_to_stmts(ctx: &Ctx, state: &mut State, stm: &Stm) -> Vec<Stmt> {
355
355
ExpX :: Var ( ident) => ident,
356
356
_ => panic ! ( "unexpected lhs {:?} in assign" , lhs) ,
357
357
} ;
358
+ stmts. push ( Rc :: new ( StmtX :: Assign ( suffix_local_id ( & ident) , exp_to_expr ( ctx, rhs) ) ) ) ;
358
359
if ctx. debug {
359
- // Add a snapshot before we modify the destination
360
+ // Add a snapshot after we modify the destination
360
361
// TODO: Factor out the span reasoning, so we don't pull rustc into this part of
361
362
// the code base?
362
363
let span: & rustc_span:: Span = ( * stm. span . raw_span )
@@ -367,7 +368,6 @@ fn stm_to_stmts(ctx: &Ctx, state: &mut State, stm: &Stm) -> Vec<Stmt> {
367
368
let snapshot = Rc :: new ( StmtX :: Snapshot ( Rc :: new ( name) ) ) ;
368
369
stmts. push ( snapshot) ;
369
370
}
370
- stmts. push ( Rc :: new ( StmtX :: Assign ( suffix_local_id ( & ident) , exp_to_expr ( ctx, rhs) ) ) ) ;
371
371
stmts
372
372
}
373
373
StmX :: If ( cond, lhs, rhs) => {
0 commit comments