Struct LetCoercionResult
Represents the result of a let-coercion (implicit type conversion) semantic operation.
public readonly record struct LetCoercionResult : IEquatable<LetCoercionResult>
- Implements
- Inherited Members
Constructors
LetCoercionResult(bool, VBTypedValue?, VBRuntimeErrorInfo?, ImmutableArray<LetCoercionStackFrame>)
Represents the result of a let-coercion (implicit type conversion) semantic operation.
public LetCoercionResult(bool IsApplicable, VBTypedValue? Result, VBRuntimeErrorInfo? ErrorInfo, ImmutableArray<LetCoercionStackFrame> Frames)
Parameters
IsApplicablebooltrueif the let-coercion strategy is applicable for the specified inputs,falseotherwise (another implementation shall then handle the conversion).ResultVBTypedValueThe let-coerced result of the conversion operation, if one was produced.
ErrorInfoVBRuntimeErrorInfoThe error metadata for the run-time error to be reported, if applicable.
FramesImmutableArray<LetCoercionStackFrame>The let-coercion evaluation frames associated with this result, if any.
Properties
ErrorInfo
The error metadata for the run-time error to be reported, if applicable.
public VBRuntimeErrorInfo? ErrorInfo { get; init; }
Property Value
Frame
Gets the current (top-most) frame in the evaluation stack.
public LetCoercionStackFrame Frame { get; }
Property Value
Frames
The let-coercion evaluation frames associated with this result, if any.
public ImmutableArray<LetCoercionStackFrame> Frames { get; init; }
Property Value
IsApplicable
true if the let-coercion strategy is applicable for the specified inputs, false otherwise (another implementation shall then handle the conversion).
public bool IsApplicable { get; init; }
Property Value
IsSuccess
true if the let-coercion semantic operation was successfully completed.
public bool IsSuccess { get; }
Property Value
Result
The let-coerced result of the conversion operation, if one was produced.
public VBTypedValue? Result { get; init; }
Property Value
Methods
Error(VBRuntimeErrorInfo, params LetCoercionStackFrame[])
Creates a new (failed) LetCoercionResult with the specified VBRuntimeErrorInfo error information metadata.
public static LetCoercionResult Error(VBRuntimeErrorInfo info, params LetCoercionStackFrame[] frames)
Parameters
infoVBRuntimeErrorInfoThe runtime error metadata describing the let-coercion failure.
framesLetCoercionStackFrame[]All the LetCoercionStackFrame frames in the let-coercion evaluation stack.
Returns
NotApplicable(LetCoercionStackFrame)
Creates a new (not applicable) LetCoercionResult indicating that a let-coercion strategy is not applicable in the context of the evaluated expression.
public static LetCoercionResult NotApplicable(LetCoercionStackFrame frame)
Parameters
frameLetCoercionStackFrame
Returns
Success(VBTypedValue, params LetCoercionStackFrame[])
Creates a new (successful) LetCoercionResult with the specified result value.
public static LetCoercionResult Success(VBTypedValue result, params LetCoercionStackFrame[] frames)
Parameters
resultVBTypedValueThe successfully let-coerced result value.
framesLetCoercionStackFrame[]
Returns
WithFrame(LetCoercionStackFrame)
Gets a copy of this let-coercion result, with the specified LetCoercionStackFrame appended to the Frames array.
public LetCoercionResult WithFrame(LetCoercionStackFrame frame)
Parameters
frameLetCoercionStackFrameThe let-coercion evaluation stack frame to append to the new result.