public static GeneratedTypesVisibility ToGeneratedTypesVisibility(this MemberAttributes ma) { if (ma.HasFlag(MemberAttributes.Family) || ma.HasFlag(MemberAttributes.FamilyAndAssembly) || ma.HasFlag(MemberAttributes.FamilyOrAssembly) || ma.HasFlag(MemberAttributes.Private)) { return(GeneratedTypesVisibility.Internal); } return(GeneratedTypesVisibility.Public); }
private void OutputFieldScopeModifier(MemberAttributes attributes) { attributes &= MemberAttributes.ScopeMask; if (attributes.HasFlag(MemberAttributes.Static)) { output.Write("static "); } if (attributes != MemberAttributes.ScopeMask && (attributes.HasFlag(MemberAttributes.Final) || attributes.HasFlag(MemberAttributes.Const))) { output.Write("final "); } }
private static string ConvertCaseFormating(MemberAttributes attributes, string nameString) { var token = attributes.HasFlag(MemberAttributes.Public) ? nameString.ToPascalCase().ToAlphaNumericToken() : nameString.ToCamelCase().ToAlphaNumericToken(); return(token); }
private void OutputMemberScopeModifier(MemberAttributes attributes) { attributes &= MemberAttributes.ScopeMask; bool canBeAbstract = true; if (attributes.HasFlag(MemberAttributes.Static)) { output.Write("static "); canBeAbstract = false; } if (attributes != MemberAttributes.ScopeMask && attributes.HasFlag(MemberAttributes.Final)) { output.Write("final "); canBeAbstract = false; } if (canBeAbstract && attributes.HasFlag(MemberAttributes.Abstract)) { output.Write("abstract "); } }
private static IReadOnlyList <MemberInfo> FilterMembersHavingAttributes( this IReadOnlyList <MemberInfo> members, MemberAttributes memberAttributes) { IReadOnlyList <MemberInfo> result; if (memberAttributes == MemberAttributes.None) { // no-op; no members to add result = new List <MemberInfo>(); } else if (memberAttributes == MemberAttributes.All) { // shortcut for performance result = members; } else { var filteredMembers = new List <MemberInfo>(); foreach (var member in members) { var memberIsCompilerGenerated = member.IsCompilerGenerated(); var includeMember = (memberAttributes.HasFlag(MemberAttributes.CompilerGenerated) && memberIsCompilerGenerated) || (memberAttributes.HasFlag(MemberAttributes.NotCompilerGenerated) && (!memberIsCompilerGenerated)); if (includeMember) { filteredMembers.Add(member); } } result = filteredMembers; } return(result); }