Class LocalPattern
Defines the pattern matching on a local variable in a CIL method body.
[GenerateKeyedMatchNode]
public record LocalPattern : Pattern<CilLocalVariable>, IEquatable<Pattern>, IEquatable<Pattern<CilLocalVariable>>, IEquatable<LocalPattern>
- Inheritance
-
LocalPattern
- Implements
- Inherited Members
Constructors
LocalPattern(LocalPattern)
protected LocalPattern(LocalPattern original)
Parameters
originalLocalPattern
LocalPattern(Pattern<int>, Pattern<TypeSignature?>)
Defines the pattern matching on a local variable in a CIL method body.
public LocalPattern(Pattern<int> Index, Pattern<TypeSignature?> VariableType)
Parameters
IndexPattern<int>The pattern describing the index of the local.
VariableTypePattern<TypeSignature>The pattern describing the type of the variable.
Properties
EqualityContract
protected override Type EqualityContract { get; }
Property Value
Index
The pattern describing the index of the local.
public Pattern<int> Index { get; init; }
Property Value
VariableType
The pattern describing the type of the variable.
public Pattern<TypeSignature?> VariableType { get; init; }
Property Value
Methods
Deconstruct(out Pattern<int>, out Pattern<TypeSignature?>)
public void Deconstruct(out Pattern<int> Index, out Pattern<TypeSignature?> VariableType)
Parameters
IndexPattern<int>VariableTypePattern<TypeSignature>
Equals(LocalPattern?)
public virtual bool Equals(LocalPattern? other)
Parameters
otherLocalPattern
Returns
Equals(Pattern<CilLocalVariable>?)
public override sealed bool Equals(Pattern<CilLocalVariable>? other)
Parameters
otherPattern<CilLocalVariable>
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
Format(IndentedTextWriter)
Serializes the pattern to a readable string.
public override void Format(IndentedTextWriter writer)
Parameters
writerIndentedTextWriterThe output stream.
GetHashCode()
public override int GetHashCode()
Returns
Match(CilLocalVariable, MatchingContext)
Attempts to match the provided input to the pattern.
public override IMatchNode<CilLocalVariable>? Match(CilLocalVariable input, MatchingContext context)
Parameters
inputCilLocalVariableThe input to match.
contextMatchingContextThe context in which to match the pattern to.
Returns
- IMatchNode<CilLocalVariable>
When successful, returns the root node of the match tree, otherwise
null.
PrintMembers(StringBuilder)
protected override bool PrintMembers(StringBuilder builder)
Parameters
builderStringBuilder
Returns
Operators
operator ==(LocalPattern?, LocalPattern?)
public static bool operator ==(LocalPattern? left, LocalPattern? right)
Parameters
leftLocalPatternrightLocalPattern
Returns
operator !=(LocalPattern?, LocalPattern?)
public static bool operator !=(LocalPattern? left, LocalPattern? right)
Parameters
leftLocalPatternrightLocalPattern