Table of Contents

Class MethodReferencePattern

Namespace
CilFi.Patterns
Assembly
CilFi.Core.dll

Defines the pattern matching on method descriptors.

[GenerateKeyedMatchNode]
public record MethodReferencePattern : Pattern<IMethodDescriptor>, IEquatable<Pattern>, IEquatable<Pattern<IMethodDescriptor>>, IEquatable<MethodReferencePattern>
Inheritance
MethodReferencePattern
Implements
Inherited Members

Constructors

MethodReferencePattern(MethodReferencePattern)

protected MethodReferencePattern(MethodReferencePattern original)

Parameters

original MethodReferencePattern

MethodReferencePattern(Pattern<bool>, Pattern<TypeSignature>, Pattern<ITypeDefOrRef?>, Pattern<string?>, Pattern<IReadOnlyList<TypeSignature>>, Pattern<IReadOnlyList<TypeSignature>>)

Defines the pattern matching on method descriptors.

public MethodReferencePattern(Pattern<bool> HasThis, Pattern<TypeSignature> ReturnType, Pattern<ITypeDefOrRef?> DeclaringType, Pattern<string?> Name, Pattern<IReadOnlyList<TypeSignature>> TypeArguments, Pattern<IReadOnlyList<TypeSignature>> ParameterTypes)

Parameters

HasThis Pattern<bool>

The pattern describing the flag indicating the method is static or instance.

ReturnType Pattern<TypeSignature>

The pattern describing the return type of the method.

DeclaringType Pattern<ITypeDefOrRef>

The pattern describing the type that is defining the method.

Name Pattern<string>

The pattern describing the name of the method.

TypeArguments Pattern<IReadOnlyList<TypeSignature>>

The pattern describing the generic type arguments that were provided to instantiate the method.

ParameterTypes Pattern<IReadOnlyList<TypeSignature>>

The pattern describing the parameters of the method.

Fields

AnyMethod

Describes the pattern for any valid method descriptor.

public static readonly Pattern<IMethodDescriptor> AnyMethod

Field Value

Pattern<IMethodDescriptor>

Properties

DeclaringType

The pattern describing the type that is defining the method.

public Pattern<ITypeDefOrRef?> DeclaringType { get; init; }

Property Value

Pattern<ITypeDefOrRef>

EqualityContract

protected override Type EqualityContract { get; }

Property Value

Type

HasThis

The pattern describing the flag indicating the method is static or instance.

public Pattern<bool> HasThis { get; init; }

Property Value

Pattern<bool>

Name

The pattern describing the name of the method.

public Pattern<string?> Name { get; init; }

Property Value

Pattern<string>

ParameterTypes

The pattern describing the parameters of the method.

public Pattern<IReadOnlyList<TypeSignature>> ParameterTypes { get; init; }

Property Value

Pattern<IReadOnlyList<TypeSignature>>

ReturnType

The pattern describing the return type of the method.

public Pattern<TypeSignature> ReturnType { get; init; }

Property Value

Pattern<TypeSignature>

TypeArguments

The pattern describing the generic type arguments that were provided to instantiate the method.

public Pattern<IReadOnlyList<TypeSignature>> TypeArguments { get; init; }

Property Value

Pattern<IReadOnlyList<TypeSignature>>

Methods

Deconstruct(out Pattern<bool>, out Pattern<TypeSignature>, out Pattern<ITypeDefOrRef?>, out Pattern<string?>, out Pattern<IReadOnlyList<TypeSignature>>, out Pattern<IReadOnlyList<TypeSignature>>)

public void Deconstruct(out Pattern<bool> HasThis, out Pattern<TypeSignature> ReturnType, out Pattern<ITypeDefOrRef?> DeclaringType, out Pattern<string?> Name, out Pattern<IReadOnlyList<TypeSignature>> TypeArguments, out Pattern<IReadOnlyList<TypeSignature>> ParameterTypes)

Parameters

HasThis Pattern<bool>
ReturnType Pattern<TypeSignature>
DeclaringType Pattern<ITypeDefOrRef>
Name Pattern<string>
TypeArguments Pattern<IReadOnlyList<TypeSignature>>
ParameterTypes Pattern<IReadOnlyList<TypeSignature>>

Equals(MethodReferencePattern?)

public virtual bool Equals(MethodReferencePattern? other)

Parameters

other MethodReferencePattern

Returns

bool

Equals(Pattern<IMethodDescriptor>?)

public override sealed bool Equals(Pattern<IMethodDescriptor>? other)

Parameters

other Pattern<IMethodDescriptor>

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

Format(IndentedTextWriter)

Serializes the pattern to a readable string.

public override void Format(IndentedTextWriter writer)

Parameters

writer IndentedTextWriter

The output stream.

GetHashCode()

public override int GetHashCode()

Returns

int

Match(IMethodDescriptor, MatchingContext)

Attempts to match the provided input to the pattern.

public override IMatchNode<IMethodDescriptor>? Match(IMethodDescriptor input, MatchingContext context)

Parameters

input IMethodDescriptor

The input to match.

context MatchingContext

The context in which to match the pattern to.

Returns

IMatchNode<IMethodDescriptor>

When successful, returns the root node of the match tree, otherwise null.

PrintMembers(StringBuilder)

protected override bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

Operators

operator ==(MethodReferencePattern?, MethodReferencePattern?)

public static bool operator ==(MethodReferencePattern? left, MethodReferencePattern? right)

Parameters

left MethodReferencePattern
right MethodReferencePattern

Returns

bool

operator !=(MethodReferencePattern?, MethodReferencePattern?)

public static bool operator !=(MethodReferencePattern? left, MethodReferencePattern? right)

Parameters

left MethodReferencePattern
right MethodReferencePattern

Returns

bool