mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-21 20:10:17 +00:00
add some final
kw
This commit is contained in:
parent
c7ec20a11e
commit
83b059b24f
@ -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:
|
||||||
|
@ -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(); }
|
||||||
|
2
src/vm.h
2
src/vm.h
@ -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:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user