Sha256: 481c48161c2a0c0330d4520cf5c67ceb1eaf6a75ccddbdb7df564ade1018f703

Contents?: true

Size: 532 Bytes

Versions: 2

Compression:

Stored size: 532 Bytes

Contents

class Class

  # def new(*args)
  #   `var obj = self.$m.allocate(self);
  #   args.unshift(obj);

  #   obj.$m.initialize.apply(null, args);

  #   return obj;`
  # end

  # This is what new should be: need to fix compiler for splat args
  #
  # def new(*args)
  #   obj = allocate
  #   obj.initialize *args
  #   obj
  # end

  def superclass
    `var sup = self.$super;

    if (!sup) {
      if (self == VM.BasicObject) return nil;
      throw new Error('RuntimeError: uninitialized class');
    }

    return sup;`
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
opal-0.3.1 gems/core/lib/core/class.rb
opal-0.3.0 gems/core/lib/core/class.rb