Struct ModuleDirectives
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)
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)
Parameters
ExplicitboolWhether the module declares
Option Explicit(MS-VBAL §5.2.1.3) — an unresolvedSimpleNameis a compile error under this module, not a deferred/inferred type.StrictboolWhether the module carries RD-VBA's
'@OptionStrictannotation — turns select semantic flags that stay legal under plainOption Explicitinto compile errors.CompareOptionCompareThe comparison mode of the module (MS-VBAL §5.2.1.1): how the relational operators compare
Stringvalues in it. Binary unless the module declares anOption Comparedirective.BaseintThe lower bound an array dimension declared without one takes (MS-VBAL §5.2.1.2):
0unless the module declaresOption Base 1. It is whatDim a(10)andReDim a(10)mean by their absent lower bound, so it is a run-time dial and not only a static one.
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
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
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
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
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; }