Table of Contents

Class CilInstructionPattern

Namespace
CilFi.Patterns
Assembly
CilFi.Core.dll

Defines a pattern matching on individual CIL instructions.

[GenerateKeyedMatchNode]
public record CilInstructionPattern : Pattern<CilInstruction>, IEquatable<Pattern>, IEquatable<Pattern<CilInstruction>>, IEquatable<CilInstructionPattern>
Inheritance
CilInstructionPattern
Implements
Inherited Members

Constructors

CilInstructionPattern(CilInstructionPattern)

protected CilInstructionPattern(CilInstructionPattern original)

Parameters

original CilInstructionPattern

CilInstructionPattern(Pattern<CilOpCode>, Pattern<object?>)

Defines a pattern matching on individual CIL instructions.

public CilInstructionPattern(Pattern<CilOpCode> OpCode, Pattern<object?> Operand)

Parameters

OpCode Pattern<CilOpCode>

The pattern describing the opcode of the instruction.

Operand Pattern<object>

The pattern describing the operand of the instruction.

Properties

EqualityContract

protected override Type EqualityContract { get; }

Property Value

Type

OpCode

The pattern describing the opcode of the instruction.

public Pattern<CilOpCode> OpCode { get; init; }

Property Value

Pattern<CilOpCode>

Operand

The pattern describing the operand of the instruction.

public Pattern<object?> Operand { get; init; }

Property Value

Pattern<object>

Methods

Deconstruct(out Pattern<CilOpCode>, out Pattern<object?>)

public void Deconstruct(out Pattern<CilOpCode> OpCode, out Pattern<object?> Operand)

Parameters

OpCode Pattern<CilOpCode>
Operand Pattern<object>

Equals(CilInstructionPattern?)

public virtual bool Equals(CilInstructionPattern? other)

Parameters

other CilInstructionPattern

Returns

bool

Equals(Pattern<CilInstruction>?)

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

Parameters

other Pattern<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 writer)

Parameters

writer IndentedTextWriter

The output stream.

GetHashCode()

public override int GetHashCode()

Returns

int

Match(CilInstruction, MatchingContext)

Attempts to match the provided input to the pattern.

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

Parameters

input CilInstruction

The input to match.

context MatchingContext

The context in which to match the pattern to.

Returns

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

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

Parameters

left CilInstructionPattern
right CilInstructionPattern

Returns

bool

operator !=(CilInstructionPattern?, CilInstructionPattern?)

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

Parameters

left CilInstructionPattern
right CilInstructionPattern

Returns

bool