Skip to content

Commit f19a9b9

Browse files
committed
librustc: Extract parent from move data as an accessor
1 parent 211c6d5 commit f19a9b9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/librustc/middle/borrowck/move_data.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ impl MoveData {
177177
self.paths[*index].loan_path
178178
}
179179

180+
fn path_parent(&self, index: MovePathIndex) -> MovePathIndex {
181+
self.paths[*index].parent
182+
}
183+
180184
fn path<'a>(&'a self, index: MovePathIndex) -> &'a MovePath {
181185
//! Type safe indexing operator
182186
&self.paths[*index]
@@ -194,7 +198,7 @@ impl MoveData {
194198

195199
fn is_var_path(&self, index: MovePathIndex) -> bool {
196200
//! True if `index` refers to a variable
197-
self.path(index).parent == InvalidMovePathIndex
201+
self.path_parent(index) == InvalidMovePathIndex
198202
}
199203

200204
pub fn move_path(&mut self,
@@ -232,7 +236,7 @@ impl MoveData {
232236
let parent_index = self.move_path(tcx, base);
233237
let index = MovePathIndex(self.paths.len());
234238

235-
let next_sibling = self.path(parent_index).first_child;
239+
let next_sibling = self.path_first_child(parent_index);
236240
self.mut_path(parent_index).first_child = index;
237241

238242
self.paths.push(MovePath {
@@ -422,7 +426,7 @@ impl MoveData {
422426
if !f(p) {
423427
return false;
424428
}
425-
p = self.path(p).parent;
429+
p = self.path_parent(p);
426430
}
427431
return true;
428432
}

0 commit comments

Comments
 (0)