Class OperatorSemanticContext<TFlags>
Represents the semantic context of an operator expression.
public abstract record OperatorSemanticContext<TFlags> : SemanticContext<TFlags>, IEquatable<SemanticContext<TFlags>>, IEquatable<OperatorSemanticContext<TFlags>> where TFlags : struct, Enum
Type Parameters
TFlagsThe specific type of semantic flags in this context.
- Inheritance
-
SemanticContext<TFlags>OperatorSemanticContext<TFlags>
- Implements
-
IEquatable<SemanticContext<TFlags>>IEquatable<OperatorSemanticContext<TFlags>>
- Derived
- Inherited Members
Properties
EffectiveType
Gets the effective type of the operation, as determined by the data type of the operand(s).
public VBType? EffectiveType { get; init; }
Property Value
Remarks
👉 Represents the outcome of the first step of the operator expression evaluation process. A type mismatch error is thrown at run-time is no effective type can be determined.
OperandConversionContexts
Gets the conversion semantic context of each operand of the operation, in operand order (InputIndex): what the operation does to that operand to make it a value it can operate on, and the facts about that operand.
public ImmutableArray<ConversionOperationSemanticContext> OperandConversionContexts { get; init; }
Property Value
Remarks
👉 Empty for a context that was not built by an analysis. Read a specific operand's with ConversionContextOf(InputIndex).
OperationResult
Gets the evaluated operation result if it can be evaluated in a semantic analysis context.
public VBTypedValue? OperationResult { get; init; }
Property Value
ValidOperands
Gets the operands after they have undergone let-coercion and validation as applicable.
public VBTypedValue[] ValidOperands { get; init; }
Property Value
Remarks
Failed validation (or let-coercion) throws a type mismatch error at run-time.
Methods
ConversionContextOf(InputIndex)
Gets the conversion semantic context of the specified operand: its let-coercion flags (LetCoerced, Implicit,
Widening, ...), and what is known about the operand itself (NullOperand, ObjectOperand, ...).
public ConversionOperationSemanticContext ConversionContextOf(InputIndex operand)
Parameters
operandInputIndexThe operand to get the conversion semantic context of.
Returns
- ConversionOperationSemanticContext
An empty context if nothing is known about the operand, for instance because the context was not built by an analysis.