Add an Init mode to MutateMode.

This isn't necessary right now, but check_loans needs to be able to
distinguish between initialization and writes in the ExprUseVisitor
mutate callback.
This commit is contained in:
Cameron Zwarich 2014-06-06 11:59:32 -07:00
parent 0339b27e6d
commit f63fad5d60
2 changed files with 3 additions and 2 deletions

View file

@ -356,7 +356,7 @@ impl MoveData {
let path_index = self.move_path(tcx, lp.clone());
match mode {
euv::JustWrite => {
euv::Init | euv::JustWrite => {
self.assignee_ids.borrow_mut().insert(assignee_id);
}
euv::WriteAndRead => { }

View file

@ -86,6 +86,7 @@ pub enum ConsumeMode {
#[deriving(PartialEq,Show)]
pub enum MutateMode {
Init,
JustWrite, // x = y
WriteAndRead, // x += y
}
@ -712,7 +713,7 @@ impl<'d,'t,TYPER:mc::Typer> ExprUseVisitor<'d,'t,TYPER> {
let def = def_map.borrow().get_copy(&pat.id);
match mc.cat_def(pat.id, pat.span, pat_ty, def) {
Ok(binding_cmt) => {
delegate.mutate(pat.id, pat.span, binding_cmt, JustWrite);
delegate.mutate(pat.id, pat.span, binding_cmt, Init);
}
Err(_) => { }
}