Add more information to unimplemented! panics

This commit is contained in:
Daniel Watkins
2018-08-04 00:53:01 -04:00
parent e1ce670d4b
commit 13e421a979
4 changed files with 6 additions and 7 deletions

View File

@@ -6,7 +6,6 @@ pub fn boolval(o: PyObjectRef) -> bool {
match obj.kind {
PyObjectKind::Boolean { value } => value,
PyObjectKind::Integer { value } => value != 0,
_ => unimplemented!(),
ref kind => unimplemented!("converting to boolean unsupported for: {:?}", kind),
}
}

View File

@@ -32,7 +32,7 @@ pub fn get_item(vm: &mut VirtualMachine, l: &Vec<PyObjectRef>, b: PyObjectRef) -
let step = match step {
//Some(step) => step as usize,
&None => 1 as usize,
_ => unimplemented!(),
_ => unimplemented!("stepped slicing not supported for type {:?}", l),
};
// TODO: we could potentially avoid this copy and use slice
let obj = PyObject::new(

View File

@@ -32,7 +32,7 @@ pub fn get_item(vm: &mut VirtualMachine, l: &Vec<PyObjectRef>, b: PyObjectRef) -
let step = match step {
//Some(step) => step as usize,
&None => 1 as usize,
_ => unimplemented!(),
_ => unimplemented!("stepped slicing not supported for type {:?}", l),
};
// TODO: we could potentially avoid this copy and use slice
let obj = PyObject::new(

View File

@@ -476,8 +476,8 @@ impl VirtualMachine {
self.run_frame(frame)
}
PyObjectKind::Class { name: _ } => self.new_instance(func_ref.clone(), args),
_ => {
unimplemented!();
ref kind => {
unimplemented!("invoke unimplemented for: {:?}", kind);
}
}
}
@@ -498,7 +498,7 @@ impl VirtualMachine {
// Lookup name in obj
let obj = match parent.borrow().kind {
PyObjectKind::Module { ref name, ref dict } => dict.get_item(attr_name),
_ => unimplemented!(),
ref kind => unimplemented!("load_attr unimplemented for: {:?}", kind),
};
self.push_value(obj);
None