@@ -182,16 +182,7 @@ private void AddSuperTypeNamesForDocumentModules(IReadOnlyCollection<QualifiedMo
182
182
continue ;
183
183
}
184
184
185
- var inheritedInterfaces = comModule is ComCoClass documentCoClass
186
- ? documentCoClass . ImplementedInterfaces
187
- : ( comModule as ComInterface ) ? . InheritedInterfaces ;
188
-
189
- //todo: Find a way to deal with the VBE's document type assignment behaviour not relying on an assumption about an interface naming convention.
190
- var superTypeNames = inheritedInterfaces ?
191
- . Where ( i => ! i . IsRestricted && ! IgnoredComInterfaces . Contains ( i . Name ) )
192
- . Select ( i => i . Name )
193
- . Select ( name => name . StartsWith ( "_" ) ? name . Substring ( 1 ) : name ) //This emulates the VBE's behaviour to allow assignment to the coclass type instead on the interface.
194
- ?? Enumerable . Empty < string > ( ) ;
185
+ var superTypeNames = SuperTypeNamesForDocumentFromComType ( comModule ) ;
195
186
196
187
foreach ( var superTypeName in superTypeNames )
197
188
{
@@ -201,6 +192,29 @@ private void AddSuperTypeNamesForDocumentModules(IReadOnlyCollection<QualifiedMo
201
192
}
202
193
}
203
194
195
+ private static IEnumerable < string > SuperTypeNamesForDocumentFromComType ( IComType comModule )
196
+ {
197
+ var inheritedInterfaces = comModule is ComCoClass documentCoClass
198
+ ? documentCoClass . ImplementedInterfaces
199
+ : ( comModule as ComInterface ) ? . InheritedInterfaces ;
200
+
201
+ //todo: Find a way to deal with the VBE's document type assignment behaviour not relying on an assumption about an interface naming convention.
202
+ var superTypeNames = ( inheritedInterfaces ?
203
+ . Where ( i => ! i . IsRestricted && ! IgnoredComInterfaces . Contains ( i . Name ) )
204
+ . Select ( i => i . Name )
205
+ ?? Enumerable . Empty < string > ( ) )
206
+ . ToList ( ) ;
207
+
208
+ //This emulates the VBE's behaviour to allow assignment to the coclass type instead on the interface.
209
+ var additionalSuperTypes = superTypeNames
210
+ . Where ( name => name . StartsWith ( "_" ) )
211
+ . Select ( name => name . Substring ( 1 ) )
212
+ . ToList ( ) ;
213
+
214
+ superTypeNames . AddRange ( additionalSuperTypes ) ;
215
+ return superTypeNames ;
216
+ }
217
+
204
218
protected void ResolveReferences ( DeclarationFinder finder , QualifiedModuleName module , IParseTree tree , CancellationToken token )
205
219
{
206
220
token . ThrowIfCancellationRequested ( ) ;
0 commit comments