Skip to content

Commit fa9e48a

Browse files
Take &mut VirtualMachine insteadof &PyContext
1 parent 737ec12 commit fa9e48a

33 files changed

+112
-111
lines changed

vm/src/frame.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ pub struct Frame {
184184
}
185185

186186
impl PyValue for Frame {
187-
fn class(ctx: &PyContext) -> PyObjectRef {
188-
ctx.frame_type()
187+
fn class(vm: &mut VirtualMachine) -> PyObjectRef {
188+
vm.ctx.frame_type()
189189
}
190190
}
191191

vm/src/obj/objbool.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use super::objtuple::PyTuple;
1212
use super::objtype;
1313

1414
impl IntoPyObject for bool {
15-
fn into_pyobject(self, ctx: &PyContext) -> PyResult {
16-
Ok(ctx.new_bool(self))
15+
fn into_pyobject(self, vm: &mut VirtualMachine) -> PyResult {
16+
Ok(vm.ctx.new_bool(self))
1717
}
1818
}
1919

vm/src/obj/objbuiltinfunc.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
use std::fmt;
22

3-
use crate::pyobject::{PyContext, PyNativeFunc, PyObjectRef, PyValue};
3+
use crate::pyobject::{PyNativeFunc, PyObjectRef, PyValue};
4+
use crate::vm::VirtualMachine;
45

56
pub struct PyBuiltinFunction {
67
// TODO: shouldn't be public
78
pub value: PyNativeFunc,
89
}
910

1011
impl PyValue for PyBuiltinFunction {
11-
fn class(ctx: &PyContext) -> PyObjectRef {
12-
ctx.builtin_function_or_method_type()
12+
fn class(vm: &mut VirtualMachine) -> PyObjectRef {
13+
vm.ctx.builtin_function_or_method_type()
1314
}
1415
}
1516

vm/src/obj/objbytearray.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ impl PyByteArray {
2929
}
3030

3131
impl PyValue for PyByteArray {
32-
fn class(ctx: &PyContext) -> PyObjectRef {
33-
ctx.bytearray_type()
32+
fn class(vm: &mut VirtualMachine) -> PyObjectRef {
33+
vm.ctx.bytearray_type()
3434
}
3535
}
3636

vm/src/obj/objbytes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ impl Deref for PyBytes {
3030
}
3131

3232
impl PyValue for PyBytes {
33-
fn class(ctx: &PyContext) -> PyObjectRef {
34-
ctx.bytes_type()
33+
fn class(vm: &mut VirtualMachine) -> PyObjectRef {
34+
vm.ctx.bytes_type()
3535
}
3636
}
3737

vm/src/obj/objcode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ impl fmt::Debug for PyCode {
2626
}
2727

2828
impl PyValue for PyCode {
29-
fn class(ctx: &PyContext) -> PyObjectRef {
30-
ctx.code_type()
29+
fn class(vm: &mut VirtualMachine) -> PyObjectRef {
30+
vm.ctx.code_type()
3131
}
3232
}
3333

vm/src/obj/objcomplex.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ pub struct PyComplex {
1414
}
1515

1616
impl PyValue for PyComplex {
17-
fn class(ctx: &PyContext) -> PyObjectRef {
18-
ctx.complex_type()
17+
fn class(vm: &mut VirtualMachine) -> PyObjectRef {
18+
vm.ctx.complex_type()
1919
}
2020
}
2121

vm/src/obj/objdict.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ impl fmt::Debug for PyDict {
3030
}
3131

3232
impl PyValue for PyDict {
33-
fn class(ctx: &PyContext) -> PyObjectRef {
34-
ctx.dict_type()
33+
fn class(vm: &mut VirtualMachine) -> PyObjectRef {
34+
vm.ctx.dict_type()
3535
}
3636
}
3737

vm/src/obj/objenumerate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ pub struct PyEnumerate {
1717
}
1818

1919
impl PyValue for PyEnumerate {
20-
fn class(ctx: &PyContext) -> PyObjectRef {
21-
ctx.enumerate_type()
20+
fn class(vm: &mut VirtualMachine) -> PyObjectRef {
21+
vm.ctx.enumerate_type()
2222
}
2323
}
2424

vm/src/obj/objfilter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ pub struct PyFilter {
1313
}
1414

1515
impl PyValue for PyFilter {
16-
fn class(ctx: &PyContext) -> PyObjectRef {
17-
ctx.filter_type()
16+
fn class(vm: &mut VirtualMachine) -> PyObjectRef {
17+
vm.ctx.filter_type()
1818
}
1919
}
2020

0 commit comments

Comments
 (0)