Table of Contents

Class BlocksBodyPattern

Namespace
CilFi.Patterns
Assembly
CilFi.Core.dll

Defines the pattern matching CIL method bodies based on blocks of CIL instruction sequences.

public record BlocksBodyPattern : Pattern<CilMethodBody?>, IEquatable<Pattern>, IEquatable<Pattern<CilMethodBody?>>, IEquatable<BlocksBodyPattern>
Inheritance
BlocksBodyPattern
Implements
Inherited Members

Constructors

BlocksBodyPattern(BlocksBodyPattern)

protected BlocksBodyPattern(BlocksBodyPattern original)

Parameters

original BlocksBodyPattern

BlocksBodyPattern(IReadOnlyDictionary<string, Pattern<IList<CilInstruction>>>, BlockExpression?)

Defines the pattern matching CIL method bodies based on blocks of CIL instruction sequences.

public BlocksBodyPattern(IReadOnlyDictionary<string, Pattern<IList<CilInstruction>>> Blocks, BlockExpression? Condition = null)

Parameters

Blocks IReadOnlyDictionary<string, Pattern<IList<CilInstruction>>>

The expected instruction blocks to find.

Condition BlockExpression

The expression describing which blocks should match and in what combination. When left as null, all block patterns are considered.

Properties

Blocks

The expected instruction blocks to find.

public IReadOnlyDictionary<string, Pattern<IList<CilInstruction>>> Blocks { get; init; }

Property Value

IReadOnlyDictionary<string, Pattern<IList<CilInstruction>>>

Condition

The expression describing which blocks should match and in what combination. When left as null, all block patterns are considered.

public BlockExpression? Condition { get; init; }

Property Value

BlockExpression

EqualityContract

protected override Type EqualityContract { get; }

Property Value

Type

Methods

Deconstruct(out IReadOnlyDictionary<string, Pattern<IList<CilInstruction>>>, out BlockExpression?)

public void Deconstruct(out IReadOnlyDictionary<string, Pattern<IList<CilInstruction>>> Blocks, out BlockExpression? Condition)

Parameters

Blocks IReadOnlyDictionary<string, Pattern<IList<CilInstruction>>>
Condition BlockExpression

Equals(BlocksBodyPattern?)

public virtual bool Equals(BlocksBodyPattern? other)

Parameters

other BlocksBodyPattern

Returns

bool

Equals(Pattern<CilMethodBody?>?)

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

Parameters

other Pattern<CilMethodBody>

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

Attempts to match the provided input to the pattern.

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

Parameters

input CilMethodBody

The input to match.

context MatchingContext

The context in which to match the pattern to.

Returns

IMatchNode<CilMethodBody>

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

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

Parameters

left BlocksBodyPattern
right BlocksBodyPattern

Returns

bool

operator !=(BlocksBodyPattern?, BlocksBodyPattern?)

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

Parameters

left BlocksBodyPattern
right BlocksBodyPattern

Returns

bool