Table of Contents

Class VBTypedValue

Namespace
RDCore.SDK.Model.Values.Abstract
Assembly
RDCore.SDK.dll

Represents any typed value.

[JsonConverter(typeof(VBTypedValueJsonConverter))]
public abstract record VBTypedValue : IEquatable<VBTypedValue>
Inheritance
VBTypedValue
Implements
Derived
Inherited Members

Remarks

This class is at the base of the type hierarchy for all typed values.

Constructors

VBTypedValue(VBType)

Represents any typed value.

protected VBTypedValue(VBType TypeInfo)

Parameters

TypeInfo VBType

The VBType of the value.

Remarks

This class is at the base of the type hierarchy for all typed values.

VBTypedValue(VBType, IRuntimeValue)

protected VBTypedValue(VBType typeInfo, IRuntimeValue value)

Parameters

typeInfo VBType
value IRuntimeValue

VBTypedValue(VBType, VBRuntimeReference)

protected VBTypedValue(VBType typeInfo, VBRuntimeReference reference)

Parameters

typeInfo VBType
reference VBRuntimeReference

Properties

Handle

public IBindingHandle Handle { get; init; }

Property Value

IBindingHandle

IsIndeterminate

Whether the value is not known: it is bound to an IndeterminateBindingHandle, or to a cell that does not know what it holds (IsKnown), and the value it yields is assumed.

public bool IsIndeterminate { get; }

Property Value

bool

Remarks

An analysis evaluates code without running it, so a value that is not a constant is not known: it is represented by an indeterminate value of its declared type (CreateIndeterminateValue()). Whatever is derived from an indeterminate value is indeterminate, and nothing that is raised because of the value it assumes is known to happen.

RuntimeValue

The runtime value this typed value is currently bound to.

public IRuntimeValue RuntimeValue { get; }

Property Value

IRuntimeValue

Size

The allocated size (in bytes) of this value.

public abstract int Size { get; }

Property Value

int

TypeInfo

The VBType of the value.

public VBType TypeInfo { get; init; }

Property Value

VBType

Methods

AsAssumed()

Returns what an analysis assumes of this value where it does not trust it - a variable it reads, a value nothing says anything of but its declared type: a copy whose value is not known (AsIndeterminate()).

public virtual VBTypedValue AsAssumed()

Returns

VBTypedValue

Remarks

👉 A Variant that holds Empty, the value every Variant starts as, says nothing of the value it will hold: its subtype is not known either (IsSubtypeKnown). One that holds a value of another subtype keeps it.

AsIndeterminate()

Returns a copy of this value whose value is not known, and which assumes the value this one holds.

public VBTypedValue AsIndeterminate()

Returns

VBTypedValue

AsKnown()

Returns a copy of this value that is known, when it is not known only because it was read as not known (AsIndeterminate()).

public VBTypedValue AsKnown()

Returns

VBTypedValue

Remarks

For the statements that give a variable a value that no longer depends on what it held: they are what makes it known again.

Describe()

Creates a new VBTypeDescValue that describes this value.

public VBTypeDescValue Describe()

Returns

VBTypeDescValue

Equals(VBTypedValue?)

Two typed values are equal when they have the exact same value type, either both are known or neither is (IsIndeterminate), and they hold equal managed values.

public virtual bool Equals(VBTypedValue? other)

Parameters

other VBTypedValue

Returns

bool

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

GetTargetType()

Gets the described Target type of this value if the value is a VBTypeDescValue; yields the TypeInfo of this value otherwise.

public VBType GetTargetType()

Returns

VBType

Remarks

👉 The TypeInfo of a type descriptor value is a VBTypeDesc.

PrintMembers(StringBuilder)

Prints this VBTypedValue's members for ToString().

protected virtual bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

Remarks

Prints TypeInfo by Name rather than the VBType instance itself: that type's own DefaultValue is this kind of value, so letting the compiler-generated ToString print the full TypeInfo object would recurse between the two PrintMembers implementations forever.

WithRuntimeValue(IRuntimeValue)

Returns a copy of this value bound to runtimeValue.

public VBTypedValue WithRuntimeValue(IRuntimeValue runtimeValue)

Parameters

runtimeValue IRuntimeValue

Returns

VBTypedValue