Commit 516b6544 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Shore up sys.flags

parent f3ead53e
...@@ -84,18 +84,23 @@ void prependToSysPath(const std::string& path) { ...@@ -84,18 +84,23 @@ void prependToSysPath(const std::string& path) {
static BoxedClass* sys_flags_cls; static BoxedClass* sys_flags_cls;
class BoxedSysFlags : public Box { class BoxedSysFlags : public Box {
public: public:
Box* division_warning, *bytes_warning; Box* division_warning, *bytes_warning, *no_user_site;
BoxedSysFlags() : Box(sys_flags_cls) { BoxedSysFlags() : Box(sys_flags_cls) {
auto zero = boxInt(0); auto zero = boxInt(0);
division_warning = zero; division_warning = zero;
bytes_warning = zero; bytes_warning = zero;
no_user_site = zero;
} }
static void gcHandler(GCVisitor* v, Box* b) { static void gcHandler(GCVisitor* v, Box* _b) {
assert(b->cls == sys_flags_cls); assert(_b->cls == sys_flags_cls);
boxGCHandler(v, _b);
boxGCHandler(v, b); BoxedSysFlags* self = static_cast<BoxedSysFlags*>(_b);
v->visit(self->division_warning);
v->visit(self->bytes_warning);
v->visit(self->no_user_site);
} }
static Box* __new__(Box* cls, Box* args, Box* kwargs) { static Box* __new__(Box* cls, Box* args, Box* kwargs) {
...@@ -164,6 +169,7 @@ void setupSys() { ...@@ -164,6 +169,7 @@ void setupSys() {
new BoxedMemberDescriptor(BoxedMemberDescriptor::OBJECT, offsetof(BoxedSysFlags, name))) new BoxedMemberDescriptor(BoxedMemberDescriptor::OBJECT, offsetof(BoxedSysFlags, name)))
ADD(division_warning); ADD(division_warning);
ADD(bytes_warning); ADD(bytes_warning);
ADD(no_user_site);
#undef ADD #undef ADD
sys_flags_cls->freeze(); sys_flags_cls->freeze();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment