Table of Contents

Class MatchInstruction

Namespace
ICSharpCode.Decompiler.IL
Assembly
ICSharpCode.Decompiler.dll

ILAst representation of C# patterns

public sealed class MatchInstruction : ILInstruction, IStoreInstruction, IInstructionWithVariableOperand, IInstructionWithMethodOperand
Inheritance
MatchInstruction
Implements
Inherited Members

Constructors

MatchInstruction(ILVariable, ILInstruction)

public MatchInstruction(ILVariable variable, ILInstruction testedOperand)

Parameters

variable ILVariable
testedOperand ILInstruction

MatchInstruction(ILVariable, IMethod?, ILInstruction, params ILInstruction[])

public MatchInstruction(ILVariable variable, IMethod? method, ILInstruction testedOperand, params ILInstruction[] subPatterns)

Parameters

variable ILVariable
method IMethod
testedOperand ILInstruction
subPatterns ILInstruction[]

Fields

CheckNotNull

public bool CheckNotNull

Field Value

bool

CheckType

public bool CheckType

Field Value

bool

IsDeconstructCall

public bool IsDeconstructCall

Field Value

bool

IsDeconstructTuple

public bool IsDeconstructTuple

Field Value

bool

SubPatternsSlot

public static readonly SlotInfo SubPatternsSlot

Field Value

SlotInfo

TestedOperandSlot

public static readonly SlotInfo TestedOperandSlot

Field Value

SlotInfo

Properties

DirectFlags

Gets the flags for this instruction only, without considering the child instructions.

public override InstructionFlags DirectFlags { get; }

Property Value

InstructionFlags

HasDesignator

public bool HasDesignator { get; }

Property Value

bool

IndexInStoreInstructionList

public int IndexInStoreInstructionList { get; set; }

Property Value

int

IsVar

public bool IsVar { get; }

Property Value

bool

Method

Returns the method operand.

public IMethod? Method { get; }

Property Value

IMethod

NumPositionalPatterns

public int NumPositionalPatterns { get; }

Property Value

int

ResultType

Gets the stack type of the value produced by this instruction.

public override StackType ResultType { get; }

Property Value

StackType

SubPatterns

public InstructionCollection<ILInstruction> SubPatterns { get; }

Property Value

InstructionCollection<ILInstruction>

TestedOperand

public ILInstruction TestedOperand { get; set; }

Property Value

ILInstruction

Variable

public ILVariable Variable { get; set; }

Property Value

ILVariable

Methods

AcceptVisitor(ILVisitor)

Calls the Visit*-method on the visitor corresponding to the concrete type of this instruction.

public override void AcceptVisitor(ILVisitor visitor)

Parameters

visitor ILVisitor

AcceptVisitor<T>(ILVisitor<T>)

Calls the Visit*-method on the visitor corresponding to the concrete type of this instruction.

public override T AcceptVisitor<T>(ILVisitor<T> visitor)

Parameters

visitor ILVisitor<T>

Returns

T

Type Parameters

T

AcceptVisitor<C, T>(ILVisitor<C, T>, C)

Calls the Visit*-method on the visitor corresponding to the concrete type of this instruction.

public override T AcceptVisitor<C, T>(ILVisitor<C, T> visitor, C context)

Parameters

visitor ILVisitor<C, T>
context C

Returns

T

Type Parameters

C
T

Clone()

public override sealed ILInstruction Clone()

Returns

ILInstruction

ComputeFlags()

protected override InstructionFlags ComputeFlags()

Returns

InstructionFlags

Connected()

Called after the ILInstruction was connected to the root node of the ILAst.

protected override void Connected()

Disconnected()

Called after the ILInstruction was disconnected from the root node of the ILAst.

protected override void Disconnected()

GetChild(int)

protected override sealed ILInstruction GetChild(int index)

Parameters

index int

Returns

ILInstruction

GetChildCount()

protected override sealed int GetChildCount()

Returns

int

GetChildSlot(int)

protected override sealed SlotInfo GetChildSlot(int index)

Parameters

index int

Returns

SlotInfo

IsPatternMatch(ILInstruction?, out ILInstruction?, DecompilerSettings?)

Checks whether the input instruction can represent a pattern matching operation.

Any pattern matching instruction will first evaluate the testedOperand (a descendant of inst), and then match the value of that operand against the pattern encoded in the instruction. The matching may have side-effects on the newly-initialized pattern variables (even if the pattern fails to match!). The pattern matching instruction evaluates to 1 (as I4) if the pattern matches, or 0 otherwise.

public static bool IsPatternMatch(ILInstruction? inst, out ILInstruction? testedOperand, DecompilerSettings? settings)

Parameters

inst ILInstruction
testedOperand ILInstruction
settings DecompilerSettings

Returns

bool

PerformMatch(ILInstruction?, ref Match)

protected override bool PerformMatch(ILInstruction? other, ref Match match)

Parameters

other ILInstruction
match Match

Returns

bool

SetChild(int, ILInstruction)

protected override sealed void SetChild(int index, ILInstruction value)

Parameters

index int
value ILInstruction

WriteTo(ITextOutput, ILAstWritingOptions)

Writes the ILAst to the text output.

public override void WriteTo(ITextOutput output, ILAstWritingOptions options)

Parameters

output ITextOutput
options ILAstWritingOptions