Class ScopeTreeBuilder
Builds a ScopeTree from a flat set of composed symbols. Placement is structural: a symbol's concrete type, its ParentUri, and its access modifier decide its scope:
- module symbols, project-level precompiler constants, global StaticSymbols, and anything the tree cannot otherwise place → the Global scope;
- a standard module's non-
Privatemembers → the project scope, where sibling modules see them; - every module's members: fields, constants, procedures, properties, enums, user-defined
types, events,
Declares → that module's own scope; - a procedure's parameters and its procedure-local
Dim/Static/Const(and the dynamic array a bareReDimintroduces) → that procedure's scope.
An enum constant is placed in the scope that declares its Enum, since that is where
MS-VBAL §5.2.3.4 makes it accessible: it parents to the enum, not to a scope, so
its placement is resolved through the enum. A user-defined type's fields are reached through member
access rather than lexical scoping, and are not placed at all. Ordering referenced libraries by
their .rdproj priority within the global scope is later work.
public static class ScopeTreeBuilder
- Inheritance
-
ScopeTreeBuilder
- Inherited Members
Methods
Build(IEnumerable<Symbol>)
Builds the scope tree for symbols. Any subset is valid input — a symbol
whose enclosing scope is not in the set is placed in the Global scope.
public static ScopeTree Build(IEnumerable<Symbol> symbols)
Parameters
symbolsIEnumerable<Symbol>
Returns
IsProjectVisible(Symbol)
Whether a member of a module is visible to the other modules of its project (MS-VBAL §5.2.3): a visible member is placed in the project scope (see Build(IEnumerable<Symbol>)), where a name resolver binds it from a sibling module.
public static bool IsProjectVisible(Symbol symbol)
Parameters
symbolSymbolThe member to check.
Returns
Remarks
A member declared Public, Global or Friend is visible, and one declared Private is not. A member declared with no access
modifier is visible, except a module variable or a constant, which is private by default. A symbol that is not an
AccessibleTypedSymbol has no access modifier, and is not visible.