Skip to content

Commit 40cf7f4

Browse files
committed
Move more objects to obj folder
1 parent 5cdd0ab commit 40cf7f4

File tree

10 files changed

+19
-19
lines changed

10 files changed

+19
-19
lines changed

vm/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ mod frame;
2222
mod import;
2323
mod obj;
2424
mod objbool;
25-
mod objfunction;
26-
mod objobject;
27-
mod objsequence;
2825
pub mod pyobject;
2926
pub mod stdlib;
3027
mod sysmodule;

vm/src/obj/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
pub mod objbytes;
22
pub mod objdict;
33
pub mod objfloat;
4+
pub mod objfunction;
45
pub mod objint;
56
pub mod objlist;
7+
pub mod objobject;
8+
pub mod objsequence;
69
pub mod objstr;
710
pub mod objtype;

vm/src/objfunction.rs renamed to vm/src/obj/objfunction.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use super::pyobject::{AttributeProtocol, PyContext, PyFuncArgs, PyResult};
2-
use super::vm::VirtualMachine;
1+
use super::super::pyobject::{AttributeProtocol, PyContext, PyFuncArgs, PyResult};
2+
use super::super::vm::VirtualMachine;
33

44
pub fn init(context: &PyContext) {
55
let ref function_type = context.function_type;

vm/src/obj/objlist.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use super::super::objsequence::PySliceableSequence;
21
use super::super::pyobject::{
32
AttributeProtocol, PyContext, PyFuncArgs, PyObjectKind, PyObjectRef, PyResult, TypeProtocol,
43
};
54
use super::super::vm::VirtualMachine;
5+
use super::objsequence::PySliceableSequence;
66
use super::objstr;
77
use super::objtype;
88

vm/src/objobject.rs renamed to vm/src/obj/objobject.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
use super::obj::objdict;
2-
use super::obj::objtype;
3-
use super::pyobject::{
1+
use super::super::pyobject::{
42
AttributeProtocol, IdProtocol, PyContext, PyFuncArgs, PyObject, PyObjectKind, PyObjectRef,
53
PyResult, TypeProtocol,
64
};
7-
use super::vm::VirtualMachine;
5+
use super::super::vm::VirtualMachine;
6+
use super::objdict;
7+
use super::objtype;
88

99
pub fn new_instance(vm: &mut VirtualMachine, mut args: PyFuncArgs) -> PyResult {
1010
// more or less __new__ operator

vm/src/objsequence.rs renamed to vm/src/obj/objsequence.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use super::pyobject::{PyObject, PyObjectKind, PyObjectRef, PyResult};
2-
use super::vm::VirtualMachine;
1+
use super::super::pyobject::{PyObject, PyObjectKind, PyObjectRef, PyResult};
2+
use super::super::vm::VirtualMachine;
33
use std::marker::Sized;
44

55
pub trait PySliceableSequence {

vm/src/obj/objstr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use super::super::objsequence::PySliceableSequence;
21
use super::super::pyobject::{
32
AttributeProtocol, PyContext, PyFuncArgs, PyObjectKind, PyObjectRef, PyResult, TypeProtocol,
43
};
54
use super::super::vm::VirtualMachine;
65
use super::objint;
6+
use super::objsequence::PySliceableSequence;
77
use super::objtype;
88

99
pub fn init(context: &PyContext) {

vm/src/pyobject.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ use super::exceptions;
33
use super::obj::objbytes;
44
use super::obj::objdict;
55
use super::obj::objfloat;
6+
use super::obj::objfunction;
67
use super::obj::objint;
78
use super::obj::objlist;
9+
use super::obj::objobject;
810
use super::obj::objstr;
911
use super::obj::objtype;
1012
use super::objbool;
11-
use super::objfunction;
12-
use super::objobject;
1313
use super::vm::VirtualMachine;
1414
use std::cell::RefCell;
1515
use std::cmp::Ordering;

vm/src/stdlib/json.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ use serde::de::Visitor;
66
use serde::ser::{SerializeMap, SerializeSeq};
77
use serde_json;
88

9-
use super::super::obj::{objdict, objfloat, objint, objlist, objstr, objtype};
9+
use super::super::obj::{objdict, objfloat, objint, objlist, objsequence, objstr, objtype};
10+
use super::super::objbool;
1011
use super::super::pyobject::{
1112
DictProtocol, PyContext, PyFuncArgs, PyObject, PyObjectKind, PyObjectRef, PyResult,
1213
TypeProtocol,
1314
};
1415
use super::super::VirtualMachine;
15-
use super::super::{objbool, objsequence};
1616

1717
// We need to have a VM available to serialise a PyObject based on its subclass, so we implement
1818
// PyObject serialisation via a proxy object which holds a reference to a VM

vm/src/vm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ use super::bytecode;
1616
use super::frame::{copy_code, Block, Frame};
1717
use super::import::import;
1818
use super::obj::objlist;
19+
use super::obj::objobject;
1920
use super::obj::objstr;
2021
use super::obj::objtype;
2122
use super::objbool;
22-
use super::objobject;
2323
use super::pyobject::{
2424
AttributeProtocol, DictProtocol, IdProtocol, ParentProtocol, PyContext, PyFuncArgs, PyObject,
2525
PyObjectKind, PyObjectRef, PyResult, ToRust,
@@ -296,7 +296,7 @@ impl VirtualMachine {
296296
match &a2.kind {
297297
PyObjectKind::String { ref value } => objstr::subscript(self, value, b),
298298
PyObjectKind::List { ref elements } | PyObjectKind::Tuple { ref elements } => {
299-
super::objsequence::get_item(self, &a, elements, b)
299+
super::obj::objsequence::get_item(self, &a, elements, b)
300300
}
301301
_ => Err(self.new_type_error(format!(
302302
"TypeError: indexing type {:?} with index {:?} is not supported (yet?)",

0 commit comments

Comments
 (0)