Skip to content

Commit

Permalink
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -63,7 +63,8 @@ public static boolean isRubyArray(Object value) {
}

public static boolean isRubyArray(RubyBasicObject value) {
return value.getDynamicObject().getShape().getObjectType() == ArrayNodes.ARRAY_TYPE;
//return value.getDynamicObject().getShape().getObjectType() == ArrayNodes.ARRAY_TYPE;
return value instanceof RubyArray;
}
public static boolean isRubyBinding(Object value) {
return value instanceof RubyBinding;
Original file line number Diff line number Diff line change
@@ -68,27 +68,27 @@ public static class ArrayType extends BasicObjectType {

}

public static final ArrayType ARRAY_TYPE = new ArrayType();
//public static final ArrayType ARRAY_TYPE = new ArrayType();

//private static final HiddenKey STORE_IDENTIFIER = new HiddenKey("store");
//private static final Property STORE_PROPERTY;

//private static final HiddenKey SIZE_IDENTIFIER = new HiddenKey("size");
//private static final Property SIZE_PROPERTY;

private static final DynamicObjectFactory ARRAY_FACTORY;
//private static final DynamicObjectFactory ARRAY_FACTORY;

static {
//final Shape.Allocator allocator = RubyBasicObject.LAYOUT.createAllocator();

//STORE_PROPERTY = Property.create(STORE_IDENTIFIER, allocator.locationForType(Object.class, EnumSet.of(LocationModifier.NonNull)), 0);
//SIZE_PROPERTY = Property.create(SIZE_IDENTIFIER, allocator.locationForType(int.class, EnumSet.of(LocationModifier.NonNull)), 0);

final Shape shape = RubyBasicObject.LAYOUT.createShape(ARRAY_TYPE);
//final Shape shape = RubyBasicObject.LAYOUT.createShape(ARRAY_TYPE);
//.addProperty(STORE_PROPERTY)
//.addProperty(SIZE_PROPERTY);

ARRAY_FACTORY = shape.createFactory();
//ARRAY_FACTORY = shape.createFactory();
}

public static Object getStore(RubyBasicObject array) {
@@ -390,7 +390,8 @@ public static RubyBasicObject createArray(RubyClass arrayClass, Object[] store,
}

public static RubyArray createGeneralArray(RubyClass arrayClass, Object store, int size) {
return new RubyArray(arrayClass, store, size, ARRAY_FACTORY.newInstance(store, size));
//return new RubyArray(arrayClass, store, size, ARRAY_FACTORY.newInstance(store, size));
return new RubyArray(arrayClass, store, size, RubyBasicObject.LAYOUT.newInstance(RubyBasicObject.EMPTY_SHAPE));
}

@CoreMethod(names = "+", required = 1)

0 comments on commit 73035f8

Please sign in to comment.