marshalValue static method
Helper method. Is a SerialisableValueMarshallerFunction function. Used to marshal when deserialiser code knows statically the type.
Implementation
static MarshalledObject marshalValue(Object? value)
{
if (value is ISerialisable) {
return marshalObject(value);
}
else if (value == null || value is num || value is bool || value is String) {
return new MarshalledObject(value); // Language built-in type.
}
else {
throw new Exception("Cannot marshal this value type, is not built-in or ISerialisable: " + value.runtimeType.toString() );
}
}