Skip to content

Add IBindingHandle constructor to VBTypedValue types #136

Description

@RubberduckAdmin

🎯 ROADMAP TICKET

This ticket must be completed in order to advance a milestone.

ℹ️ CONTEXT

Most semantic values are currently created via a default constructor, then copied .WithValue, and then sometimes it's through VBTypedValueFactory, other times it's created directly... it's a mess and it needs a cleanup.

The target is the way VBBooleanTypedValue does it:

    public VBBooleanValue(IBindingHandle handle)
        : base(VBBooleanType.TypeInfo)
    {
        Handle = handle;
    }
    public VBBooleanValue(bool value) : this(new ValueBindingHandle(new VBRuntimeBooleanValue(value))){ }
  • All semantic values must be creatable via a constructor call that passes in an IBindingHandle;
  • Ultimately the UnderlyingValue property gets completely removed, callers using Handle.GetValue instead.

Note

IBindingHandle may or may not hold the underlying value: ValueBindingHandle and ConstantBindingHandle both hold the underlying bytes, but ReferenceBindingHandle finds the value in program memory.


👉 TODO

Clean up construction of all semantic values:

  • Add a constructor accepting IBindingHandle;
  • Add a convenience constructor overload accepting an appropriately typed .net value; use it to create a ValueBindingHandle and pass it to the other constructor;
  • Edit the DefaultValue property and backing field to invoke the new, simpler constructors; use the same pattern everywhere;
  • Ensure VBTypedValueFactory calls the convenience constructor;

Tip

VBTypedValueFactory is slated to be inlined and removed; this could be a good opportunity to do this, or to prepare the ground for it by replacing factory calls with constructor calls.


✅ ACCEPTANCE CRITERIA
  • CLA compliance
  • All tests pass
  • All semantic values no longer expose a default parameterless constructor
  • All default values use the same pattern across the semantic layer
  • All semantic values can be created with an IBindingHandle

Metadata

Metadata

Assignees

No one assigned

    Labels

    rdcore-runtimeTickets pertaining to the RDCore.Runtime project (⚖️GPLv3).rdcore-sdkRelates to the RDCore.SDK project (⚖️MIT).⚖️architectureRelates to the overall solution architecture🎯roadmapA ticket that must be completed in order to advance a milestone.

    Type

    Projects

    Status
    👉Ready

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions