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
ILVariabletestedOperand
ILInstruction
MatchInstruction(ILVariable, IMethod?, ILInstruction, params ILInstruction[])
public MatchInstruction(ILVariable variable, IMethod? method, ILInstruction testedOperand, params ILInstruction[] subPatterns)
Parameters
variable
ILVariablemethod
IMethodtestedOperand
ILInstructionsubPatterns
ILInstruction[]
Fields
CheckNotNull
public bool CheckNotNull
Field Value
CheckType
public bool CheckType
Field Value
IsDeconstructCall
public bool IsDeconstructCall
Field Value
IsDeconstructTuple
public bool IsDeconstructTuple
Field Value
SubPatternsSlot
public static readonly SlotInfo SubPatternsSlot
Field Value
TestedOperandSlot
public static readonly SlotInfo TestedOperandSlot
Field Value
Properties
DirectFlags
Gets the flags for this instruction only, without considering the child instructions.
public override InstructionFlags DirectFlags { get; }
Property Value
HasDesignator
public bool HasDesignator { get; }
Property Value
IndexInStoreInstructionList
public int IndexInStoreInstructionList { get; set; }
Property Value
IsVar
public bool IsVar { get; }
Property Value
Method
Returns the method operand.
public IMethod? Method { get; }
Property Value
NumPositionalPatterns
public int NumPositionalPatterns { get; }
Property Value
ResultType
Gets the stack type of the value produced by this instruction.
public override StackType ResultType { get; }
Property Value
SubPatterns
public InstructionCollection<ILInstruction> SubPatterns { get; }
Property Value
TestedOperand
public ILInstruction TestedOperand { get; set; }
Property Value
Variable
public ILVariable Variable { get; set; }
Property Value
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
ComputeFlags()
protected override InstructionFlags ComputeFlags()
Returns
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
GetChildCount()
protected override sealed int GetChildCount()
Returns
GetChildSlot(int)
protected override sealed SlotInfo GetChildSlot(int index)
Parameters
index
int
Returns
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
ILInstructiontestedOperand
ILInstructionsettings
DecompilerSettings
Returns
PerformMatch(ILInstruction?, ref Match)
protected override bool PerformMatch(ILInstruction? other, ref Match match)
Parameters
other
ILInstructionmatch
Match
Returns
SetChild(int, ILInstruction)
protected override sealed void SetChild(int index, ILInstruction value)
Parameters
index
intvalue
ILInstruction
WriteTo(ITextOutput, ILAstWritingOptions)
Writes the ILAst to the text output.
public override void WriteTo(ITextOutput output, ILAstWritingOptions options)
Parameters
output
ITextOutputoptions
ILAstWritingOptions