本文整理汇总了C#中INamedTypeSymbol.GetTypeMembers方法的典型用法代码示例。如果您正苦于以下问题:C# INamedTypeSymbol.GetTypeMembers方法的具体用法?C# INamedTypeSymbol.GetTypeMembers怎么用?C# INamedTypeSymbol.GetTypeMembers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类INamedTypeSymbol
的用法示例。
在下文中一共展示了INamedTypeSymbol.GetTypeMembers方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitNamedType
public override void VisitNamedType(INamedTypeSymbol symbol)
{
foreach (var childSymbol in symbol.GetTypeMembers())
{
childSymbol.Accept(this);
}
}
示例2: VisitNamedType
public override void VisitNamedType(INamedTypeSymbol symbol)
{
if (IsUnimportantSymbol(symbol))
return;
PrettyPrint(symbol);
tabCount++;
foreach (var childSymbol in symbol.GetTypeMembers())
{
childSymbol.Accept(this);
}
tabCount--;
}
示例3: VisitNamedType
public override void VisitNamedType(INamedTypeSymbol symbol)
{
if (_finished || _symbolPredicate == null || _symbolPredicate(symbol))
{
MetadataItems metadata = new MetadataItems
{
{ CodeAnalysisKeys.SpecificKind, (k, m) => symbol.TypeKind.ToString() },
{ CodeAnalysisKeys.ContainingType, DocumentFor(symbol.ContainingType) },
{ CodeAnalysisKeys.MemberTypes, DocumentsFor(symbol.GetTypeMembers()) },
{ CodeAnalysisKeys.BaseType, DocumentFor(symbol.BaseType) },
{ CodeAnalysisKeys.AllInterfaces, DocumentsFor(symbol.AllInterfaces) },
{ CodeAnalysisKeys.Members, DocumentsFor(symbol.GetMembers().Where(MemberPredicate)) },
{ CodeAnalysisKeys.Constructors,
DocumentsFor(symbol.Constructors.Where(x => !x.IsImplicitlyDeclared)) },
{ CodeAnalysisKeys.TypeParameters, DocumentsFor(symbol.TypeParameters) },
{ CodeAnalysisKeys.Accessibility, (k, m) => symbol.DeclaredAccessibility.ToString() }
};
if (!_finished)
{
metadata.AddRange(new []
{
new MetadataItem(CodeAnalysisKeys.DerivedTypes, (k, m) => GetDerivedTypes(symbol), true),
new MetadataItem(CodeAnalysisKeys.ImplementingTypes, (k, m) => GetImplementingTypes(symbol), true)
});
}
AddDocument(symbol, true, metadata);
// Descend if not finished, and only if this type was included
if (!_finished)
{
Parallel.ForEach(symbol.GetMembers()
.Where(MemberPredicate)
.Concat(symbol.Constructors.Where(x => !x.IsImplicitlyDeclared)),
s => s.Accept(this));
}
}
}
示例4: VisitNamedType
public override void VisitNamedType(INamedTypeSymbol symbol)
{
base.VisitNamedType(symbol);
foreach (var item in symbol.GetMembers())
{
item.Accept(this);
}
foreach (var item in symbol.GetTypeMembers())
{
item.Accept(this);
}
}
示例5: LookupType
static INamedTypeSymbol LookupType (string documentationCommentId, int reminder, INamedTypeSymbol current)
{
var idx = documentationCommentId.IndexOf ('.', reminder);
var exact = idx < 0;
var typeId = current.GetDocumentationCommentId ();
if (exact) {
if (typeId == documentationCommentId)
return current;
return null;
}
if (typeId.Length < reminder)
return null;
if (string.CompareOrdinal (documentationCommentId, reminder, typeId, reminder, idx - reminder - 1) == 0) {
if (typeId.Length > idx)
return null;
foreach (var subType in current.GetTypeMembers ()) {
var child = LookupType (documentationCommentId, idx + 1, subType);
if (child != null) {
return child;
}
}
return current;
}
return null;
}
示例6: HasInstantiatedNestedType
private bool HasInstantiatedNestedType(INamedTypeSymbol type, IEnumerable<INamedTypeSymbol> instantiatedTypes)
{
// We don't care whether a private nested type is instantiated, because if it
// is, it can only have happened within the type itself.
IEnumerable<INamedTypeSymbol> nestedTypes = type.GetTypeMembers()
.Where(member => member.DeclaredAccessibility != Accessibility.Private);
foreach (var nestedType in nestedTypes)
{
if (instantiatedTypes.Contains(nestedType))
{
return true;
}
if (HasInstantiatedNestedType(nestedType, instantiatedTypes))
{
return true;
}
}
return false;
}
示例7: ScanType
private static void ScanType(IList<Diagnostic> diagnostics, INamedTypeSymbol typeSymbol)
{
if (typeSymbol.Locations.Any(location => location.IsInSource))
{
RuleFieldPrivateKeyword(diagnostics, typeSymbol);
RuleMembersAreInCorrectOrder(diagnostics, typeSymbol, MapClassMembers);
}
foreach (var member in typeSymbol.GetTypeMembers())
{
ScanType(diagnostics, member);
}
}
示例8: ParseTheProjectType
private void ParseTheProjectType(INamedTypeSymbol typeSymbol)
{
var sdNamespace = ParserOptions.SDRepository.GetNamespaceByIdentifier(typeSymbol.ContainingNamespace.GetIdentifier());
var sdType = ParserOptions.SDRepository.GetTypeByIdentifier(typeSymbol.GetIdentifier());
if (sdType == null)
{
sdType = CreateSDType(typeSymbol, sdNamespace);
sdNamespace.Types.Add(sdType);
ParserOptions.SDRepository.AddType(sdType);
}
else // already parsed as stranger
{
sdType.Namespace = ParserOptions.SDRepository.GetNamespaceByIdentifier(typeSymbol.ContainingNamespace.GetIdentifier());
sdType.Regions = GetRegions(typeSymbol);
sdType.IsProjectStranger = false;
if(!sdNamespace.Types.Contains(sdType)) sdNamespace.Types.Add(sdType);
}
sdType.Documentations = DocumentationParser.ParseDocumentation(typeSymbol);
AddParsedBaseType(sdType, typeSymbol.BaseType);
AddParsedInterfaces(sdType, typeSymbol.Interfaces);
AddParsedNestedTypes(sdType, typeSymbol.GetTypeMembers());
_propertyParser.ParseProperties(sdType, typeSymbol);
_fieldParser.ParseFields(sdType, typeSymbol);
_methodParser.ParseConstructors(sdType, typeSymbol);
_methodParser.ParseMethods(sdType, typeSymbol);
_eventParser.ParseEvents(sdType, typeSymbol);
sdType.TypeParameters = _typeParameterParser.ParseTypeParameters(typeSymbol.TypeParameters);
foreach (var typeArgument in typeSymbol.TypeArguments)
{
sdType.TypeArguments.Add(_typeRefParser.GetParsedTypeReference(typeArgument));
}
}