Skip to content

Commit

Permalink
Mark singleton class frozen after prepared
Browse files Browse the repository at this point in the history
  • Loading branch information
elct9620 committed Aug 22, 2024
1 parent f6765d5 commit 1d430c0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions class.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var (
FlagClassIsInherited = uint32(1 << 17)
FlagClassIsOrigin = uint32(1 << 18)
FlagClassIsPrepended = uint32(1 << 19)
FlagObjectIsFrozen = uint32(1 << 20)
)

type methodTable map[Symbol]Method
Expand Down Expand Up @@ -169,6 +170,8 @@ func (mrb *State) prepareSingletonClass(obj RObject) error {
}

mrb.ObjectInstanceVariableSetForce(singletonClass, _attached(mrb), obj)
singletonClass.flags = singletonClass.Flags() & FlagObjectIsFrozen

return nil
}

Expand Down

0 comments on commit 1d430c0

Please sign in to comment.