class SyntaxTree::YARV::DefineClass


~~~
end
class Foo
~~~ruby
### Usage
indicate if it is a singleton class, a module, or a regular class.
instruction sequence associated with the class, and various flags that
defined under. It has three arguments: the name of the constant, the
stack, then it pops the object off the stack that the class should be
`defineclass` defines a class. First it pops the superclass off the
### Summary

def ==(other)

def ==(other)
  other.is_a?(DefineClass) && other.name == name &&
    other.class_iseq == class_iseq && other.flags == flags
end

def call(vm)

def call(vm)
  object, superclass = vm.pop(2)
  if name == :singletonclass
    vm.push(vm.run_class_frame(class_iseq, object.singleton_class))
  elsif object.const_defined?(name)
    vm.push(vm.run_class_frame(class_iseq, object.const_get(name)))
  elsif flags & TYPE_MODULE > 0
    clazz = Module.new
    object.const_set(name, clazz)
    vm.push(vm.run_class_frame(class_iseq, clazz))
  else
    clazz =
      if flags & FLAG_HAS_SUPERCLASS > 0
        Class.new(superclass)
      else
        Class.new
      end
    object.const_set(name, clazz)
    vm.push(vm.run_class_frame(class_iseq, clazz))
  end
end

def deconstruct_keys(_keys)

def deconstruct_keys(_keys)
  { name: name, class_iseq: class_iseq, flags: flags }
end

def disasm(fmt)

def disasm(fmt)
  fmt.enqueue(class_iseq)
  fmt.instruction(
    "defineclass",
    [fmt.object(name), class_iseq.name, fmt.object(flags)]
  )
end

def initialize(name, class_iseq, flags)

def initialize(name, class_iseq, flags)
  @name = name
  @class_iseq = class_iseq
  @flags = flags
end

def length

def length
  4
end

def pops

def pops
  2
end

def pushes

def pushes
  1
end

def to_a(_iseq)

def to_a(_iseq)
  [:defineclass, name, class_iseq.to_a, flags]
end