Beispiel #1
0
  public static void initialize(DynamicObject rubyClass, DynamicObject superclass) {
    assert RubyGuards.isRubyClass(superclass);

    Layouts.MODULE.getFields(rubyClass).parentModule = Layouts.MODULE.getFields(superclass).start;
    Layouts.MODULE.getFields(superclass).addDependent(rubyClass);

    Layouts.MODULE.getFields(rubyClass).newVersion();
    ensureSingletonConsistency(rubyClass);

    DynamicObjectFactory factory = Layouts.CLASS.getInstanceFactory(superclass);
    factory = Layouts.BASIC_OBJECT.setLogicalClass(factory, rubyClass);
    factory = Layouts.BASIC_OBJECT.setMetaClass(factory, rubyClass);
    Layouts.CLASS.setInstanceFactoryUnsafe(rubyClass, factory);
  }
Beispiel #2
0
 public static DynamicObject createRubyClass(
     RubyContext context, DynamicObject lexicalParent, DynamicObject superclass, String name) {
   final DynamicObject rubyClass =
       createRubyClass(
           context,
           Layouts.BASIC_OBJECT.getLogicalClass(superclass),
           lexicalParent,
           superclass,
           name,
           false,
           null);
   ensureSingletonConsistency(rubyClass);
   return rubyClass;
 }