本文整理汇总了C#中INamespaceSymbol.FullNameEquals方法的典型用法代码示例。如果您正苦于以下问题:C# INamespaceSymbol.FullNameEquals方法的具体用法?C# INamespaceSymbol.FullNameEquals怎么用?C# INamespaceSymbol.FullNameEquals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类INamespaceSymbol
的用法示例。
在下文中一共展示了INamespaceSymbol.FullNameEquals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MapGlobalTypes
internal static void MapGlobalTypes(NamespaceInfoMap nsInfoMap, INamespaceSymbol nsSymbol)
{
if (!nsSymbol.IsGlobalNamespace)
{
foreach (var nsInfo in nsInfoMap.Values)
{
if (nsSymbol.FullNameEquals(nsInfo.DottedName.NameParts))
{
var typeSymbolList = nsSymbol.GetMembers().OfType<INamedTypeSymbol>().Where(i => i.TypeKind == Microsoft.CodeAnalysis.TypeKind.Class).ToList();
for (var i = 0; i < typeSymbolList.Count;)
{
var typeSymbol = typeSymbolList[i];
var clsAttData = typeSymbol.GetAttributeData(SchemaClassAttributeNameParts);
if (clsAttData != null)
{
if (typeSymbol.IsGenericType)
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.SchemaClassCannotBeGeneric), GetTextSpan(typeSymbol));
}
if (typeSymbol.IsStatic)
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.SchemaClassCannotBeStatic), GetTextSpan(typeSymbol));
}
var clsName = GetFirstArgumentAsString(clsAttData);
if (clsName == null)
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.InvalidSchemaClassAttribute), GetTextSpan(clsAttData));
}
var clsInfo = nsInfo.TryGetGlobalType<ClassTypeInfo>(clsName);
if (clsInfo == null)
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.InvalidSchemaClassAttributeName, clsName), GetTextSpan(clsAttData));
}
if (clsInfo.Symbol != null)
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.DuplicateSchemaClassAttributeName, clsName), GetTextSpan(clsAttData));
}
if (!clsInfo.IsAbstract)
{
if (typeSymbol.IsAbstract)
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.NonAbstractSchemaClassRequired),
GetTextSpan(typeSymbol));
}
if (!typeSymbol.HasParameterlessConstructor())
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.ParameterlessConstructorRequired),
GetTextSpan(typeSymbol));
}
}
clsInfo.Symbol = typeSymbol;
typeSymbolList.RemoveAt(i);
continue;
}
++i;
}
foreach (var typeSymbol in typeSymbolList)
{
if (!typeSymbol.IsGenericType)
{
var clsName = typeSymbol.Name;
var clsInfo = nsInfo.TryGetGlobalType<ClassTypeInfo>(clsName);
if (clsInfo != null)
{
if (clsInfo.Symbol == null)
{
if (typeSymbol.IsStatic)
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.SchemaClassCannotBeStatic), GetTextSpan(typeSymbol));
}
if (!clsInfo.IsAbstract)
{
if (typeSymbol.IsAbstract)
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.NonAbstractSchemaClassRequired),
GetTextSpan(typeSymbol));
}
if (!typeSymbol.HasParameterlessConstructor())
{
CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.ParameterlessConstructorRequired),
GetTextSpan(typeSymbol));
}
}
clsInfo.Symbol = typeSymbol;
}
}
}
}
}
}
}
foreach (var subNsSymbol in nsSymbol.GetNamespaceMembers())
{
MapGlobalTypes(nsInfoMap, subNsSymbol);
}
}