Move more objects to obj folder

This commit is contained in:
Windel Bouwman committed 2018-09-01 10:00:55 +02:00
1 parent 5cdd0ab7b8
commit 40cf7f4579
10 files changed
+19 -19

No files matched your search

-3
View File
@@ -22,9 +22,6 @@ mod frame;
mod import;
mod obj;
mod objbool;
mod objfunction;
mod objobject;
mod objsequence;
pub mod pyobject;
pub mod stdlib;
mod sysmodule;
+3
View File
@@ -1,7 +1,10 @@
pub mod objbytes;
pub mod objdict;
pub mod objfloat;
pub mod objfunction;
pub mod objint;
pub mod objlist;
pub mod objobject;
pub mod objsequence;
pub mod objstr;
pub mod objtype;
@@ -1,5 +1,5 @@
use super::pyobject::{AttributeProtocol, PyContext, PyFuncArgs, PyResult};
use super::vm::VirtualMachine;
use super::super::pyobject::{AttributeProtocol, PyContext, PyFuncArgs, PyResult};
use super::super::vm::VirtualMachine;
pub fn init(context: &PyContext) {
let ref function_type = context.function_type;
+1 -1
View File
@@ -1,8 +1,8 @@
use super::super::objsequence::PySliceableSequence;
use super::super::pyobject::{
AttributeProtocol, PyContext, PyFuncArgs, PyObjectKind, PyObjectRef, PyResult, TypeProtocol,
};
use super::super::vm::VirtualMachine;
use super::objsequence::PySliceableSequence;
use super::objstr;
use super::objtype;
@@ -1,10 +1,10 @@
use super::obj::objdict;
use super::obj::objtype;
use super::pyobject::{
use super::super::pyobject::{
AttributeProtocol, IdProtocol, PyContext, PyFuncArgs, PyObject, PyObjectKind, PyObjectRef,
PyResult, TypeProtocol,
};
use super::vm::VirtualMachine;
use super::super::vm::VirtualMachine;
use super::objdict;
use super::objtype;
pub fn new_instance(vm: &mut VirtualMachine, mut args: PyFuncArgs) -> PyResult {
// more or less __new__ operator
@@ -1,5 +1,5 @@
use super::pyobject::{PyObject, PyObjectKind, PyObjectRef, PyResult};
use super::vm::VirtualMachine;
use super::super::pyobject::{PyObject, PyObjectKind, PyObjectRef, PyResult};
use super::super::vm::VirtualMachine;
use std::marker::Sized;
pub trait PySliceableSequence {
+1 -1
View File
@@ -1,9 +1,9 @@
use super::super::objsequence::PySliceableSequence;
use super::super::pyobject::{
AttributeProtocol, PyContext, PyFuncArgs, PyObjectKind, PyObjectRef, PyResult, TypeProtocol,
};
use super::super::vm::VirtualMachine;
use super::objint;
use super::objsequence::PySliceableSequence;
use super::objtype;
pub fn init(context: &PyContext) {
+2 -2
View File
@@ -3,13 +3,13 @@ use super::exceptions;
use super::obj::objbytes;
use super::obj::objdict;
use super::obj::objfloat;
use super::obj::objfunction;
use super::obj::objint;
use super::obj::objlist;
use super::obj::objobject;
use super::obj::objstr;
use super::obj::objtype;
use super::objbool;
use super::objfunction;
use super::objobject;
use super::vm::VirtualMachine;
use std::cell::RefCell;
use std::cmp::Ordering;
+2 -2
View File
@@ -6,13 +6,13 @@ use serde::de::Visitor;
use serde::ser::{SerializeMap, SerializeSeq};
use serde_json;
use super::super::obj::{objdict, objfloat, objint, objlist, objstr, objtype};
use super::super::obj::{objdict, objfloat, objint, objlist, objsequence, objstr, objtype};
use super::super::objbool;
use super::super::pyobject::{
DictProtocol, PyContext, PyFuncArgs, PyObject, PyObjectKind, PyObjectRef, PyResult,
TypeProtocol,
};
use super::super::VirtualMachine;
use super::super::{objbool, objsequence};
// We need to have a VM available to serialise a PyObject based on its subclass, so we implement
// PyObject serialisation via a proxy object which holds a reference to a VM
+2 -2
View File
@@ -16,10 +16,10 @@ use super::bytecode;
use super::frame::{copy_code, Block, Frame};
use super::import::import;
use super::obj::objlist;
use super::obj::objobject;
use super::obj::objstr;
use super::obj::objtype;
use super::objbool;
use super::objobject;
use super::pyobject::{
AttributeProtocol, DictProtocol, IdProtocol, ParentProtocol, PyContext, PyFuncArgs, PyObject,
PyObjectKind, PyObjectRef, PyResult, ToRust,
@@ -296,7 +296,7 @@ impl VirtualMachine {
match &a2.kind {
PyObjectKind::String { ref value } => objstr::subscript(self, value, b),
PyObjectKind::List { ref elements } | PyObjectKind::Tuple { ref elements } => {
super::objsequence::get_item(self, &a, elements, b)
super::obj::objsequence::get_item(self, &a, elements, b)
}
_ => Err(self.new_type_error(format!(
"TypeError: indexing type {:?} with index {:?} is not supported (yet?)",