@@ -239,9 +239,7 @@ private static (VtableAttribute, EquatableArray<VtableAttribute>) GetVtableAttri
239239 bool isCsWinRTCcwLookupTableGeneratorEnabled )
240240 {
241241 var isManagedOnlyType = GeneratorHelper . IsManagedOnlyType ( compilation ) ;
242- var isWinRTTypeFunc = checkForComponentTypes ?
243- GeneratorHelper . IsWinRTTypeWithPotentialAuthoringComponentTypesFunc ( compilation ) :
244- GeneratorHelper . IsWinRTType ;
242+ var isWinRTTypeFunc = GeneratorHelper . IsWinRTType ( compilation , checkForComponentTypes ) ;
245243 var vtableAttribute = GetVtableAttributeToAdd ( symbol , isManagedOnlyType , isWinRTTypeFunc , typeMapper , compilation , false ) ;
246244 if ( vtableAttribute != default )
247245 {
@@ -317,7 +315,7 @@ private static VtableAttribute GetVtableAttributesForTaskAdapters(GeneratorSynta
317315 return GetVtableAttributeToAdd (
318316 constructedAdapterType ,
319317 GeneratorHelper . IsManagedOnlyType ( context . SemanticModel . Compilation ) ,
320- ! isCsWinRTComponent ? GeneratorHelper . IsWinRTType : GeneratorHelper . IsWinRTTypeWithPotentialAuthoringComponentTypesFunc ( context . SemanticModel . Compilation ) ,
318+ GeneratorHelper . IsWinRTType ( context . SemanticModel . Compilation , isCsWinRTComponent ) ,
321319 typeMapper ,
322320 context . SemanticModel . Compilation ,
323321 false ) ;
@@ -1176,20 +1174,21 @@ private static EquatableArray<VtableAttribute> GetVtableAttributesToAddOnLookupT
11761174 TypeMapper typeMapper ,
11771175 bool isCsWinRTComponent )
11781176 {
1177+ var isWinRTType = GeneratorHelper . IsWinRTType ( context . SemanticModel . Compilation , isCsWinRTComponent ) ;
11791178 return GetVtableAttributesToAddOnLookupTable (
11801179 context ,
11811180 typeMapper ,
11821181 GeneratorHelper . IsManagedOnlyType ( context . SemanticModel . Compilation ) ,
1183- ! isCsWinRTComponent ? GeneratorHelper . IsWinRTType : GeneratorHelper . IsWinRTTypeWithPotentialAuthoringComponentTypesFunc ( context . SemanticModel . Compilation ) ,
1184- GeneratorHelper . IsWinRTClass ( context . SemanticModel . Compilation ) ) ;
1182+ isWinRTType ,
1183+ GeneratorHelper . IsWinRTClassOrInterface ( context . SemanticModel . Compilation , isWinRTType , typeMapper ) ) ;
11851184 }
11861185
11871186 private static EquatableArray < VtableAttribute > GetVtableAttributesToAddOnLookupTable (
11881187 GeneratorSyntaxContext context ,
11891188 TypeMapper typeMapper ,
11901189 Func < ISymbol , bool > isManagedOnlyType ,
11911190 Func < ISymbol , TypeMapper , bool > isWinRTType ,
1192- Func < ISymbol , bool > isWinRTClass )
1191+ Func < ISymbol , bool , bool > isWinRTClassOrInterface )
11931192 {
11941193 HashSet < ITypeSymbol > visitedTypes = new ( SymbolEqualityComparer . Default ) ;
11951194 HashSet < VtableAttribute > vtableAttributes = new ( ) ;
@@ -1203,7 +1202,7 @@ private static EquatableArray<VtableAttribute> GetVtableAttributesToAddOnLookupT
12031202 // and end up calling a projection function (i.e. ones generated by XAML compiler)
12041203 // In theory, another library can also be called which can call a projected function
12051204 // but not handling those scenarios for now.
1206- ( isWinRTClass ( methodSymbol . ContainingSymbol ) ||
1205+ ( isWinRTClassOrInterface ( methodSymbol . ContainingSymbol , true ) ||
12071206 SymbolEqualityComparer . Default . Equals ( methodSymbol . ContainingAssembly , context . SemanticModel . Compilation . Assembly ) ) )
12081207 {
12091208 // Get the concrete types directly from the argument rather than
@@ -1232,13 +1231,14 @@ private static EquatableArray<VtableAttribute> GetVtableAttributesToAddOnLookupT
12321231 {
12331232 var leftSymbol = context . SemanticModel . GetSymbolInfo ( assignment . Left ) . Symbol ;
12341233 if ( leftSymbol is IPropertySymbol propertySymbol &&
1235- ( isWinRTClass ( propertySymbol . ContainingSymbol ) ||
1234+ ( isWinRTClassOrInterface ( propertySymbol . ContainingSymbol , true ) ||
12361235 SymbolEqualityComparer . Default . Equals ( propertySymbol . ContainingAssembly , context . SemanticModel . Compilation . Assembly ) ) )
12371236 {
12381237 AddVtableAttributesForType ( context . SemanticModel . GetTypeInfo ( assignment . Right ) , propertySymbol . Type ) ;
12391238 }
12401239 else if ( leftSymbol is IFieldSymbol fieldSymbol &&
1241- ( isWinRTClass ( fieldSymbol . ContainingSymbol ) ||
1240+ // WinRT interfaces don't have fields, so we don't need to check for them.
1241+ ( isWinRTClassOrInterface ( fieldSymbol . ContainingSymbol , false ) ||
12421242 SymbolEqualityComparer . Default . Equals ( fieldSymbol . ContainingAssembly , context . SemanticModel . Compilation . Assembly ) ) )
12431243 {
12441244 AddVtableAttributesForType ( context . SemanticModel . GetTypeInfo ( assignment . Right ) , fieldSymbol . Type ) ;
@@ -1423,7 +1423,7 @@ private static EquatableArray<VtableAttribute> GetVtableAttributesToAddOnLookupT
14231423 bool isCsWinRTComponent )
14241424 {
14251425 var isManagedOnlyType = GeneratorHelper . IsManagedOnlyType ( context . SemanticModel . Compilation ) ;
1426- var isWinRTType = ! isCsWinRTComponent ? GeneratorHelper . IsWinRTType : GeneratorHelper . IsWinRTTypeWithPotentialAuthoringComponentTypesFunc ( context . SemanticModel . Compilation ) ;
1426+ var isWinRTType = GeneratorHelper . IsWinRTType ( context . SemanticModel . Compilation , isCsWinRTComponent ) ;
14271427 HashSet < VtableAttribute > vtableAttributes = new ( ) ;
14281428
14291429 foreach ( var attributeData in context . Attributes )
0 commit comments