Table of Contents

Class CilBlockPattern

Namespace
CilFi.Patterns
Assembly
CilFi.Core.dll

Defines the pattern that matches on a single basic block in a control flow graph of a CIL method body.

public record CilBlockPattern : Pattern<IList<CilInstruction>>, IEquatable<Pattern>, IEquatable<Pattern<IList<CilInstruction>>>, IEquatable<CilBlockPattern>
Inheritance
CilBlockPattern
Implements
Inherited Members

Constructors

CilBlockPattern(CilBlockPattern)

protected CilBlockPattern(CilBlockPattern original)

Parameters

original CilBlockPattern

CilBlockPattern(CilBlockPatternAttributes, ImmutableArray<Pattern<CilInstruction>>)

Defines the pattern that matches on a single basic block in a control flow graph of a CIL method body.

public CilBlockPattern(CilBlockPatternAttributes Attributes, ImmutableArray<Pattern<CilInstruction>> Instructions)

Parameters

Attributes CilBlockPatternAttributes

The matching flags.

Instructions ImmutableArray<Pattern<CilInstruction>>

The list of expected instructions.

Properties

Attributes

The matching flags.

public CilBlockPatternAttributes Attributes { get; init; }

Property Value

CilBlockPatternAttributes

EqualityContract

protected override Type EqualityContract { get; }

Property Value

Type

IgnoreNops

Gets a value indicating NOP instructions in the input should be ignored.

public bool IgnoreNops { get; }

Property Value

bool

Instructions

The list of expected instructions.

public ImmutableArray<Pattern<CilInstruction>> Instructions { get; init; }

Property Value

ImmutableArray<Pattern<CilInstruction>>

Methods

Deconstruct(out CilBlockPatternAttributes, out ImmutableArray<Pattern<CilInstruction>>)

public void Deconstruct(out CilBlockPatternAttributes Attributes, out ImmutableArray<Pattern<CilInstruction>> Instructions)

Parameters

Attributes CilBlockPatternAttributes
Instructions ImmutableArray<Pattern<CilInstruction>>

Equals(CilBlockPattern?)

public virtual bool Equals(CilBlockPattern? other)

Parameters

other CilBlockPattern

Returns

bool

Equals(Pattern<IList<CilInstruction>>?)

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

Parameters

other Pattern<IList<CilInstruction>>

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 indented)

Parameters

indented IndentedTextWriter

GetHashCode()

public override int GetHashCode()

Returns

int

Match(IList<CilInstruction>, MatchingContext)

Attempts to match the provided input to the pattern.

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

Parameters

input IList<CilInstruction>

The input to match.

context MatchingContext

The context in which to match the pattern to.

Returns

IMatchNode<IList<CilInstruction>>

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

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

Parameters

left CilBlockPattern
right CilBlockPattern

Returns

bool

operator !=(CilBlockPattern?, CilBlockPattern?)

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

Parameters

left CilBlockPattern
right CilBlockPattern

Returns

bool