mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 17:28:27 -04:00
Restructured the project structure back to the way it was, there's no reasonable way to split the modules
This commit is contained in:
23
src/NadekoBot.Generators/Cloneable/SymbolExtensions.cs
Normal file
23
src/NadekoBot.Generators/Cloneable/SymbolExtensions.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
// Code temporarily yeeted from
|
||||
// https://github.com/mostmand/Cloneable/blob/master/Cloneable/CloneableGenerator.cs
|
||||
// because of NRT issue
|
||||
|
||||
using Microsoft.CodeAnalysis;
|
||||
|
||||
namespace Cloneable
|
||||
{
|
||||
internal static class SymbolExtensions
|
||||
{
|
||||
public static bool TryGetAttribute(this ISymbol symbol, INamedTypeSymbol attributeType,
|
||||
out IEnumerable<AttributeData> attributes)
|
||||
{
|
||||
attributes = symbol.GetAttributes()
|
||||
.Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, attributeType));
|
||||
return attributes.Any();
|
||||
}
|
||||
|
||||
public static bool HasAttribute(this ISymbol symbol, INamedTypeSymbol attributeType)
|
||||
=> symbol.GetAttributes()
|
||||
.Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, attributeType));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user