add some final kw

This commit is contained in:
blueloveTH 2023-04-14 21:24:48 +08:00
parent c7ec20a11e
commit 83b059b24f
3 changed files with 6 additions and 6 deletions

View File

@ -4,7 +4,7 @@
namespace pkpy{ namespace pkpy{
class RangeIter : public BaseIter { class RangeIter final: public BaseIter {
i64 current; i64 current;
Range r; // copy by value, so we don't need to keep ref Range r; // copy by value, so we don't need to keep ref
public: public:
@ -25,7 +25,7 @@ public:
}; };
template <typename T> template <typename T>
class ArrayIter : public BaseIter { class ArrayIter final: public BaseIter {
PyObject* ref; PyObject* ref;
int index; int index;
public: public:
@ -42,7 +42,7 @@ public:
} }
}; };
class StringIter : public BaseIter { class StringIter final: public BaseIter {
PyObject* ref; PyObject* ref;
int index; int index;
public: public:

View File

@ -88,7 +88,7 @@ struct GCHeader {
GCHeader() : enabled(true), marked(false) {} GCHeader() : enabled(true), marked(false) {}
}; };
struct PyObject { struct PyObject{
GCHeader gc; GCHeader gc;
Type type; Type type;
NameDict* _attr; NameDict* _attr;
@ -111,7 +111,7 @@ template<typename T>
void gc_mark(T& t); void gc_mark(T& t);
template <typename T> template <typename T>
struct Py_ : PyObject { struct Py_ final: PyObject {
T _value; T _value;
Py_(Type type, const T& val): PyObject(type), _value(val) { _init(); } Py_(Type type, const T& val): PyObject(type), _value(val) { _init(); }

View File

@ -32,7 +32,7 @@ Str _read_file_cwd(const Str& name, bool* ok);
inline PyObject* py_var(VM* vm, ctype&& value) { return vm->heap.gcnew(vm->ptype, std::move(value));} inline PyObject* py_var(VM* vm, ctype&& value) { return vm->heap.gcnew(vm->ptype, std::move(value));}
class Generator: public BaseIter { class Generator final: public BaseIter {
Frame frame; Frame frame;
int state; // 0,1,2 int state; // 0,1,2
public: public: