blueloveTH 1 rok temu
rodzic
commit
9fbaca3b13
3 zmienionych plików z 4 dodań i 8 usunięć
  1. 0 5
      include/pocketpy/pocketpy.h
  2. 4 1
      src/interpreter/ceval.c
  3. 0 2
      src/public/internal.c

+ 0 - 5
include/pocketpy/pocketpy.h

@@ -339,11 +339,6 @@ bool py_isidentical(py_Ref, py_Ref);
 /// The result will be set to `py_retval()`.
 /// The stack remains unchanged after the operation.
 bool py_call(py_Ref f, int argc, py_Ref argv) PY_RAISE;
-/// Call a non-magic method.
-/// It prepares the stack and then performs a `vectorcall(argc+1, 0, false)`.
-/// The result will be set to `py_retval()`.
-/// The stack remains unchanged after the operation.
-bool py_callmethod(py_Ref self, py_Name name, int argc, py_Ref argv) PY_RAISE;
 
 bool py_str(py_Ref val) PY_RAISE;
 bool py_repr(py_Ref val) PY_RAISE;

+ 4 - 1
src/interpreter/ceval.c

@@ -476,7 +476,10 @@ FrameResult VM__run_top_frame(VM* self) {
                 py_push(py_retval());  // empty set
                 py_Name id_add = py_name("add");
                 for(int i = 0; i < byte.arg; i++) {
-                    if(!py_callmethod(TOP(), id_add, 1, begin + i)) goto __ERROR;
+                    py_push(TOP());
+                    py_pushmethod(id_add);
+                    py_push(begin + i);
+                    if(!py_vectorcall(1, 0)) goto __ERROR;
                 }
                 py_TValue tmp = *TOP();
                 SP() = begin;

+ 0 - 2
src/public/internal.c

@@ -115,8 +115,6 @@ bool py_call(py_Ref f, int argc, py_Ref argv) {
     }
 }
 
-bool py_callmethod(py_Ref self, py_Name name, int argc, py_Ref argv) { return -1; }
-
 bool py_vectorcall(uint16_t argc, uint16_t kwargc) {
     VM* vm = pk_current_vm;
     return VM__vectorcall(vm, argc, kwargc, false) != RES_ERROR;