/** @since 0.17 or earlier */ @Override public final boolean hasProperty(Object name) { return getProperty(name) != null; }
/** @since 0.17 or earlier */ @Override public final boolean hasProperty(Object name) { return getProperty(name) != null; }
@Override public final boolean hasProperty(Object name) { return getProperty(name) != null; }
/** @since 0.17 or earlier */ protected void objectDefineProperty(DynamicObjectImpl object, Object key, Object value, int flags, LocationFactory locationFactory, ShapeImpl currentShape) { ShapeImpl oldShape = currentShape; Property oldProperty = oldShape.getProperty(key); ShapeImpl newShape = defineProperty(oldShape, key, value, flags, locationFactory, oldProperty); if (oldShape == newShape) { assert oldProperty.equals(newShape.getProperty(key)); oldProperty.setSafe(object, value, oldShape); } else { Property newProperty = newShape.getProperty(key); newProperty.setSafe(object, value, oldShape, newShape); } }
/** @since 0.17 or earlier */ protected void objectDefineProperty(DynamicObjectImpl object, Object key, Object value, int flags, LocationFactory locationFactory, ShapeImpl currentShape) { ShapeImpl oldShape = currentShape; Property oldProperty = oldShape.getProperty(key); ShapeImpl newShape = defineProperty(oldShape, key, value, flags, locationFactory, oldProperty); if (oldShape == newShape) { assert oldProperty.equals(newShape.getProperty(key)); oldProperty.setSafe(object, value, oldShape); } else { Property newProperty = newShape.getProperty(key); newProperty.setSafe(object, value, oldShape, newShape); } }
/** @since 0.17 or earlier */ @Override @TruffleBoundary public boolean set(Object key, Object value) { Property existing = getShape().getProperty(key); if (existing != null) { existing.setGeneric(this, value, null); return true; } else { return false; } }
/** @since 0.17 or earlier */ protected ShapeImpl defineProperty(ShapeImpl shape, Object key, Object value, int flags, LocationFactory locationFactory) { ShapeImpl oldShape = shape; if (!oldShape.isValid()) { oldShape = ensureValid(oldShape); } Property existing = oldShape.getProperty(key); return defineProperty(oldShape, key, value, flags, locationFactory, existing); }
/** @since 0.17 or earlier */ protected ShapeImpl defineProperty(ShapeImpl shape, Object key, Object value, int flags, LocationFactory locationFactory) { ShapeImpl oldShape = shape; if (!oldShape.isValid()) { oldShape = ensureValid(oldShape); } Property existing = oldShape.getProperty(key); return defineProperty(oldShape, key, value, flags, locationFactory, existing); }
@Override @TruffleBoundary public boolean set(Object id, Object value) { Property existing = getShape().getProperty(id); if (existing != null) { existing.setGeneric(this, value, null); return true; } else { return false; } }
/** @since 0.17 or earlier */ protected void propertySetWithShapeFallback(Property property, DynamicObject store, Object value, ShapeImpl currentShape, ShapeImpl nextShape) { ShapeImpl oldShape = currentShape; ShapeImpl newNextShape = generalizeProperty(property, value, oldShape, nextShape); Property newProperty = newNextShape.getProperty(property.getKey()); newProperty.setSafe(store, value, oldShape, newNextShape); }
/** @since 0.17 or earlier */ @Override @TruffleBoundary public Object get(Object key, Object defaultValue) { Property existing = getShape().getProperty(key); if (existing != null) { return existing.get(this, false); } else { return defaultValue; } }
/** @since 0.17 or earlier */ protected void propertySetWithShapeFallback(Property property, DynamicObject store, Object value, ShapeImpl currentShape, ShapeImpl nextShape) { ShapeImpl oldShape = currentShape; ShapeImpl newNextShape = generalizeProperty(property, value, oldShape, nextShape); Property newProperty = newNextShape.getProperty(property.getKey()); newProperty.setSafe(store, value, oldShape, newNextShape); }
@Override @TruffleBoundary public Object get(Object id, Object defaultValue) { Property existing = getShape().getProperty(id); if (existing != null) { return existing.get(this, false); } else { return defaultValue; } }
/** @since 0.17 or earlier */ @Override @TruffleBoundary public boolean delete(Object key) { ShapeImpl oldShape = getShapeImpl(); Property existing = oldShape.getProperty(key); if (existing != null) { oldShape.getLayout().getStrategy().objectRemoveProperty(this, existing, oldShape); return true; } else { return false; } }
/** @since 0.17 or earlier */ @Override @TruffleBoundary public boolean delete(Object key) { ShapeImpl oldShape = getShape(); Property existing = oldShape.getProperty(key); if (existing != null) { oldShape.getLayout().getStrategy().objectRemoveProperty(this, existing, oldShape); return true; } else { return false; } }
/** @since 0.17 or earlier */ protected void propertySetFallback(Property property, DynamicObject store, Object value, ShapeImpl currentShape) { ShapeImpl oldShape = currentShape; ShapeImpl newShape = defineProperty(oldShape, property.getKey(), value, property.getFlags(), getDefaultLocationFactory()); Property newProperty = newShape.getProperty(property.getKey()); newProperty.setSafe(store, value, oldShape, newShape); }
@Override @TruffleBoundary public boolean delete(Object id) { ShapeImpl oldShape = getShape(); Property existing = oldShape.getProperty(id); if (existing != null) { ShapeImpl newShape = oldShape.removeProperty(existing); this.reshapeAfterDelete(newShape, ShapeImpl.findCommonAncestor(oldShape, newShape)); // TODO ancestor should be the parent of found property's shape return true; } else { return false; } }
/** @since 0.17 or earlier */ protected void propertySetFallback(Property property, DynamicObject store, Object value, ShapeImpl currentShape) { ShapeImpl oldShape = currentShape; ShapeImpl newShape = defineProperty(oldShape, property.getKey(), value, property.getFlags(), getDefaultLocationFactory()); Property newProperty = newShape.getProperty(property.getKey()); newProperty.setSafe(store, value, oldShape, newShape); }
@Override @TruffleBoundary public void define(Object id, Object value, int flags, LocationFactory locationFactory) { ShapeImpl oldShape = getShape(); Property existing = oldShape.getProperty(id); if (existing == null) { updateShape(); oldShape = getShape(); Shape newShape = oldShape.addProperty(Property.create(id, locationFactory.createLocation(oldShape, value), flags)); updateShape(); newShape.getLastProperty().setGeneric(this, value, oldShape, newShape); } else { defineExisting(id, value, flags, existing, oldShape); } }
@Override @TruffleBoundary public void define(Object id, Object value, int flags) { ShapeImpl oldShape = getShape(); Property existing = oldShape.getProperty(id); if (existing == null) { updateShape(); oldShape = getShape(); Shape newShape = oldShape.addProperty(Property.create(id, oldShape.allocator().locationForValue(value, true, true), flags)); updateShape(); newShape.getLastProperty().setGeneric(this, value, oldShape, newShape); } else { defineExisting(id, value, flags, existing, oldShape); } }