in model/src/main/java/jetbrains/jetpad/model/children/ChildProperty.java [29:74]
public void set(ChildT value) {
if (get() == value) return;
if (value != null && value.parent().get() != null) {
throw new IllegalStateException();
}
ChildT oldValue = get();
if (oldValue != null) {
oldValue.myParent.set(null);
oldValue.myPositionData = null;
}
if (value != null) {
value.myParent.set(myParent);
value.myPositionData = new PositionData<ChildT>() {
@Override
public Position<ChildT> get() {
return new Position<ChildT>() {
@Override
public ChildT get() {
return ChildProperty.this.get();
}
@Override
public Object getRole() {
return ChildProperty.this;
}
};
}
@Override
public void remove() {
set(null);
}
};
}
super.set(value);
if (oldValue != null) {
oldValue.myParent.flush();
}
if (value != null) {
value.myParent.flush();
}
}