Table of Contents

Class LocalPattern

Namespace
CilFi.Patterns
Assembly
CilFi.Core.dll

Defines the pattern matching on a local variable in a CIL method body.

[GenerateKeyedMatchNode]
public record LocalPattern : Pattern<CilLocalVariable>, IEquatable<Pattern>, IEquatable<Pattern<CilLocalVariable>>, IEquatable<LocalPattern>
Inheritance
LocalPattern
Implements
Inherited Members

Constructors

LocalPattern(LocalPattern)

protected LocalPattern(LocalPattern original)

Parameters

original LocalPattern

LocalPattern(Pattern<int>, Pattern<TypeSignature?>)

Defines the pattern matching on a local variable in a CIL method body.

public LocalPattern(Pattern<int> Index, Pattern<TypeSignature?> VariableType)

Parameters

Index Pattern<int>

The pattern describing the index of the local.

VariableType Pattern<TypeSignature>

The pattern describing the type of the variable.

Properties

EqualityContract

protected override Type EqualityContract { get; }

Property Value

Type

Index

The pattern describing the index of the local.

public Pattern<int> Index { get; init; }

Property Value

Pattern<int>

VariableType

The pattern describing the type of the variable.

public Pattern<TypeSignature?> VariableType { get; init; }

Property Value

Pattern<TypeSignature>

Methods

Deconstruct(out Pattern<int>, out Pattern<TypeSignature?>)

public void Deconstruct(out Pattern<int> Index, out Pattern<TypeSignature?> VariableType)

Parameters

Index Pattern<int>
VariableType Pattern<TypeSignature>

Equals(LocalPattern?)

public virtual bool Equals(LocalPattern? other)

Parameters

other LocalPattern

Returns

bool

Equals(Pattern<CilLocalVariable>?)

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

Parameters

other Pattern<CilLocalVariable>

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

Attempts to match the provided input to the pattern.

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

Parameters

input CilLocalVariable

The input to match.

context MatchingContext

The context in which to match the pattern to.

Returns

IMatchNode<CilLocalVariable>

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

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

Parameters

left LocalPattern
right LocalPattern

Returns

bool

operator !=(LocalPattern?, LocalPattern?)

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

Parameters

left LocalPattern
right LocalPattern

Returns

bool