public void CreationTest(string name, EncapsulationLevel encapsulationLevel) { var fb = new MetaFieldBuilder(name); fb.EncapsulationLevel = encapsulationLevel; fb.SetType(MetaType.Boolean); var field = fb.Build(); Assert.AreEqual(field.Name, name); Assert.AreEqual(field.EncapsulationLevel, encapsulationLevel); Assert.AreEqual(field.Type, MetaType.Boolean); Assert.AreEqual(field.Module, null); }
public WrapsAndChangesAttribute( Type wrappedType, WrappedItemsKind wrappedItemsKind, string name, string wrapperName = null, EncapsulationLevel wrapperEncapsulationLevel = EncapsulationLevel.Unknown ) { this.WrappedType = wrappedType; this.TheWrapItemsKind = wrappedItemsKind; this.Name = name; this.WrapperName = wrapperName; this.WrapperEncapsulationLevel = wrapperEncapsulationLevel; }
public static MemberAttributes GetFlags(this ISymbol symbol, EncapsulationLevel encapsulationLevel) { MemberAttributes attrs = MemberAttributes.Final; if (symbol.IsVirtual) attrs = MemberAttributes.VTableMask; else if (symbol.IsAbstract) attrs = MemberAttributes.Abstract; if (symbol.IsStatic) attrs |= MemberAttributes.Static; //if (symbol.IsOverride) // attrs |= MemberAttributes.Override; // if encapsulationLevel is unknown, we set the // generated encapsulationLevel to that of the wrapped symbol if (encapsulationLevel == EncapsulationLevel.Unknown) { switch (symbol.DeclaredAccessibility) { case Accessibility.Internal: attrs |= MemberAttributes.Assembly; break; case Accessibility.Private: attrs |= MemberAttributes.Private; break; case Accessibility.Protected: attrs |= MemberAttributes.Family; break; case Accessibility.Public: attrs |= MemberAttributes.Public; break; case Accessibility.ProtectedAndInternal: attrs |= MemberAttributes.FamilyAndAssembly; break; case Accessibility.ProtectedOrInternal: attrs |= MemberAttributes.FamilyOrAssembly; break; } } else { attrs |= encapsulationLevel.GetFlags(); } return attrs; }