Class ImplementsSemantics
The static semantics of the Implements directives of a class module (MS-VBAL §5.2.4.2) and of
the implemented name declarations that follow from them (§5.3.1.9).
public static class ImplementsSemantics
- Inheritance
-
ImplementsSemantics
- Inherited Members
Remarks
- The directive. The class it names must exist, and cannot be the class of the module that has the
directive, nor a class another directive of the module names. A class whose public variables or methods have an
underscore in their names cannot be an interface class, and no interface's implemented interface name prefix
(
InterfaceName_) can begin another's. All of that is InvalidImplementsDirective, a class that does not exist is UserDefinedTypeNotDefined. - What it requires. An implemented name declaration for each public method of the interface class,
of the same kind, and for each public variable the property accessors its type calls for: a
Property Getand aProperty Let, aProperty Setwhere the variable is anObjector a class, and all three where it is aVariant(InterfaceMemberNotImplemented). - What it forbids. A procedure named
InterfaceName_MemberNameis the implementation of that member, and is invalid when it is not the kind of declaration the member needs, when its parameters are not equivalent to the member's, or when its type is not the member's (InvalidImplementedMember).
A member the language implements on every class module's behalf, and gives an implementation of its own (DefaultImplementation), is not required of anything: this checks the interfaces a module names, and ClassLifecycleInterface is not one of them.
An Implements directive in an extensible module (Attribute VB_Extensible = True,
Extensible) is invalid, whatever the directive names, and nothing else of the module's
directives is checked then.
🚧 TODO the directive's own location is not on the symbol, so what is reported of a directive is located at the module.
Methods
Evaluate(VBClassModuleSymbol, ISymbolResolver)
Checks the Implements directives of module and what they require of it.
public static ImmutableArray<VBCompileErrorInfo> Evaluate(VBClassModuleSymbol module, ISymbolResolver resolver)
Parameters
moduleVBClassModuleSymbolThe class module, with its members.
resolverISymbolResolverWhat finds the classes the directives name, as they are now.
Returns
- ImmutableArray<VBCompileErrorInfo>
Every error found, the directives' first, then the members'; empty when they are valid.