Skip to content

Commit

Permalink
Merge pull request #156 from FmgLib/155-readonly-lists-it-needs-to-be…
Browse files Browse the repository at this point in the history
…-ignored

An error was fixed in the codes generated for ReadOnly lists.
  • Loading branch information
gonultasmf authored Nov 24, 2024
2 parents 81c38f7 + a13576b commit d39a12f
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.CodeAnalysis;

using System;
using System.Collections;
using System.Collections.Generic;
Expand Down Expand Up @@ -109,23 +110,23 @@ void GenerateClassExtensionBody()
(_.Type.Name.Contains(nameof(IList)) || _.Type.AllInterfaces.Any(e => e.Name.Contains(nameof(IList))) || _.Type.Name.Contains(nameof(ICollection)) || _.Type.AllInterfaces.Any(e => e.Name.Contains(nameof(ICollection)))) &&
_.Type.AllInterfaces.Any(e => e.Name.Contains(nameof(IEnumerable))) &&
!_.Type.Name.Equals(nameof(String), StringComparison.InvariantCultureIgnoreCase))
.Where(_ => !(_.Type.Name.Contains("IReadOnlyList") || _.Type.AllInterfaces.Any(e => e.Name.Contains("IReadOnlyList"))))
.ToList();



var events = mainSymbol
.GetMembers()
.Where(_ => _.Kind == SymbolKind.Event)
.Where(_ => _.DeclaredAccessibility == Accessibility.Public)
.Cast<IEventSymbol>()
.Where(_ => !_.Name.Contains('.'))
.Where(_ => (_.ContainingType is INamedTypeSymbol namedTypeSymbol) && namedTypeSymbol.GetFullyQualifiedName() == mainSymbol.GetFullyQualifiedName())
.Where(_ => !_.GetAttributes().Any(_ => _.AttributeClass.EnsureNotNull().Equals(editorBrowsableAttribute, SymbolEqualityComparer.Default)))
.Where(_ => !_.GetAttributes().Any(_ => _.AttributeClass.EnsureNotNull().Name == "ObsoleteAttribute" || _.AttributeClass.EnsureNotNull().Name == "Obsolete"))
.GroupBy(_ => _.Name, StringComparer.OrdinalIgnoreCase)
.Select(_ => _.First())
.OrderBy(_ => _.Name)
.ToArray();
var events = mainSymbol
.GetMembers()
.Where(_ => _.Kind == SymbolKind.Event)
.Where(_ => _.DeclaredAccessibility == Accessibility.Public)
.Cast<IEventSymbol>()
.Where(_ => !_.Name.Contains('.'))
.Where(_ => (_.ContainingType is INamedTypeSymbol namedTypeSymbol) && namedTypeSymbol.GetFullyQualifiedName() == mainSymbol.GetFullyQualifiedName())
.Where(_ => !_.GetAttributes().Any(_ => _.AttributeClass.EnsureNotNull().Equals(editorBrowsableAttribute, SymbolEqualityComparer.Default)))
.Where(_ => !_.GetAttributes().Any(_ => _.AttributeClass.EnsureNotNull().Name == "ObsoleteAttribute" || _.AttributeClass.EnsureNotNull().Name == "Obsolete"))
.GroupBy(_ => _.Name, StringComparer.OrdinalIgnoreCase)
.Select(_ => _.First())
.OrderBy(_ => _.Name)
.ToArray();

if (attachedModel == null)
{
Expand Down Expand Up @@ -243,7 +244,7 @@ void GenerateExtensionMethod(IPropertySymbol propertySymbol, bool isOnlyList = f
GenerateExtensionMethod_AnimateTo(info, "ColorTransform");
}
}

isGeneratedExtension = true;
}
}
Expand Down

0 comments on commit d39a12f

Please sign in to comment.