From 83b059b24ff98b7bc8c334e9637ba10df110b0a3 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Fri, 14 Apr 2023 21:24:48 +0800 Subject: [PATCH] add some `final` kw --- src/iter.h | 6 +++--- src/obj.h | 4 ++-- src/vm.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/iter.h b/src/iter.h index 975ab441..f85a05ea 100644 --- a/src/iter.h +++ b/src/iter.h @@ -4,7 +4,7 @@ namespace pkpy{ -class RangeIter : public BaseIter { +class RangeIter final: public BaseIter { i64 current; Range r; // copy by value, so we don't need to keep ref public: @@ -25,7 +25,7 @@ public: }; template -class ArrayIter : public BaseIter { +class ArrayIter final: public BaseIter { PyObject* ref; int index; public: @@ -42,7 +42,7 @@ public: } }; -class StringIter : public BaseIter { +class StringIter final: public BaseIter { PyObject* ref; int index; public: diff --git a/src/obj.h b/src/obj.h index 4d41c4fe..0263cbcb 100644 --- a/src/obj.h +++ b/src/obj.h @@ -88,7 +88,7 @@ struct GCHeader { GCHeader() : enabled(true), marked(false) {} }; -struct PyObject { +struct PyObject{ GCHeader gc; Type type; NameDict* _attr; @@ -111,7 +111,7 @@ template void gc_mark(T& t); template -struct Py_ : PyObject { +struct Py_ final: PyObject { T _value; Py_(Type type, const T& val): PyObject(type), _value(val) { _init(); } diff --git a/src/vm.h b/src/vm.h index 16c42bec..7c1ae60d 100644 --- a/src/vm.h +++ b/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));} -class Generator: public BaseIter { +class Generator final: public BaseIter { Frame frame; int state; // 0,1,2 public: