Skip to content

Commit 45bc8c8

Browse files
Move PyRef to pyobject module
1 parent 8143adc commit 45bc8c8

15 files changed

+135
-155
lines changed

vm/src/function.rs

Lines changed: 0 additions & 118 deletions
This file was deleted.

vm/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ pub mod eval;
4141
mod exceptions;
4242
pub mod format;
4343
pub mod frame;
44-
pub mod function;
4544
pub mod import;
4645
pub mod obj;
4746
pub mod pyobject;

vm/src/obj/objdict.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
use crate::function::PyRef;
21
use std::cell::{Cell, RefCell};
32
use std::collections::HashMap;
43
use std::ops::{Deref, DerefMut};
54

6-
use super::objiter;
7-
use super::objstr;
8-
use super::objtype;
95
use crate::pyobject::{
106
PyAttributes, PyContext, PyFuncArgs, PyIteratorValue, PyObject, PyObjectPayload,
11-
PyObjectPayload2, PyObjectRef, PyResult, TypeProtocol,
7+
PyObjectPayload2, PyObjectRef, PyRef, PyResult, TypeProtocol,
128
};
139
use crate::vm::{ReprGuard, VirtualMachine};
1410

11+
use super::objiter;
12+
use super::objstr;
13+
use super::objtype;
14+
1515
pub type DictContentType = HashMap<String, (PyObjectRef, PyObjectRef)>;
1616

1717
#[derive(Default, Debug)]

vm/src/obj/objfloat.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ use super::objbytes;
22
use super::objint;
33
use super::objstr;
44
use super::objtype;
5-
use crate::function::PyRef;
65
use crate::pyobject::{
7-
IntoPyObject, PyContext, PyObject, PyObjectPayload, PyObjectPayload2, PyObjectRef, PyResult,
8-
TypeProtocol,
6+
IntoPyObject, PyContext, PyObject, PyObjectPayload, PyObjectPayload2, PyObjectRef, PyRef,
7+
PyResult, TypeProtocol,
98
};
109
use crate::vm::VirtualMachine;
1110
use num_bigint::ToBigInt;

vm/src/obj/objint.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ use num_integer::Integer;
55
use num_traits::{Pow, Signed, ToPrimitive, Zero};
66

77
use crate::format::FormatSpec;
8-
use crate::function::PyRef;
98
use crate::pyobject::{
109
FromPyObjectRef, IntoPyObject, PyContext, PyFuncArgs, PyObject, PyObjectPayload,
11-
PyObjectPayload2, PyObjectRef, PyResult, TryFromObject, TypeProtocol,
10+
PyObjectPayload2, PyObjectRef, PyRef, PyResult, TryFromObject, TypeProtocol,
1211
};
1312
use crate::vm::VirtualMachine;
1413

vm/src/obj/objlist.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ use super::objsequence::{
88
};
99
use super::objstr;
1010
use super::objtype;
11-
use crate::function::PyRef;
1211
use crate::pyobject::{
1312
IdProtocol, OptionalArg, PyContext, PyFuncArgs, PyIteratorValue, PyObject, PyObjectPayload,
14-
PyObjectPayload2, PyObjectRef, PyResult, TypeProtocol,
13+
PyObjectPayload2, PyObjectRef, PyRef, PyResult, TypeProtocol,
1514
};
1615
use crate::vm::{ReprGuard, VirtualMachine};
1716
use num_traits::ToPrimitive;

vm/src/obj/objmodule.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use crate::function::PyRef;
2-
use crate::pyobject::{DictProtocol, PyContext, PyObjectPayload2, PyObjectRef, PyResult};
1+
use crate::pyobject::{DictProtocol, PyContext, PyObjectPayload2, PyObjectRef, PyRef, PyResult};
32
use crate::vm::VirtualMachine;
43

54
#[derive(Clone, Debug)]

vm/src/obj/objnone.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use crate::function::PyRef;
21
use crate::pyobject::{
3-
IntoPyObject, PyContext, PyFuncArgs, PyObjectPayload2, PyObjectRef, PyResult, TypeProtocol,
2+
IntoPyObject, PyContext, PyFuncArgs, PyObjectPayload2, PyObjectRef, PyRef, PyResult,
3+
TypeProtocol,
44
};
55
use crate::vm::VirtualMachine;
66

vm/src/obj/objobject.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
use super::objstr;
22
use super::objtype;
3-
use crate::function::PyRef;
43
use crate::obj::objproperty::PropertyBuilder;
54
use crate::pyobject::{
65
AttributeProtocol, DictProtocol, IdProtocol, PyAttributes, PyContext, PyFuncArgs, PyObject,
7-
PyObjectPayload, PyObjectRef, PyResult, TypeProtocol,
6+
PyObjectPayload, PyObjectRef, PyRef, PyResult, TypeProtocol,
87
};
98
use crate::vm::VirtualMachine;
109
use std::cell::RefCell;
1110
use std::collections::HashMap;
1211

1312
#[derive(Clone, Debug)]
1413
pub struct PyInstance;
14+
1515
pub type PyInstanceRef = PyRef<PyInstance>;
1616

1717
pub fn new_instance(vm: &mut VirtualMachine, mut args: PyFuncArgs) -> PyResult {

vm/src/obj/objproperty.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
33
*/
44

5-
use crate::function::PyRef;
5+
use std::marker::PhantomData;
6+
67
use crate::obj::objstr::PyStringRef;
78
use crate::obj::objtype::PyClassRef;
8-
use crate::pyobject::IntoPyNativeFunc;
99
use crate::pyobject::{
10-
OptionalArg, PyContext, PyObject, PyObjectPayload, PyObjectPayload2, PyObjectRef, PyResult,
10+
IntoPyNativeFunc, OptionalArg, PyContext, PyObject, PyObjectPayload, PyObjectPayload2,
11+
PyObjectRef, PyRef, PyResult,
1112
};
1213
use crate::VirtualMachine;
13-
use std::marker::PhantomData;
1414

1515
/// Read-only property, doesn't have __set__ or __delete__
1616
#[derive(Debug)]

vm/src/obj/objstr.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ use num_traits::ToPrimitive;
66
use unicode_segmentation::UnicodeSegmentation;
77

88
use crate::format::{FormatParseError, FormatPart, FormatString};
9-
use crate::function::PyRef;
109
use crate::pyobject::{
1110
IntoPyObject, OptionalArg, PyContext, PyFuncArgs, PyIterable, PyObjectPayload2, PyObjectRef,
12-
PyResult, TypeProtocol,
11+
PyRef, PyResult, TypeProtocol,
1312
};
1413
use crate::vm::VirtualMachine;
1514

vm/src/obj/objtuple.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
use std::cell::{Cell, RefCell};
22
use std::hash::{Hash, Hasher};
33

4-
use crate::function::PyRef;
54
use crate::pyobject::{
65
IdProtocol, OptionalArg, PyContext, PyIteratorValue, PyObject, PyObjectPayload,
7-
PyObjectPayload2, PyObjectRef, PyResult,
6+
PyObjectPayload2, PyObjectRef, PyRef, PyResult,
87
};
98
use crate::vm::{ReprGuard, VirtualMachine};
109

vm/src/obj/objtype.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
use super::objdict;
2-
use super::objstr;
3-
use crate::function::PyRef;
1+
use std::cell::RefCell;
2+
use std::collections::HashMap;
3+
44
use crate::pyobject::{
55
AttributeProtocol, IdProtocol, PyAttributes, PyContext, PyFuncArgs, PyObject, PyObjectPayload,
6-
PyObjectPayload2, PyObjectRef, PyResult, TypeProtocol,
6+
PyObjectPayload2, PyObjectRef, PyRef, PyResult, TypeProtocol,
77
};
88
use crate::vm::VirtualMachine;
9-
use std::cell::RefCell;
10-
use std::collections::HashMap;
9+
10+
use super::objdict;
11+
use super::objstr;
1112

1213
#[derive(Clone, Debug)]
1314
pub struct PyClass {
1415
pub name: String,
1516
pub mro: Vec<PyObjectRef>,
1617
}
18+
1719
pub type PyClassRef = PyRef<PyClass>;
1820

1921
impl PyObjectPayload2 for PyClass {

vm/src/obj/objweakref.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
use crate::function::PyRef;
21
use crate::obj::objtype::PyClassRef;
32
use crate::pyobject::PyObjectPayload2;
4-
use crate::pyobject::{PyContext, PyObject, PyObjectRef, PyResult};
3+
use crate::pyobject::{PyContext, PyObject, PyObjectRef, PyRef, PyResult};
54
use crate::vm::VirtualMachine;
65

76
use std::rc::{Rc, Weak};

0 commit comments

Comments
 (0)