Skip to content

Commit

Permalink
Don’t need to initialize VMClass fields a second time, already done b…
Browse files Browse the repository at this point in the history
…y VMObject

Signed-off-by: Stefan Marr <[email protected]>
  • Loading branch information
smarr committed Aug 16, 2024
1 parent 200eef7 commit ebe195a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/vmobjects/VMClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@

const size_t VMClass::VMClassNumberOfFields = 4;

VMClass::VMClass()
: VMObject(VMClassNumberOfFields, sizeof(VMClass)), name(nullptr),
instanceFields(nullptr), instanceInvokables(nullptr),
superClass(nullptr) {}
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
VMClass::VMClass() : VMObject(VMClassNumberOfFields, sizeof(VMClass)) {}

VMClass* VMClass::CloneForMovingGC() const {
auto* clone =
Expand All @@ -60,6 +58,7 @@ VMClass* VMClass::CloneForMovingGC() const {
return clone;
}

// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
VMClass::VMClass(size_t numberOfFields, size_t additionalBytes)
: VMObject(numberOfFields + VMClassNumberOfFields,
additionalBytes + sizeof(VMClass)) {}
Expand Down
1 change: 1 addition & 0 deletions src/vmobjects/VMClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class VMClass : public VMObject {
make_testable(public);

// Remember to update Parser::superclass when the fields are changed
// Theses are treated like VMObject fields and initialized that way
GCSymbol* name;
GCArray* instanceFields;
GCArray* instanceInvokables;
Expand Down

0 comments on commit ebe195a

Please sign in to comment.