blueloveTH преди 1 година
родител
ревизия
9bfe8c1bad
променени са 2 файла, в които са добавени 5 реда и са изтрити 5 реда
  1. 3 3
      include/pocketpy/frame.h
  2. 2 2
      src/frame.cpp

+ 3 - 3
include/pocketpy/frame.h

@@ -11,15 +11,15 @@ namespace pkpy{
 // weak reference fast locals
 struct FastLocals{
     // this is a weak reference
-    const NameDictInt* varnames_inv;
+    const CodeObject* co;
     PyObject** a;
 
-    int size() const{ return varnames_inv->size();}
+    int size() const{ return co->varnames.size();}
 
     PyObject*& operator[](int i){ return a[i]; }
     PyObject* operator[](int i) const { return a[i]; }
 
-    FastLocals(const CodeObject* co, PyObject** a): varnames_inv(&co->varnames_inv), a(a) {}
+    FastLocals(const CodeObject* co, PyObject** a): co(co), a(a) {}
 
     PyObject** try_get_name(StrName name);
     NameDict_ to_namedict();

+ 2 - 2
src/frame.cpp

@@ -2,14 +2,14 @@
 
 namespace pkpy{
     PyObject** FastLocals::try_get_name(StrName name){
-        int index = varnames_inv->try_get(name);
+        int index = co->varnames_inv.try_get(name);
         if(index == -1) return nullptr;
         return &a[index];
     }
 
     NameDict_ FastLocals::to_namedict(){
         NameDict_ dict = std::make_shared<NameDict>();
-        varnames_inv->apply([&](StrName name, int index){
+        co->varnames_inv.apply([&](StrName name, int index){
             PyObject* value = a[index];
             if(value != PY_NULL) dict->set(name, value);
         });