Table of Contents

Class MethodDefinitionPattern

Namespace
CilFi.Patterns
Assembly
CilFi.Core.dll

Defines the pattern matching on methods defined in a .NET module.

[GenerateKeyedMatchNode]
public record MethodDefinitionPattern : Pattern<MethodDefinition>, IEquatable<Pattern>, IEquatable<Pattern<MethodDefinition>>, IEquatable<MethodDefinitionPattern>
Inheritance
MethodDefinitionPattern
Implements
Inherited Members

Constructors

MethodDefinitionPattern()

Constructs a new method pattern.

public MethodDefinitionPattern()

MethodDefinitionPattern(MethodDefinitionPattern)

protected MethodDefinitionPattern(MethodDefinitionPattern original)

Parameters

original MethodDefinitionPattern

MethodDefinitionPattern(Pattern<MethodAttributes>, Pattern<TypeSignature>, Pattern<string?>, Pattern<IList<GenericParameter>>, Pattern<IReadOnlyList<Parameter>>, Pattern<MethodImplAttributes>, Pattern<CilMethodBody?>)

Defines the pattern matching on methods defined in a .NET module.

public MethodDefinitionPattern(Pattern<MethodAttributes> Attributes, Pattern<TypeSignature> ReturnType, Pattern<string?> Name, Pattern<IList<GenericParameter>> GenericParameters, Pattern<IReadOnlyList<Parameter>> Parameters, Pattern<MethodImplAttributes> ImplAttributes, Pattern<CilMethodBody?> Body)

Parameters

Attributes Pattern<MethodAttributes>

The pattern describing the attributes of the method.

ReturnType Pattern<TypeSignature>

The pattern describing the return type of the method.

Name Pattern<string>

The pattern describing the name of the method.

GenericParameters Pattern<IList<GenericParameter>>

The pattern describing the list of generic type parameters the method defines.

Parameters Pattern<IReadOnlyList<Parameter>>

The pattern describing the list of parameters the methdo defines.

ImplAttributes Pattern<MethodImplAttributes>

The pattern describing the implementation attributes of the method.

Body Pattern<CilMethodBody>

The pattern describing the body of the method.

Properties

Attributes

The pattern describing the attributes of the method.

public Pattern<MethodAttributes> Attributes { get; init; }

Property Value

Pattern<MethodAttributes>

Body

The pattern describing the body of the method.

public Pattern<CilMethodBody?> Body { get; init; }

Property Value

Pattern<CilMethodBody>

EqualityContract

protected override Type EqualityContract { get; }

Property Value

Type

GenericParameters

The pattern describing the list of generic type parameters the method defines.

public Pattern<IList<GenericParameter>> GenericParameters { get; init; }

Property Value

Pattern<IList<GenericParameter>>

ImplAttributes

The pattern describing the implementation attributes of the method.

public Pattern<MethodImplAttributes> ImplAttributes { get; init; }

Property Value

Pattern<MethodImplAttributes>

Name

The pattern describing the name of the method.

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

Property Value

Pattern<string>

Parameters

The pattern describing the list of parameters the methdo defines.

public Pattern<IReadOnlyList<Parameter>> Parameters { get; init; }

Property Value

Pattern<IReadOnlyList<Parameter>>

ReturnType

The pattern describing the return type of the method.

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

Property Value

Pattern<TypeSignature>

Methods

Deconstruct(out Pattern<MethodAttributes>, out Pattern<TypeSignature>, out Pattern<string?>, out Pattern<IList<GenericParameter>>, out Pattern<IReadOnlyList<Parameter>>, out Pattern<MethodImplAttributes>, out Pattern<CilMethodBody?>)

public void Deconstruct(out Pattern<MethodAttributes> Attributes, out Pattern<TypeSignature> ReturnType, out Pattern<string?> Name, out Pattern<IList<GenericParameter>> GenericParameters, out Pattern<IReadOnlyList<Parameter>> Parameters, out Pattern<MethodImplAttributes> ImplAttributes, out Pattern<CilMethodBody?> Body)

Parameters

Attributes Pattern<MethodAttributes>
ReturnType Pattern<TypeSignature>
Name Pattern<string>
GenericParameters Pattern<IList<GenericParameter>>
Parameters Pattern<IReadOnlyList<Parameter>>
ImplAttributes Pattern<MethodImplAttributes>
Body Pattern<CilMethodBody>

Equals(MethodDefinitionPattern?)

public virtual bool Equals(MethodDefinitionPattern? other)

Parameters

other MethodDefinitionPattern

Returns

bool

Equals(Pattern<MethodDefinition>?)

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

Parameters

other Pattern<MethodDefinition>

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(MethodDefinition, MatchingContext)

Attempts to match the provided input to the pattern.

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

Parameters

input MethodDefinition

The input to match.

context MatchingContext

The context in which to match the pattern to.

Returns

IMatchNode<MethodDefinition>

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 ==(MethodDefinitionPattern?, MethodDefinitionPattern?)

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

Parameters

left MethodDefinitionPattern
right MethodDefinitionPattern

Returns

bool

operator !=(MethodDefinitionPattern?, MethodDefinitionPattern?)

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

Parameters

left MethodDefinitionPattern
right MethodDefinitionPattern

Returns

bool