本文整理汇总了C#中ITypeSymbol.GetIdentifier方法的典型用法代码示例。如果您正苦于以下问题:C# ITypeSymbol.GetIdentifier方法的具体用法?C# ITypeSymbol.GetIdentifier怎么用?C# ITypeSymbol.GetIdentifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITypeSymbol
的用法示例。
在下文中一共展示了ITypeSymbol.GetIdentifier方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateSDType
private SDType CreateSDType(ITypeSymbol typeSymbol, INamespaceSymbol namespaceSymbol)
{
var sdNamespace = new SDNamespace(namespaceSymbol.GetIdentifier()) { IsProjectStranger = true };
var sdType = new SDType(typeSymbol.GetIdentifier(), typeSymbol.Name, sdNamespace)
{
Accessibility = typeSymbol.DeclaredAccessibility.ToString().ToLower(),
IsAbstract = typeSymbol.IsAbstract,
IsReferenceType = typeSymbol.IsReferenceType,
IsSealed = typeSymbol.IsSealed,
IsStatic = typeSymbol.IsStatic,
IsProjectStranger = true,
Kind = typeSymbol.TypeKind.ToString().ToLower()
};
return sdType;
}
示例2: GetParsedType
internal SDType GetParsedType(ITypeSymbol typeSymbol, bool isProjectStranger = true)
{
var parsedType = ParserOptions.SDRepository.GetTypeByIdentifier(typeSymbol.GetIdentifier());
if (parsedType == null)
{
parsedType = CreateSDType(typeSymbol, isProjectStranger);
ParseForeignTypeToModel(parsedType, typeSymbol);
}
if (!isProjectStranger)
{
ParseTypeToModel(parsedType, typeSymbol);
}
return parsedType;
}
示例3: GetParsedType
public SDType GetParsedType(TypeRefParser typeRefParser, ITypeSymbol typeSymbol, INamespaceSymbol namespaceSymbol)
{
var sdType = ParserOptions.SDRepository.GetTypeByIdentifier(typeSymbol.GetIdentifier());
if (sdType == null)
{
sdType = CreateSDType(typeSymbol, namespaceSymbol);
ParserOptions.SDRepository.AddType(sdType);
var namedTypeSymbol = typeSymbol as INamedTypeSymbol;
if (namedTypeSymbol != null)
{
foreach (var typeArgument in namedTypeSymbol.TypeArguments)
{
sdType.TypeArguments.Add(typeRefParser.GetParsedTypeReference(typeArgument));
}
}
}
return sdType;
}
示例4: CreateSDType
private SDType CreateSDType(ITypeSymbol typeSymbol, bool isProjectStranger)
{
SDNamespace sdNamespace = null;
if (typeSymbol is IArrayTypeSymbol)
{
sdNamespace = ParserOptions.SDRepository.GetNamespaceByIdentifier(((IArrayTypeSymbol)typeSymbol).ElementType.ContainingNamespace.GetIdentifier());
sdNamespace = sdNamespace ?? new SDNamespace(((IArrayTypeSymbol)typeSymbol).ElementType.ContainingNamespace.GetIdentifier()) { IsProjectStranger = true };
}
else
{
sdNamespace = ParserOptions.SDRepository.GetNamespaceByIdentifier(typeSymbol.ContainingNamespace.GetIdentifier());
sdNamespace = sdNamespace ?? new SDNamespace(typeSymbol.ContainingNamespace.GetIdentifier()) { IsProjectStranger = true };
}
var sdType = new SDType(typeSymbol.GetIdentifier(), typeSymbol.Name, sdNamespace)
{
Accessibility = typeSymbol.DeclaredAccessibility.ToString().ToLower(),
IsAbstract = typeSymbol.IsAbstract,
IsReferenceType = typeSymbol.IsReferenceType,
IsSealed = typeSymbol.IsSealed,
IsStatic = typeSymbol.IsStatic,
IsProjectStranger = isProjectStranger,
Kind = typeSymbol.TypeKind.ToString().ToLower()
};
var declaringReferences = !isProjectStranger ? typeSymbol.DeclaringSyntaxReferences.ToList() : new List<SyntaxReference>();
foreach (var reference in declaringReferences)
{
var region = new SDRegion
{
Start = reference.Span.Start,
End = reference.Span.End,
Filename = reference.SyntaxTree.FilePath
};
sdType.Regions.Add(region);
}
ParserOptions.SDRepository.AddType(sdType);
return sdType;
}