mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-22 04:20:17 +00:00
got rid of stack function
This commit is contained in:
parent
6bc1749b5c
commit
1fc08dae62
15
src/vm.h
15
src/vm.h
@ -102,7 +102,7 @@ public:
|
|||||||
// for quick access
|
// for quick access
|
||||||
Type tp_object, tp_type, tp_int, tp_float, tp_bool, tp_str;
|
Type tp_object, tp_type, tp_int, tp_float, tp_bool, tp_str;
|
||||||
Type tp_list, tp_tuple;
|
Type tp_list, tp_tuple;
|
||||||
Type tp_function, tp_stack_func, tp_native_func, tp_iterator, tp_bound_method;
|
Type tp_function, tp_native_func, tp_iterator, tp_bound_method;
|
||||||
Type tp_slice, tp_range, tp_module;
|
Type tp_slice, tp_range, tp_module;
|
||||||
Type tp_super, tp_exception, tp_bytes, tp_mappingproxy;
|
Type tp_super, tp_exception, tp_bytes, tp_mappingproxy;
|
||||||
|
|
||||||
@ -427,7 +427,6 @@ DEF_NATIVE_2(List, tp_list)
|
|||||||
DEF_NATIVE_2(Tuple, tp_tuple)
|
DEF_NATIVE_2(Tuple, tp_tuple)
|
||||||
DEF_NATIVE_2(Function, tp_function)
|
DEF_NATIVE_2(Function, tp_function)
|
||||||
DEF_NATIVE_2(NativeFunc, tp_native_func)
|
DEF_NATIVE_2(NativeFunc, tp_native_func)
|
||||||
DEF_NATIVE_2(StackFunc, tp_stack_func)
|
|
||||||
DEF_NATIVE_2(BoundMethod, tp_bound_method)
|
DEF_NATIVE_2(BoundMethod, tp_bound_method)
|
||||||
DEF_NATIVE_2(Range, tp_range)
|
DEF_NATIVE_2(Range, tp_range)
|
||||||
DEF_NATIVE_2(Slice, tp_slice)
|
DEF_NATIVE_2(Slice, tp_slice)
|
||||||
@ -863,7 +862,6 @@ inline void VM::init_builtin_types(){
|
|||||||
tp_module = _new_type_object("module");
|
tp_module = _new_type_object("module");
|
||||||
tp_function = _new_type_object("function");
|
tp_function = _new_type_object("function");
|
||||||
tp_native_func = _new_type_object("native_func");
|
tp_native_func = _new_type_object("native_func");
|
||||||
tp_stack_func = _new_type_object("stack_func");
|
|
||||||
tp_iterator = _new_type_object("iterator");
|
tp_iterator = _new_type_object("iterator");
|
||||||
tp_bound_method = _new_type_object("bound_method");
|
tp_bound_method = _new_type_object("bound_method");
|
||||||
tp_super = _new_type_object("super");
|
tp_super = _new_type_object("super");
|
||||||
@ -931,17 +929,6 @@ inline PyObject* VM::vectorcall(int ARGC, int KWARGC, bool op_call){
|
|||||||
// [unbound, self, args..., kwargs...]
|
// [unbound, self, args..., kwargs...]
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_non_tagged_type(callable, tp_stack_func)) {
|
|
||||||
const auto& f = OBJ_GET(StackFunc, callable);
|
|
||||||
if(ARGC != 0) TypeError("stack_func does not track argument counts ");
|
|
||||||
if(KWARGC != 0) TypeError("stack_func does not accept keyword arguments");
|
|
||||||
f(this);
|
|
||||||
PyObject* ret = s_data.top();
|
|
||||||
s_data.reset(p0);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ArgsView args(p1 - ARGC - int(method_call), p1);
|
ArgsView args(p1 - ARGC - int(method_call), p1);
|
||||||
|
|
||||||
if(is_non_tagged_type(callable, tp_native_func)){
|
if(is_non_tagged_type(callable, tp_native_func)){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user