ballObjectSetField function
Write fieldName on a live instance map (BallObject or type map).
Emitted as a call to preamble ball_object_set_field in C++ self-host.
Implementation
void ballObjectSetField(Object? target, String fieldName, Object? val) {
if (target is BallObject) {
target.setField(fieldName, val);
return;
}
if (target is BallMap) {
if (target.entries.containsKey('__type__')) {
target[fieldName] = val;
}
return;
}
if (target is Map<String, Object?> && target.containsKey('__type__')) {
target[fieldName] = val;
}
}