mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Remove public field from PyBuiltinFunction
This commit is contained in:
@@ -6,8 +6,7 @@ use crate::pyobject::PyValue;
|
||||
use crate::vm::VirtualMachine;
|
||||
|
||||
pub struct PyBuiltinFunction {
|
||||
// TODO: shouldn't be public
|
||||
pub value: PyNativeFunc,
|
||||
value: PyNativeFunc,
|
||||
}
|
||||
|
||||
impl PyValue for PyBuiltinFunction {
|
||||
@@ -26,4 +25,8 @@ impl PyBuiltinFunction {
|
||||
pub fn new(value: PyNativeFunc) -> Self {
|
||||
Self { value }
|
||||
}
|
||||
|
||||
pub fn as_func(&self) -> &PyNativeFunc {
|
||||
&self.value
|
||||
}
|
||||
}
|
||||
|
||||
@@ -673,8 +673,8 @@ impl VirtualMachine {
|
||||
args
|
||||
};
|
||||
self.invoke(&function, args)
|
||||
} else if let Some(PyBuiltinFunction { ref value }) = func_ref.payload() {
|
||||
value(self, args)
|
||||
} else if let Some(builtin_func) = func_ref.payload::<PyBuiltinFunction>() {
|
||||
builtin_func.as_func()(self, args)
|
||||
} else if self.is_callable(&func_ref) {
|
||||
self.call_method(&func_ref, "__call__", args)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user