Open sandboxFocus

Struct InterceptorReceiverEligibility

Describes whether the receiver of a call can or must be mapped to the this of the generated interceptor method, that is, whether ReceiverMapping can or must be This. The ReceiverEligibility property gives it.

Namespace: Metalama.Extensions.Interceptors
Assembly: Metalama.Extensions.Interceptors.dll
Syntax
[CompileTime]
public readonly struct InterceptorReceiverEligibility : IEquatable<InterceptorReceiverEligibility>
Remarks

The properties are nested: IsThisRequired implies IsThisEligibleForAllSites, which implies IsThisEligible. The default value of the structure has all the properties false: the receiver cannot be mapped to this.

The sites of a group are the call sites that are intercepted with the same template, in the same placement type, for the same intercepted method. The constructions of a generic type and of a generic method are the same type and the same method. A call site that cannot be intercepted is not part of a group.

Properties

Name Description
IsThisEligible

Gets a value indicating whether the receiver of the call can be mapped to this at the current call site. This describes the conditions.

IsThisEligibleForAllSites

Gets a value indicating whether the receiver can be mapped to this at every call site of the group of the current call site. When the delegates map the receiver to this at every site of the group, the sites can share one generated instance method.

IsThisRequired

Gets a value indicating whether the receiver must be mapped to this, because the intercepted method is a protected method of a base type of the calling type, which a static method cannot call through a receiver parameter. The receiver mapping is then This and cannot change.

Methods

Name Description
Equals(InterceptorReceiverEligibility)
Equals(object?)
GetHashCode()
ToString()

Operators

Name Description
operator ==(InterceptorReceiverEligibility, InterceptorReceiverEligibility)

Determines whether two values are equal.

operator !=(InterceptorReceiverEligibility, InterceptorReceiverEligibility)

Determines whether two values are different.