Class ClassModuleEventSemantics
The static semantics of what a class module declares about events: its Event declarations
(MS-VBAL §5.2.4.3), its WithEvents variables (§5.2.3.1.2) and the procedures
that handle an event of one (§5.3.1.8).
public static class ClassModuleEventSemantics
- Inheritance
-
ClassModuleEventSemantics
- Inherited Members
Remarks
What a RaiseEvent statement may say is StatementStaticSemanticsEvaluator's: this is what the
declarations may.
- An event name is unique within the class module (DuplicateDeclaration) and has no underscore (InvalidEventName): an underscore is what ends the name of a variable in the name of a handler.
- A
WithEventsvariable is declared as a specific class that has at least one event, and not as the class of the module that contains it (InvalidWithEventsType). - A procedure that qualifies as the handler of an event is a subroutine whose parameter list is compatible with the event's (InvalidEventHandler): the same number of parameters, each of the same type and parameter mechanism - though not necessarily of the same name, nor with the mechanism written out in the same way.
A procedure qualifies as a handler by its name alone, VariableName_EventName. One whose name only begins with
the name of a WithEvents variable and an underscore is no handler of anything, and is not checked.
A type that has not been resolved is not a type that is wrong: whatever is declared as one is not reported.
Methods
Evaluate(VBClassModuleSymbol, ISymbolResolver?)
Checks everything module declares about events.
public static ImmutableArray<VBCompileErrorInfo> Evaluate(VBClassModuleSymbol module, ISymbolResolver? resolver = null)
Parameters
moduleVBClassModuleSymbolThe class module, with its members.
resolverISymbolResolverWhat finds the class a
WithEventsvariable is declared as, as it is now: a declared type carries the class as it was when the type was built. null checks against what the types carry.
Returns
- ImmutableArray<VBCompileErrorInfo>
Every error found, events first, then variables, then handlers; empty when the declarations are valid.