protected override void ReadSymbol(IMethodSymbol methodSymbol) { // we don't need to know about static members // because they won't be delegated from child to mixin if (methodSymbol.IsStatic) return; // skip methods that are not visible to the outside world if (methodSymbol.DeclaredAccessibility == Accessibility.Private || methodSymbol.DeclaredAccessibility == Accessibility.Protected) return; // skip all property accessors and ctors if (methodSymbol.MethodKind == MethodKind.Ordinary) { var isOverrideFromObject = methodSymbol.IsOverride && methodSymbol.OverriddenMethod ?.ContainingType.SpecialType == SpecialType.System_Object; var method = new Method( methodSymbol.Name, methodSymbol.ReturnType, isOverrideFromObject) { IsAbstract = methodSymbol.IsAbstract, IsOverride = methodSymbol.IsOverride, IsInternal = methodSymbol.DeclaredAccessibility.HasFlag(Accessibility.Internal), Documentation = new DocumentationComment(methodSymbol.GetDocumentationCommentXml()) }; var parameterReader = new ParameterSymbolReader(method); parameterReader.VisitSymbol(methodSymbol); _methods.AddMethod(method); } }
protected override void ReadSymbol(IPropertySymbol propertySymbol) { // we don't need to know about static members // because they won't be delegated from child to mixin if (propertySymbol.IsStatic) return; // we ignore private and protected memebers var hasGetter = propertySymbol.GetMethod != null && !(propertySymbol.GetMethod.DeclaredAccessibility == Accessibility.Private || propertySymbol.GetMethod.DeclaredAccessibility == Accessibility.Protected); var hasSetter = propertySymbol.SetMethod != null && !(propertySymbol.SetMethod.DeclaredAccessibility == Accessibility.Private || propertySymbol.SetMethod.DeclaredAccessibility == Accessibility.Protected); // property has no accessors or accessors are not accessible => skip property if (!hasSetter && !hasGetter) return; Property property = null; if (propertySymbol.IsIndexer) // symbol is an indexer property { var indexerProperty = new IndexerProperty( propertySymbol.Type, hasGetter, hasSetter); var parameterReader = new ParameterSymbolReader(indexerProperty); parameterReader.VisitSymbol(propertySymbol); property = indexerProperty; } else // symbol is a normal property { property = new Property( propertySymbol.Name, propertySymbol.Type, hasGetter, hasSetter); } property.IsAbstract = propertySymbol.IsAbstract; property.IsOverride = propertySymbol.IsOverride; // store information if accessors are internal, // we will need this for the generation later property.IsGetterInternal = hasGetter && propertySymbol.GetMethod .DeclaredAccessibility.HasFlag(Accessibility.Internal); property.IsSetterInternal = hasSetter && propertySymbol.SetMethod .DeclaredAccessibility.HasFlag(Accessibility.Internal); property.Documentation = new DocumentationComment(propertySymbol.GetDocumentationCommentXml()); _properties.AddProperty(property); }