Skip to content

Commit

Permalink
Refactor initClass method
Browse files Browse the repository at this point in the history
  • Loading branch information
elct9620 committed Feb 3, 2024
1 parent ad3d8c1 commit b47a1c4
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions class.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,24 +246,11 @@ func initClass(mrb *State) (err error) {
objectClass.object.class = classClass
moduleClass.object.class = classClass

err = mrb.prepareSingletonClass(basicObject)
if err != nil {
return
}

err = mrb.prepareSingletonClass(objectClass)
if err != nil {
return
}

err = mrb.prepareSingletonClass(moduleClass)
if err != nil {
return
}

err = mrb.prepareSingletonClass(classClass)
if err != nil {
return
for _, class := range []RClass{basicObject, objectClass, moduleClass, classClass} {
err = mrb.prepareSingletonClass(class)
if err != nil {
return
}
}

mrb.DefineConstById(basicObject, _BasicObject(mrb), NewObjectValue(basicObject))
Expand Down

0 comments on commit b47a1c4

Please sign in to comment.