Table of Contents

Struct ModuleDirectives

Namespace
RDCore.SDK.Model.Symbols
Assembly
RDCore.SDK.dll

The resolved module-level directives a VBModuleSymbol was declared under — the Option ... statements (MS-VBAL §5.2.1) and Attribute VB_... declarations (MS-VBAL §4.2) a static-semantics pass needs to know about, plus RD-VBA's own annotation-driven dials (Option Strict).

public readonly record struct ModuleDirectives : IEquatable<ModuleDirectives>
Implements
Inherited Members

Remarks

Named Directives, not Options: MS-VBAL's own Option statements are only one source feeding this — Attribute declarations (VB_Name, VB_PredeclaredId, …) and RD-VBA annotations belong here too, as this grows one property at a time. A consumer that needs a new directive adds a property to this record; nothing that carries a ModuleDirectives — VBModuleSymbol, LexicalScope, StaticEvaluationContext — ever changes shape because of it.

Constructors

ModuleDirectives(bool, bool, OptionCompare, int, bool, bool, bool, bool)

The resolved module-level directives a VBModuleSymbol was declared under — the Option ... statements (MS-VBAL §5.2.1) and Attribute VB_... declarations (MS-VBAL §4.2) a static-semantics pass needs to know about, plus RD-VBA's own annotation-driven dials (Option Strict).

public ModuleDirectives(bool Explicit = false, bool Strict = false, OptionCompare Compare = OptionCompare.Binary, int Base = 0, bool PrivateModule = false, bool PredeclaredId = false, bool Creatable = true, bool Extensible = false)

Parameters

Explicit bool

Whether the module declares Option Explicit (MS-VBAL §5.2.1.3) — an unresolved SimpleName is a compile error under this module, not a deferred/inferred type.

Strict bool

Whether the module carries RD-VBA's '@OptionStrict annotation — turns select semantic flags that stay legal under plain Option Explicit into compile errors.

Compare OptionCompare

The comparison mode of the module (MS-VBAL §5.2.1.1): how the relational operators compare String values in it. Binary unless the module declares an Option Compare directive.

Base int

The lower bound an array dimension declared without one takes (MS-VBAL §5.2.1.2): 0 unless the module declares Option Base 1. It is what Dim a(10) and ReDim a(10) mean by their absent lower bound, so it is a run-time dial and not only a static one.

PrivateModule bool

Whether the module declares Option Private Module (MS-VBAL §5.2.1.4): the module is accessible only within the project that encloses it, and the meaning of Public for the entities it declares is bounded by that. A module without it is accessible to the projects that reference its project as well. 🚧 TODO nothing consumes it yet: it is the fact, carried where the module is, for the resolution of a name across projects to read once it decides what the platform means by a project reference.

PredeclaredId bool

Whether a class module declares Attribute VB_PredeclaredId = True (MS-VBAL §5.2.4.1.2): the class has a default instance, a global variable named after it that is never Nothing when it is referred to (VBPredeclaredInstanceSymbol). False for a module that declares no such attribute, and for one that is not a class module.

Creatable bool

Whether a class module can be instantiated with New outside its project, per its Attribute VB_Creatable: True unless the module declares otherwise, as in VBE.

Extensible bool

Whether a module declares Attribute VB_Extensible = True (MS-VBAL §4.2.1): a host extends it with an extension module of the same name, as it does its document modules.

Remarks

Named Directives, not Options: MS-VBAL's own Option statements are only one source feeding this — Attribute declarations (VB_Name, VB_PredeclaredId, …) and RD-VBA annotations belong here too, as this grows one property at a time. A consumer that needs a new directive adds a property to this record; nothing that carries a ModuleDirectives — VBModuleSymbol, LexicalScope, StaticEvaluationContext — ever changes shape because of it.

Fields

None

The directives of a module that declares none of them explicitly.

public static readonly ModuleDirectives None

Field Value

ModuleDirectives

Properties

Base

The lower bound an array dimension declared without one takes (MS-VBAL §5.2.1.2): 0 unless the module declares Option Base 1. It is what Dim a(10) and ReDim a(10) mean by their absent lower bound, so it is a run-time dial and not only a static one.

public int Base { get; init; }

Property Value

int

Compare

The comparison mode of the module (MS-VBAL §5.2.1.1): how the relational operators compare String values in it. Binary unless the module declares an Option Compare directive.

public OptionCompare Compare { get; init; }

Property Value

OptionCompare

Creatable

Whether a class module can be instantiated with New outside its project, per its Attribute VB_Creatable: True unless the module declares otherwise, as in VBE.

public bool Creatable { get; init; }

Property Value

bool

Explicit

Whether the module declares Option Explicit (MS-VBAL §5.2.1.3) — an unresolved SimpleName is a compile error under this module, not a deferred/inferred type.

public bool Explicit { get; init; }

Property Value

bool

Extensible

Whether a module declares Attribute VB_Extensible = True (MS-VBAL §4.2.1): a host extends it with an extension module of the same name, as it does its document modules.

public bool Extensible { get; init; }

Property Value

bool

PredeclaredId

Whether a class module declares Attribute VB_PredeclaredId = True (MS-VBAL §5.2.4.1.2): the class has a default instance, a global variable named after it that is never Nothing when it is referred to (VBPredeclaredInstanceSymbol). False for a module that declares no such attribute, and for one that is not a class module.

public bool PredeclaredId { get; init; }

Property Value

bool

PrivateModule

Whether the module declares Option Private Module (MS-VBAL §5.2.1.4): the module is accessible only within the project that encloses it, and the meaning of Public for the entities it declares is bounded by that. A module without it is accessible to the projects that reference its project as well. 🚧 TODO nothing consumes it yet: it is the fact, carried where the module is, for the resolution of a name across projects to read once it decides what the platform means by a project reference.

public bool PrivateModule { get; init; }

Property Value

bool

Strict

Whether the module carries RD-VBA's '@OptionStrict annotation — turns select semantic flags that stay legal under plain Option Explicit into compile errors.

public bool Strict { get; init; }

Property Value

bool