From 4e0c285741aac64630ed67befdbceeeadd241965 Mon Sep 17 00:00:00 2001 From: Daniel Watkins Date: Tue, 7 Aug 2018 15:45:58 -0400 Subject: [PATCH] Use more descriptive variable names in objsequence::get_item --- vm/src/objsequence.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/vm/src/objsequence.rs b/vm/src/objsequence.rs index ca24848db..a0c168376 100644 --- a/vm/src/objsequence.rs +++ b/vm/src/objsequence.rs @@ -41,15 +41,15 @@ fn get_slice_items(l: &Vec, slice: &PyObjectRef) -> Vec, - b: PyObjectRef, + sequence: &PyObjectRef, + elements: &Vec, + subscript: PyObjectRef, ) -> PyResult { - match &(b.borrow()).kind { + match &(subscript.borrow()).kind { PyObjectKind::Integer { value } => { - let pos_index = get_pos(l, *value); - if pos_index < l.len() { - let obj = l[pos_index].clone(); + let pos_index = get_pos(elements, *value); + if pos_index < elements.len() { + let obj = elements[pos_index].clone(); Ok(obj) } else { Err(vm.new_exception("Index out of bounds!".to_string())) @@ -60,12 +60,12 @@ pub fn get_item( stop: _, step: _, } => Ok(PyObject::new( - match &(a.borrow()).kind { + match &(sequence.borrow()).kind { PyObjectKind::Tuple { elements: _ } => PyObjectKind::Tuple { - elements: get_slice_items(l, &b), + elements: get_slice_items(elements, &subscript), }, PyObjectKind::List { elements: _ } => PyObjectKind::List { - elements: get_slice_items(l, &b), + elements: get_slice_items(elements, &subscript), }, ref kind => panic!("sequence get_item called for non-sequence: {:?}", kind), }, @@ -73,7 +73,7 @@ pub fn get_item( )), _ => Err(vm.new_exception(format!( "TypeError: indexing type {:?} with index {:?} is not supported (yet?)", - l, b + sequence, subscript ))), } }