private Property relocateShadow(Location newLocation) { assert !isShadow() && getLocation() instanceof DeclaredLocation && relocatable; return new PropertyImpl(getKey(), newLocation, flags, true, relocatable); }
@Override public Property relocate(Location newLocation) { if ((getLocation() == null || !getLocation().equals(newLocation)) && relocatable) { return construct(getKey(), newLocation, getFlags()); } return this; }
/** @since 0.17 or earlier */ @Override public final void setGeneric(DynamicObject store, Object value, Shape shape) { assert verifyShapeParameter(store, shape); try { set(store, value, shape); } catch (IncompatibleLocationException | FinalLocationException ex) { setSlowCase(store, value); } }
private void setSlowCase(DynamicObject store, Object value) { if (getLocation() instanceof DeclaredLocation) { setDeclaredLocation(store, value); } else { generalize(store, value); } }
/** @since 0.17 or earlier */ @Override public final void setGeneric(DynamicObject store, Object value, Shape oldShape, Shape newShape) { assert verifyShapeParameters(store, oldShape, newShape); try { getLocation().set(store, value, oldShape, newShape); } catch (IncompatibleLocationException ex) { setWithShapeSlowCase(store, value, oldShape, newShape); } }
/** @since 0.17 or earlier */ @Override public final Object get(DynamicObject store, boolean condition) { return getLocation().get(store, condition); }
/** @since 0.17 or earlier */ @Override public final void set(DynamicObject store, Object value, Shape shape) throws IncompatibleLocationException, FinalLocationException { assert verifyShapeParameter(store, shape); getLocation().set(store, value, shape); }
/** @since 0.17 or earlier */ @Override public final void set(DynamicObject store, Object value, Shape oldShape, Shape newShape) throws IncompatibleLocationException { assert verifyShapeParameters(store, oldShape, newShape); getLocation().set(store, value, oldShape, newShape); }
@Override public Property copyWithRelocatable(boolean newRelocatable) { if (this.relocatable != newRelocatable) { return new PropertyImpl(key, location, flags, shadow, newRelocatable); } return this; } }
/** @since 0.17 or earlier */ @Override public Property relocate(Location newLocation) { if (!getLocation().equals(newLocation) && relocatable) { return construct(key, newLocation, flags); } return this; }
@Override public final void setGeneric(DynamicObject store, Object value, Shape shape) { assert shape == null || store.getShape() == shape : "wrong shape"; try { set(store, value, shape); } catch (IncompatibleLocationException | FinalLocationException ex) { setSlowCase(store, value); } }
@Override public final void setGeneric(DynamicObject store, Object value, Shape oldShape, Shape newShape) { assert store.getShape() == oldShape : "wrong old shape"; assert newShape.isValid(); assert getLocation() != null; try { getLocation().set(store, value, oldShape, newShape); } catch (IncompatibleLocationException ex) { setWithShapeSlowCase(store, value, oldShape, newShape); } }
/** @since 0.17 or earlier */ @Override public Property copyWithFlags(int newFlags) { return construct(key, location, newFlags); }
private String wrongArguments(int givenLength) { String message = givenLength + " arguments given but the factory takes " + instanceFields.length + ": "; for (int i = 0; i < instanceFields.length; i++) { message += instanceFields[i].getKey(); if (i != instanceFields.length - 1) { message += ", "; } } return message; }
@ExplodeLoop public DynamicObject newInstance(Object... initialValues) { assert initialValues.length == instanceFields.length : wrongArguments(initialValues.length); DynamicObject store = shape.newInstance(); CompilerAsserts.partialEvaluationConstant(instanceFields.length); for (int i = 0; i < instanceFields.length; i++) { instanceFields[i].setInternal(store, initialValues[i]); } return store; }
/** @since 0.17 or earlier */ @Override public final void setGeneric(DynamicObject store, Object value, Shape oldShape, Shape newShape) { assert verifyShapeParameters(store, oldShape, newShape); try { getLocation().set(store, value, oldShape, newShape); } catch (IncompatibleLocationException ex) { setWithShapeSlowCase(store, value, oldShape, newShape); } }
/** @since 0.17 or earlier */ @Override public final Object get(DynamicObject store, Shape shape) { return getLocation().get(store, shape); }
/** @since 0.17 or earlier */ @Override public final void set(DynamicObject store, Object value, Shape shape) throws IncompatibleLocationException, FinalLocationException { assert verifyShapeParameter(store, shape); getLocation().set(store, value, shape); }
/** @since 0.17 or earlier */ @Override public final void set(DynamicObject store, Object value, Shape oldShape, Shape newShape) throws IncompatibleLocationException { assert verifyShapeParameters(store, oldShape, newShape); getLocation().set(store, value, oldShape, newShape); }
/** @since 0.17 or earlier */ @SuppressWarnings("hiding") protected Property construct(Object name, Location location, int flags) { return new PropertyImpl(name, location, flags, relocatable); }