Struct RuntimeSemanticsEvaluationResult
Represents the result of the evaluation of any runtime semantics.
public readonly record struct RuntimeSemanticsEvaluationResult : IRuntimeSemanticsEvaluationResult, IEquatable<RuntimeSemanticsEvaluationResult>
- Implements
- Inherited Members
Constructors
RuntimeSemanticsEvaluationResult(VBTypedValue?, IVBRaisableError?)
Represents the result of the evaluation of any runtime semantics.
public RuntimeSemanticsEvaluationResult(VBTypedValue? Result, IVBRaisableError? ErrorInfo)
Parameters
ResultVBTypedValueThe result of the evaluation, if one was produced.
ErrorInfoIVBRaisableErrorThe error metadata for the run-time error to be reported, if applicable.
Properties
ErrorInfo
The error metadata for the run-time error to be reported, if applicable.
public IVBRaisableError? ErrorInfo { get; init; }
Property Value
IsError
true if the evaluation semantically yields a runtime error.
public bool IsError { get; }
Property Value
Remarks
👉 This value represents a specified, consistent state where program execution resumes in a controlled error state.
A result value may or may not have been assigned before the failure: most errors carry none, which is why
this asks only whether there is an error. It used to require a value too, and so answered false for
every error raised without one - which is what Error(VBRuntimeErrorInfo, VBTypedValue?)'s
own default produces.
IsInternalError
true if an evaluation strategy could not be determined.
public bool IsInternalError { get; }
Property Value
Remarks
⚠️ This value represents an unspecified, inconsistent internal state that is ultimately surfaced as an InternalError run-time error.
IsSuccess
true if the evaluation was successfully completed.
public bool IsSuccess { get; }
Property Value
Remarks
✅ This value represents a normally completed, successful evaluation.
Result
The result of the evaluation, if one was produced.
public VBTypedValue? Result { get; init; }
Property Value
Methods
Error(IVBRaisableError, VBTypedValue?)
Creates a new (failed) RuntimeSemanticsEvaluationResult with the specified IVBRaisableError error information metadata.
public static RuntimeSemanticsEvaluationResult Error(IVBRaisableError error, VBTypedValue? result = null)
Parameters
errorIVBRaisableErrorThe runtime error metadata describing the evaluation failure.
resultVBTypedValue
Returns
Remarks
❌ Use this method only to signal a failed expression evaluation. A result value may still have been assigned.
InternalError()
Creates a new RuntimeSemanticsEvalutationResult without a result, and without any IVBRaisableError error metadata.
public static RuntimeSemanticsEvaluationResult InternalError()
Returns
Remarks
💥 This results signals a InternalError run-time error to the evaluation pipeline.
Use it only as a fallback result, when no result can be evaluated for a given effective type.
Success(VBTypedValue)
Creates a new (successful) RuntimeSemanticsEvaluationResult with the specified evaluation result.
public static RuntimeSemanticsEvaluationResult Success(VBTypedValue result)
Parameters
resultVBTypedValueThe successfully evaluated runtime semantics evaluation result.
Returns
Remarks
✅ Use this method only to signal a successully evaluated expression result.