diff options
| author | Cameron Zwarich <zwarich@mozilla.com> | 2014-06-06 11:59:33 -0700 |
|---|---|---|
| committer | Cameron Zwarich <zwarich@mozilla.com> | 2014-06-06 11:59:33 -0700 |
| commit | 78934b03e39af86e60bdafcfe186b0f88c5b192e (patch) | |
| tree | cb87ebbf23707ea6d2539389c3faf292352e8b90 | |
| parent | 40e3fb4c0b46569b0ab4f5642ed1726915d59e98 (diff) | |
| download | rust-78934b03e39af86e60bdafcfe186b0f88c5b192e.tar.gz rust-78934b03e39af86e60bdafcfe186b0f88c5b192e.zip | |
Add a kind_of_move_of_path method to FlowedMoveData.
| -rw-r--r-- | src/librustc/middle/borrowck/move_data.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/librustc/middle/borrowck/move_data.rs b/src/librustc/middle/borrowck/move_data.rs index 1c72c6d6702..3e38aed20ce 100644 --- a/src/librustc/middle/borrowck/move_data.rs +++ b/src/librustc/middle/borrowck/move_data.rs @@ -537,6 +537,28 @@ impl<'a> FlowedMoveData<'a> { }) } + pub fn kind_of_move_of_path(&self, + id: ast::NodeId, + loan_path: &Rc<LoanPath>) + -> Option<MoveKind> { + //! Returns the kind of a move of `loan_path` by `id`, if one exists. + + let mut ret = None; + for loan_path_index in self.move_data.path_map.borrow().find(&*loan_path).iter() { + self.dfcx_moves.each_gen_bit_frozen(id, |move_index| { + let move = self.move_data.moves.borrow(); + let move = move.get(move_index); + if move.path == **loan_path_index { + ret = Some(move.kind); + false + } else { + true + } + }); + } + ret + } + pub fn each_move_of(&self, id: ast::NodeId, loan_path: &Rc<LoanPath>, |
