protected internal void SetExitTypeDescriptor(TypeDescriptor descriptor) { // If this property or field access would return a primitive - and yet // it is also marked null safe - then the exit type descriptor must be // promoted to the box type to allow a null value to be passed on if (_nullSafe && CodeFlow.IsValueType(descriptor)) { _originalPrimitiveExitTypeDescriptor = descriptor; _exitTypeDescriptor = CodeFlow.ToBoxedDescriptor(descriptor); } else { _exitTypeDescriptor = descriptor; } }
private void UpdateExitTypeDescriptor(object result) { var executorToCheck = _cachedExecutor; if (executorToCheck != null && executorToCheck.Get() is ReflectiveMethodExecutor executor) { var method = executor.Method; var descriptor = ComputeExitDescriptor(result, method.ReturnType); if (_nullSafe && CodeFlow.IsValueType(descriptor)) { _originalPrimitiveExitTypeDescriptor = descriptor; _exitTypeDescriptor = CodeFlow.ToBoxedDescriptor(descriptor); } else { _exitTypeDescriptor = descriptor; } } }
private void UpdateExitTypeDescriptor() { var executorToCheck = _cachedExecutor; if (executorToCheck != null && executorToCheck.Get() is ReflectiveMethodExecutor) { var method = ((ReflectiveMethodExecutor)executorToCheck.Get()).Method; var descriptor = CodeFlow.ToDescriptor(method.ReturnType); if (_nullSafe && CodeFlow.IsPrimitive(descriptor)) { _originalPrimitiveExitTypeDescriptor = descriptor; _exitTypeDescriptor = CodeFlow.ToBoxedDescriptor(descriptor); } else { _exitTypeDescriptor = descriptor; } } }