Пример #1
0
        public ThinMember(ThinType declaringType, string memberName, string returnType, MemberTypes memberType,
                          IncludeStatus includeStatus, ITypeDefinitionMember memberNode, VisibilityOverride visibility)

            : this(declaringType, memberName, returnType, memberType,
                   includeStatus, memberNode, visibility, SecurityTransparencyStatus.Transparent)
        {
        }
Пример #2
0
        public TrimAssembly(string assemblyName, IncludeStatus status)
        {
            _name          = assemblyName;
            _includeStatus = status;

            _types          = new Dictionary <string, TypeElement>();
            _typeForwarders = new Dictionary <string, TypeForwarderElement>();
        }
Пример #3
0
        internal CodeAssemblyElement(IncludeStatus includeStatus, string key)
        {
            m_types          = new Dictionary <string, TypeElement>();
            m_typeForwarders = new Dictionary <string, TypeForwarderElement>();

            _includeStatus = includeStatus;
            _key           = key;
        }
Пример #4
0
 public TrimType(String typeName, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus)
 {
     _typeName                   = typeName;
     _typeMembers                = new Dictionary <string, MemberElement>();
     _includeStatus              = includeStatus;
     _visibilityOverride         = visibilityOverride;
     _securityTransparencyStatus = securityTransparencyStatus;
 }
Пример #5
0
        internal CodeTypeElement(IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus, string key)
        {
            m_members = new Dictionary <string, MemberElement>();

            _includeStatus              = includeStatus;
            _visibilityOverride         = visibilityOverride;
            _securityTransparencyStatus = securityTransparencyStatus;
            _key = key;
        }
Пример #6
0
 public CodeMemberElement(IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus, string key, string returnType, MemberTypes memberType, string name)
 {
     _includeStatus              = includeStatus;
     _visibilityOverride         = visibilityOverride;
     _securityTransparencyStatus = securityTransparencyStatus;
     _key        = key;
     _returnType = returnType;
     _memberType = memberType;
     _name       = name;
 }
Пример #7
0
        public override MemberElement CreateMemberElement(TypeElement type, string memberName, string returnType, MemberTypes memberType, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus)
        {
            // Identify the member by category (method/prop/field/event), name, and return type.  These
            // strings are what matched by ModelSigFormatter

            string memberSig = memberType.ToString() + " : " + memberName;
            if (returnType != null) memberSig = memberSig + " : " + returnType;

            CodeMemberElement member = new CodeMemberElement(includeStatus, visibilityOverride, securityTransparencyStatus, memberSig, returnType, memberType, memberName);
            (type as CodeTypeElement).m_members.Add(memberSig, member);
            return member;
        }
Пример #8
0
        public ThinMember(ThinType declaringType, ThinMember memberToCopy)
        {
            _declaringType = declaringType;

            _memberNode = memberToCopy._memberNode;
            _memberFullName = memberToCopy._memberFullName;
            _returnType = memberToCopy._returnType;
            _memberType = memberToCopy._memberType;
            _includeStatus = memberToCopy._includeStatus;
            _visibility = memberToCopy._visibility;
            _securityTransparencyStatus = memberToCopy._securityTransparencyStatus;

            CheckVisibility();
        }
Пример #9
0
 public TrimMember(TrimType declaringType, string memberName, string returnType, /*string paramListString, */ MemberTypes memberType, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus)
 {
     _declaringType = declaringType;
     _memberName    = memberName;
     _returnType    = returnType;
     _memberType    = memberType;
     _includeStatus = includeStatus;
     _securityTransparencyStatus = securityTransparencyStatus;
     //_paramListString = paramListString;
     //if (null == paramListString)
     //    _paramQualifiedTypeNames = new List<string>();
     //else
     //    _paramQualifiedTypeNames = SplitParameterList(paramListString);
     _visibilityOverride = visibilityOverride;
 }
Пример #10
0
        public ThinMember(ThinType declaringType, string memberName, string returnType, MemberTypes memberType,
                          IncludeStatus includeStatus, ITypeDefinitionMember memberNode, VisibilityOverride visibility,
                          SecurityTransparencyStatus securityTransparencyStatus)
        {
            _memberNode = memberNode;
            _declaringType = declaringType;
            _returnType = returnType;
            _memberType = memberType;
            _includeStatus = includeStatus;
            _visibility = visibility;
            _securityTransparencyStatus = securityTransparencyStatus;

            _memberFullName = memberName;

            CheckVisibility();
        }
Пример #11
0
        private void ImportWorker(IncludeStatus statusToImport, AddAssembly addAssembly, AddType addType, AddTypeForwarder addTypeForwarder, AddMember addMember)
        {
            foreach (ThinAssembly assembly in _thinModel.Assemblies.Values)
            {
                if (assembly.IncludeStatus == statusToImport)
                {
                    addAssembly(assembly);
                }

                foreach (ThinTypeForwarder typeForwarder in assembly.TypeForwarders.Values)
                {
                    if (typeForwarder.IncludeStatus == statusToImport)
                    {
                        // Assembly may not have already been added because they might not have the correct IncludedStatus.
                        addAssembly(assembly);
                        addTypeForwarder(typeForwarder);
                    }
                }

                foreach (ThinType type in assembly.Types.Values)
                {
                    if (type.IncludeStatus == statusToImport)
                    {
                        // Assembly may not have already been added because they might not have the correct IncludedStatus.
                        addAssembly(assembly);
                        addType(type);
                    }

                    foreach (ThinMember member in type.Members.Values)
                    {
                        if (member.IncludeStatus == statusToImport)
                        {
                            // Assembly and Type may not have already been added because they might not have the correct IncludedStatus.
                            addAssembly(assembly);
                            addType(type);
                            addMember(member);
                        }
                    }
                }
            }
        }
Пример #12
0
        public ThinMember(ThinType declaringType, ITypeDefinitionMember member, IncludeStatus includeStatus, VisibilityOverride visibility)
        {
            _declaringType = declaringType;

            _memberNode = member;
            _memberType = Util.TypeMemberType(member);
            _returnType = Util.GetConversionOperatorReturnType(member);
            _memberFullName = Util.GetMemberSignature(member, false);

            // Remove the trailing return type for conversion operators
            if (_returnType != null)
            {
                string suffix = " : " + _returnType;
                if (_memberFullName.EndsWith(suffix))
                    _memberFullName = _memberFullName.Substring(0, _memberFullName.Length - suffix.Length);
            }

            _includeStatus = includeStatus;
            _visibility = visibility;
            _securityTransparencyStatus = SecurityTransparencyStatus.Transparent;

            CheckVisibility();
        }
Пример #13
0
        // Special case: If closureStatus == ApiRoot this will automatically
        // convert it to ImplRoot for internal types
        // TODO: Visitor should set status instead of this.
        public ThinModel ExportModel(IncludeStatus closureStatus)
        {
            _closureStatus = closureStatus;

            int nApiTypes = 0;
            int nApiTypeForwarders = 0;
            int nApiMembers = 0;

            ThinModel thinModel = new ThinModel(_thinModel.Options);
            Dictionary<String, ThinAssembly> assemblies = new Dictionary<String, ThinAssembly>(_depot.AssembliesClosure.Count);
            Dictionary<INamedTypeDefinition, ThinType> types = new Dictionary<INamedTypeDefinition, ThinType>(_depot.TypesClosure.Count);

            foreach (IAssembly assembly in _depot.AssembliesClosure.Values)
            {
                ThinAssembly thinAsm = new ThinAssembly(_thinModel, assembly.Name.Value, GetIncludeStatus(assembly), assembly);
                thinModel.Assemblies.Add(thinAsm.Name, thinAsm);
                assemblies.Add(assembly.Name.Value, thinAsm);
            }

            foreach (INamedTypeDefinition type in _depot.TypesClosure.Values)
            {
                IAssembly asm = TypeHelper.GetDefiningUnit(type) as IAssembly;
                if (asm != null && assemblies.ContainsKey(asm.Name.Value))
                {
                    VisibilityOverride vis = VisibilityOverride.None;
                    if (ShouldHideType(type))
                        vis = VisibilityOverride.Internal;

                    if (closureStatus != IncludeStatus.ApiRoot)
                    {
                        if (TypeIsVisibleInApi(type))
                        {
                            INamedTypeDefinition curType = type;
                            while (curType != null && curType != Dummy.Type && // TODO: Remove dummy check?
                                CanInclude(curType))
                            {
                                if (WeHidThisType(curType))
                                    throw new Exception("API closure error!  Base type " + curType + " was hidden, but " + type + " is in the public API");
                                ITypeReference curTypeRef = TypeHelper.BaseClass(curType);
                                curType = curTypeRef != null ? Util.CanonicalizeType(curTypeRef) : null;
                            }
                        }
                    }

                    ThinAssembly declaringAssembly = assemblies[asm.Name.Value];
                    ThinType thinType = new ThinType(declaringAssembly, Util.FullyQualifiedTypeNameFromType(type), GetIncludeStatus(type), type, vis);
                    declaringAssembly.Types.Add(thinType.Name, thinType);
                    types.Add(type, thinType);

                    if (thinType.IncludeStatus == IncludeStatus.ApiClosure ||
                        thinType.IncludeStatus == IncludeStatus.ApiRoot ||
                        thinType.IncludeStatus == IncludeStatus.ApiFxInternal)
                    {
                        nApiTypes++;
                    }
                }
                else
                {
                    Console.Error.WriteLine("BclRewriter : warning BR5004 : couldn't find declaring module of type {0} in closure", type);
                }
            }

            foreach (IAliasForType typeForwarder in _depot.TypeForwardersClosure.Values)
            {
                // TODO: Why is this getting an immutable copy of the assembly?
                IAssembly asm = Util.GetDefiningAssembly(typeForwarder);
                if (asm != null && assemblies.ContainsKey(asm.Name.Value))
                {
                    ThinAssembly declaringAssembly = assemblies[asm.Name.Value];
                    ITypeReference aliasedType = typeForwarder.AliasedType;
                    ThinTypeForwarder thinTypeForwarder = new ThinTypeForwarder(declaringAssembly,
                                                                                Util.GetDefiningAssembly(aliasedType).Name.Value,
                                                                                Util.GetTypeName(aliasedType),
                                                                                GetIncludeStatus(typeForwarder),
                                                                                typeForwarder);

                    declaringAssembly.TypeForwarders.Add(thinTypeForwarder.Key, thinTypeForwarder);

                    if (thinTypeForwarder.IncludeStatus == IncludeStatus.ApiClosure ||
                        thinTypeForwarder.IncludeStatus == IncludeStatus.ApiRoot ||
                        thinTypeForwarder.IncludeStatus == IncludeStatus.ApiFxInternal)
                    {
                        nApiTypeForwarders++;
                    }
                }
                else
                {
                    Console.Error.WriteLine("BclRewriter : warning BR5001 : couldn't find declaring module of type forwarder {0} in closure", typeForwarder);
                }
            }

            foreach (ITypeDefinitionMember member in _depot.MembersClosure.Keys)
            {
                INamedTypeDefinition type = Util.ContainingTypeDefinition(member);
                if (types.ContainsKey(type))
                {
                    ThinType declaringType = types[type];
                    IncludeStatus status = GetIncludeStatus(member);

                    VisibilityOverride vis = VisibilityOverride.None;
                    if (ShouldHideMember(member))
                        vis = VisibilityOverride.Internal;

                    if ((type.IsInterface) &&
                        TypeIsVisibleInApi(type) &&
                        vis == VisibilityOverride.Internal)
                    {
                        throw new Exception(string.Format("Implementation required non-public member on public interface: {0} on {1}. This usually means you added a property to model.xml without adding the corresponding getter or setter.",
                            member.Name,
                            Util.FullyQualifiedTypeNameFromType(member.ContainingType)));
                    }

                    ThinMember thinMember = new ThinMember(declaringType, member, status, vis);
                    declaringType.Members.Add(thinMember.Key, thinMember);

                    if (thinMember.IncludeStatus == IncludeStatus.ApiClosure ||
                        thinMember.IncludeStatus == IncludeStatus.ApiRoot ||
                        thinMember.IncludeStatus == IncludeStatus.ApiFxInternal)
                    {
                        nApiMembers++;
                    }
                }
                else
                {
                    Console.Error.WriteLine("BclRewriter : warning BR5002 : couldn't find declaring type of member {0} in closure", member);
                }
            }

            foreach (IMethodDefinition method in _depot.MethodsClosure.Values)
            {
                INamedTypeDefinition type = Util.ContainingTypeDefinition(method);
                if (types.ContainsKey(type))
                {
                    ThinType declaringType = types[type];
                    IncludeStatus status = GetIncludeStatus(method);

                    VisibilityOverride vis = VisibilityOverride.None;
                    if (ShouldHideMember(method))
                        vis = VisibilityOverride.Internal;

                    if ((type.IsInterface) &&
                        TypeIsVisibleInApi(type) &&
                        vis == VisibilityOverride.Internal)
                    {
                        //throw new Exception(string.Format("WARNING: implementation required non-public member on public interface: {0} on {1}. This usually means you added a property to model.xml without adding the corresponding getter or setter.",
                        //    method.Name, 
                        //    Util.FullyQualifiedTypeNameFromType(method.ContainingType)));
                    }

                    ThinMember thinMember = new ThinMember(declaringType, method, status, vis);
                    if (declaringType.Members.ContainsKey(thinMember.Key))
                    {
                        throw new Exception(String.Format("Found two members with the same signature: {0}", thinMember.Key));
                    }
                    declaringType.Members.Add(thinMember.Key, thinMember);

                    if (thinMember.IncludeStatus == IncludeStatus.ApiClosure ||
                        thinMember.IncludeStatus == IncludeStatus.ApiRoot ||
                        thinMember.IncludeStatus == IncludeStatus.ApiFxInternal)
                    {
                        nApiMembers++;
                    }
                }
                else
                {
                    Console.Error.WriteLine("BclRewriter : warning BR5003 : couldn't find declaring type of method {0} in closure", method);
                }
            }

            foreach (ThinMember thinMember in _missingMembers)
            {
                ThinType typeToExtend = types[thinMember.DeclaringType.Metadata];
                ThinMember newThinMember = new ThinMember(typeToExtend, thinMember);
                if (!typeToExtend.Members.ContainsKey(newThinMember.Key))
                    typeToExtend.Members.Add(newThinMember.Key, newThinMember);
            }

            return thinModel;
        }
Пример #14
0
        public override MemberElement CreateMemberElement(TypeElement type, string memberName, string returnType, MemberTypes memberType, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus)
        {
            TrimType typeInfo = (TrimType)type;

            TrimMember id = new TrimMember(typeInfo, memberName, returnType, /*paramListString, */memberType, includeStatus, visibilityOverride, securityTransparencyStatus);
            typeInfo.Members.Add(id.Key, id);
            return id;
        }
Пример #15
0
 public void ImportRoots(IncludeStatus rootType)
 {
     ImportWorker(rootType, AddRootAssembly, AddRootType, AddRootTypeForwarder, AddRootMember);
 }
Пример #16
0
 public TrimMember(TrimType declaringType, string memberName, string returnType, /*string paramListString, */MemberTypes memberType, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus)
 {
     _declaringType = declaringType;
     _memberName = memberName;
     _returnType = returnType;
     _memberType = memberType;
     _includeStatus = includeStatus;
     _securityTransparencyStatus = securityTransparencyStatus;
     //_paramListString = paramListString;
     //if (null == paramListString)
     //    _paramQualifiedTypeNames = new List<string>();
     //else
     //    _paramQualifiedTypeNames = SplitParameterList(paramListString);
     _visibilityOverride = visibilityOverride;
 }
Пример #17
0
        public override TypeElement CreateTypeElement(AssemblyElement assembly, string typeName, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus)
        {
            TrimAssembly trimAssembly = (TrimAssembly)assembly;

            TrimType typeIncludeInfo = new TrimType(typeName, includeStatus, visibilityOverride, securityTransparencyStatus);
            trimAssembly.Types.Add(typeIncludeInfo.Key, typeIncludeInfo);
            return typeIncludeInfo;
        }
Пример #18
0
 public static bool IsRoot(IncludeStatus status)
 {
     return ((status == IncludeStatus.ApiRoot) || (status == IncludeStatus.ImplRoot) || (status == IncludeStatus.ApiFxInternal));
 }
Пример #19
0
 public TrimType(String typeName, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus)
 {
     _typeName = typeName;
     _typeMembers = new Dictionary<string, MemberElement>();
     _includeStatus = includeStatus;
     _visibilityOverride = visibilityOverride;
     _securityTransparencyStatus = securityTransparencyStatus;
 }
Пример #20
0
        public override TypeElement CreateTypeElement(AssemblyElement assembly, string typeName, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus)
        {
            TrimAssembly trimAssembly = (TrimAssembly)assembly;

            TrimType typeIncludeInfo = new TrimType(typeName, includeStatus, visibilityOverride, securityTransparencyStatus);

            trimAssembly.Types.Add(typeIncludeInfo.Key, typeIncludeInfo);
            return(typeIncludeInfo);
        }
Пример #21
0
        public override TypeElement CreateTypeElement(AssemblyElement assembly, string typeName,
                                                      IncludeStatus includeStatus, VisibilityOverride visibilityOverride,
                                                      SecurityTransparencyStatus securityTransparencyStatus)
        {
            ThinAssembly declaringAssembly = (ThinAssembly)assembly;
            includeStatus = AdjustIncludeStatus(includeStatus);
            ThinType type = new ThinType(declaringAssembly, typeName, includeStatus, null, visibilityOverride, securityTransparencyStatus);

            String key = type.Name;
            if (declaringAssembly.Types.ContainsKey(key))
            {
                String errMsg = String.Format("XML file error: duplicate Type element \"{0}\"", key);
                Console.Error.WriteLine(errMsg);
                throw new FormatException(errMsg);
            }

            declaringAssembly.Types.Add(key, type);

            return type;
        }
Пример #22
0
        public override MemberElement CreateMemberElement(TypeElement type, string memberName, string returnType, MemberTypes memberType, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus)
        {
            TrimType typeInfo = (TrimType)type;

            TrimMember id = new TrimMember(typeInfo, memberName, returnType, /*paramListString, */ memberType, includeStatus, visibilityOverride, securityTransparencyStatus);

            typeInfo.Members.Add(id.Key, id);
            return(id);
        }
Пример #23
0
        public override TypeForwarderElement CreateTypeForwarderElement(AssemblyElement parent, string assemblyName, string typeName, IncludeStatus includeStatus)
        {
            TrimAssembly      trimAssembly  = (TrimAssembly)parent;
            TrimTypeForwarder typeForwarder = new TrimTypeForwarder(assemblyName, typeName, includeStatus);

            trimAssembly.TypeForwarders.Add(typeForwarder.Key, typeForwarder);
            return(typeForwarder);
        }
Пример #24
0
 public void ImportRoots(IncludeStatus rootType)
 {
     ImportWorker(rootType, AddRootAssembly, AddRootType, AddRootTypeForwarder, AddRootMember);
 }
Пример #25
0
 internal CodeTypeForwarderElement(IncludeStatus includeStatus, string assemblyName, string typeName)
 {
     _includeStatus = includeStatus;
     _assemblyName  = assemblyName;
     _typeName      = typeName;
 }
Пример #26
0
        // Special case: If closureStatus == ApiRoot this will automatically
        // convert it to ImplRoot for internal types
        // TODO: Visitor should set status instead of this.
        public ThinModel ExportModel(IncludeStatus closureStatus)
        {
            _closureStatus = closureStatus;

            int nApiTypes          = 0;
            int nApiTypeForwarders = 0;
            int nApiMembers        = 0;

            ThinModel thinModel = new ThinModel(_thinModel.Options);
            Dictionary <String, ThinAssembly>           assemblies = new Dictionary <String, ThinAssembly>(_depot.AssembliesClosure.Count);
            Dictionary <INamedTypeDefinition, ThinType> types      = new Dictionary <INamedTypeDefinition, ThinType>(_depot.TypesClosure.Count);

            foreach (IAssembly assembly in _depot.AssembliesClosure.Values)
            {
                ThinAssembly thinAsm = new ThinAssembly(_thinModel, assembly.Name.Value, GetIncludeStatus(assembly), assembly);
                thinModel.Assemblies.Add(thinAsm.Name, thinAsm);
                assemblies.Add(assembly.Name.Value, thinAsm);
            }

            foreach (INamedTypeDefinition type in _depot.TypesClosure.Values)
            {
                IAssembly asm = TypeHelper.GetDefiningUnit(type) as IAssembly;
                if (asm != null && assemblies.ContainsKey(asm.Name.Value))
                {
                    VisibilityOverride vis = VisibilityOverride.None;
                    if (ShouldHideType(type))
                    {
                        vis = VisibilityOverride.Internal;
                    }

                    if (closureStatus != IncludeStatus.ApiRoot)
                    {
                        if (TypeIsVisibleInApi(type))
                        {
                            INamedTypeDefinition curType = type;
                            while (curType != null && curType != Dummy.Type && // TODO: Remove dummy check?
                                   CanInclude(curType))
                            {
                                if (WeHidThisType(curType))
                                {
                                    throw new Exception("API closure error!  Base type " + curType + " was hidden, but " + type + " is in the public API");
                                }
                                ITypeReference curTypeRef = TypeHelper.BaseClass(curType);
                                curType = curTypeRef != null?Util.CanonicalizeType(curTypeRef) : null;
                            }
                        }
                    }

                    ThinAssembly declaringAssembly = assemblies[asm.Name.Value];
                    ThinType     thinType          = new ThinType(declaringAssembly, Util.FullyQualifiedTypeNameFromType(type), GetIncludeStatus(type), type, vis);
                    declaringAssembly.Types.Add(thinType.Name, thinType);
                    types.Add(type, thinType);

                    if (thinType.IncludeStatus == IncludeStatus.ApiClosure ||
                        thinType.IncludeStatus == IncludeStatus.ApiRoot ||
                        thinType.IncludeStatus == IncludeStatus.ApiFxInternal)
                    {
                        nApiTypes++;
                    }
                }
                else
                {
                    Console.Error.WriteLine("BclRewriter : warning BR5004 : couldn't find declaring module of type {0} in closure", type);
                }
            }

            foreach (IAliasForType typeForwarder in _depot.TypeForwardersClosure.Values)
            {
                // TODO: Why is this getting an immutable copy of the assembly?
                IAssembly asm = Util.GetDefiningAssembly(typeForwarder);
                if (asm != null && assemblies.ContainsKey(asm.Name.Value))
                {
                    ThinAssembly      declaringAssembly = assemblies[asm.Name.Value];
                    ITypeReference    aliasedType       = typeForwarder.AliasedType;
                    ThinTypeForwarder thinTypeForwarder = new ThinTypeForwarder(declaringAssembly,
                                                                                Util.GetDefiningAssembly(aliasedType).Name.Value,
                                                                                Util.GetTypeName(aliasedType),
                                                                                GetIncludeStatus(typeForwarder),
                                                                                typeForwarder);

                    declaringAssembly.TypeForwarders.Add(thinTypeForwarder.Key, thinTypeForwarder);

                    if (thinTypeForwarder.IncludeStatus == IncludeStatus.ApiClosure ||
                        thinTypeForwarder.IncludeStatus == IncludeStatus.ApiRoot ||
                        thinTypeForwarder.IncludeStatus == IncludeStatus.ApiFxInternal)
                    {
                        nApiTypeForwarders++;
                    }
                }
                else
                {
                    Console.Error.WriteLine("BclRewriter : warning BR5001 : couldn't find declaring module of type forwarder {0} in closure", typeForwarder);
                }
            }

            foreach (ITypeDefinitionMember member in _depot.MembersClosure.Keys)
            {
                INamedTypeDefinition type = Util.ContainingTypeDefinition(member);
                if (types.ContainsKey(type))
                {
                    ThinType      declaringType = types[type];
                    IncludeStatus status        = GetIncludeStatus(member);

                    VisibilityOverride vis = VisibilityOverride.None;
                    if (ShouldHideMember(member))
                    {
                        vis = VisibilityOverride.Internal;
                    }

                    if ((type.IsInterface) &&
                        TypeIsVisibleInApi(type) &&
                        vis == VisibilityOverride.Internal)
                    {
                        throw new Exception(string.Format("Implementation required non-public member on public interface: {0} on {1}. This usually means you added a property to model.xml without adding the corresponding getter or setter.",
                                                          member.Name,
                                                          Util.FullyQualifiedTypeNameFromType(member.ContainingType)));
                    }

                    ThinMember thinMember = new ThinMember(declaringType, member, status, vis);
                    declaringType.Members.Add(thinMember.Key, thinMember);

                    if (thinMember.IncludeStatus == IncludeStatus.ApiClosure ||
                        thinMember.IncludeStatus == IncludeStatus.ApiRoot ||
                        thinMember.IncludeStatus == IncludeStatus.ApiFxInternal)
                    {
                        nApiMembers++;
                    }
                }
                else
                {
                    Console.Error.WriteLine("BclRewriter : warning BR5002 : couldn't find declaring type of member {0} in closure", member);
                }
            }

            foreach (IMethodDefinition method in _depot.MethodsClosure.Values)
            {
                INamedTypeDefinition type = Util.ContainingTypeDefinition(method);
                if (types.ContainsKey(type))
                {
                    ThinType      declaringType = types[type];
                    IncludeStatus status        = GetIncludeStatus(method);

                    VisibilityOverride vis = VisibilityOverride.None;
                    if (ShouldHideMember(method))
                    {
                        vis = VisibilityOverride.Internal;
                    }

                    if ((type.IsInterface) &&
                        TypeIsVisibleInApi(type) &&
                        vis == VisibilityOverride.Internal)
                    {
                        //throw new Exception(string.Format("WARNING: implementation required non-public member on public interface: {0} on {1}. This usually means you added a property to model.xml without adding the corresponding getter or setter.",
                        //    method.Name,
                        //    Util.FullyQualifiedTypeNameFromType(method.ContainingType)));
                    }

                    ThinMember thinMember = new ThinMember(declaringType, method, status, vis);
                    if (declaringType.Members.ContainsKey(thinMember.Key))
                    {
                        throw new Exception(String.Format("Found two members with the same signature: {0}", thinMember.Key));
                    }
                    declaringType.Members.Add(thinMember.Key, thinMember);

                    if (thinMember.IncludeStatus == IncludeStatus.ApiClosure ||
                        thinMember.IncludeStatus == IncludeStatus.ApiRoot ||
                        thinMember.IncludeStatus == IncludeStatus.ApiFxInternal)
                    {
                        nApiMembers++;
                    }
                }
                else
                {
                    Console.Error.WriteLine("BclRewriter : warning BR5003 : couldn't find declaring type of method {0} in closure", method);
                }
            }

            foreach (ThinMember thinMember in _missingMembers)
            {
                ThinType   typeToExtend  = types[thinMember.DeclaringType.Metadata];
                ThinMember newThinMember = new ThinMember(typeToExtend, thinMember);
                if (!typeToExtend.Members.ContainsKey(newThinMember.Key))
                {
                    typeToExtend.Members.Add(newThinMember.Key, newThinMember);
                }
            }

            return(thinModel);
        }
Пример #27
0
        internal CodeTypeElement(IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus, string key)
        {
            m_members = new Dictionary<string, MemberElement>();

            _includeStatus = includeStatus;
            _visibilityOverride = visibilityOverride;
            _securityTransparencyStatus = securityTransparencyStatus;
            _key = key;
        }
Пример #28
0
        public override TypeForwarderElement CreateTypeForwarderElement(AssemblyElement parent, string assemblyName, string typeName,
                                                                        IncludeStatus includeStatus)
        {
            ThinAssembly declaringAssembly = (ThinAssembly)parent;
            includeStatus = AdjustIncludeStatus(includeStatus);
            ThinTypeForwarder typeForwarder = new ThinTypeForwarder(declaringAssembly, assemblyName, typeName, includeStatus, null);

            String key = typeForwarder.Key;
            if (declaringAssembly.Types.ContainsKey(key))
            {
                String errMsg = String.Format("XML file error: duplicate TypeForwarder element for \"{0}\"", key);
                Console.Error.WriteLine(errMsg);
                throw new FormatException(errMsg);
            }

            declaringAssembly.TypeForwarders.Add(key, typeForwarder);

            return typeForwarder;
        }
Пример #29
0
 public static bool IsRoot(IncludeStatus status)
 {
     return((status == IncludeStatus.ApiRoot) || (status == IncludeStatus.ImplRoot) || (status == IncludeStatus.ApiFxInternal));
 }
Пример #30
0
        public override MemberElement CreateMemberElement(TypeElement type, string memberName, string returnType, MemberTypes memberType,
                                                          IncludeStatus includeStatus, VisibilityOverride visibilityOverride,
                                                          SecurityTransparencyStatus securityTransparencyStatus)
        {
            ThinType declaringType = (ThinType)type;
            includeStatus = AdjustIncludeStatus(includeStatus);
            ThinMember member = new ThinMember(declaringType, memberName, returnType, memberType,
                                               includeStatus, null, visibilityOverride, securityTransparencyStatus);

            String key = member.Key;
            if (declaringType.Members.ContainsKey(key))
            {
                String errMsg = String.Format("XML file error: duplicate Member element \"{0}\" in type \"{1}\"", key, type.Key);
                Console.Error.WriteLine(errMsg);
                throw new FormatException(errMsg);
            }

            declaringType.Members.Add(key, member);
            return member;
        }
Пример #31
0
 public static bool IsApi(IncludeStatus status)
 {
     return ((status == IncludeStatus.ApiRoot) || (status == IncludeStatus.ApiClosure) || (status == IncludeStatus.ApiFxInternal));
 }
Пример #32
0
 public CodeMemberElement(IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus, string key, string returnType, MemberTypes memberType, string name)
 {
     _includeStatus = includeStatus;
     _visibilityOverride = visibilityOverride;
     _securityTransparencyStatus = securityTransparencyStatus;
     _key = key;
     _returnType = returnType;
     _memberType = memberType;
     _name = name;
 }
Пример #33
0
 public TrimTypeForwarder(String assemblyName, String typeName, IncludeStatus includeStatus)
 {
     _assemblyName = assemblyName;
     _typeName = typeName;
     _includeStatus = includeStatus;
 }
Пример #34
0
 abstract public AssemblyElement CreateAssemblyElement(ModelElement model, string assemblyName, IncludeStatus includeStatus);
Пример #35
0
 public override AssemblyElement CreateAssemblyElement(ModelElement model, string assemblyName, IncludeStatus includeStatus)
 {
     IncludeSet includeSet = (IncludeSet)model;
     TrimAssembly trimAssembly = new TrimAssembly(assemblyName, includeStatus); ;
     includeSet.AddAssembly(trimAssembly);
     return trimAssembly;
 }
Пример #36
0
 abstract public TypeForwarderElement CreateTypeForwarderElement(AssemblyElement parent, string assemblyName, string typeName, IncludeStatus includeStatus);
Пример #37
0
 public override TypeForwarderElement CreateTypeForwarderElement(AssemblyElement parent, string assemblyName, string typeName, IncludeStatus includeStatus)
 {
     TrimAssembly trimAssembly = (TrimAssembly)parent;
     TrimTypeForwarder typeForwarder = new TrimTypeForwarder(assemblyName, typeName, includeStatus);
     trimAssembly.TypeForwarders.Add(typeForwarder.Key, typeForwarder);
     return typeForwarder;
 }
        public override AssemblyElement CreateAssemblyElement(ModelElement model, string assemblyName, IncludeStatus includeStatus)
        {
            CodeAssemblyElement assembly = new CodeAssemblyElement(includeStatus, assemblyName);

            (model as CodeModelElement).m_assemblies.Add(assemblyName, assembly);
            return(assembly);
        }
Пример #39
0
        public TrimAssembly(string assemblyName, IncludeStatus status)
        {
            _name = assemblyName;
            _includeStatus = status;

            _types = new Dictionary<string, TypeElement>();
            _typeForwarders = new Dictionary<string, TypeForwarderElement>();
        }
        public override TypeForwarderElement CreateTypeForwarderElement(AssemblyElement parent, string assemblyName, string typeName, IncludeStatus includeStatus)
        {
            CodeTypeForwarderElement typeForwarder = new CodeTypeForwarderElement(includeStatus, assemblyName, typeName);

            (parent as CodeAssemblyElement).TypeForwarders.Add(typeForwarder.Key, typeForwarder);
            return(typeForwarder);
        }
Пример #41
0
        private void ImportWorker(IncludeStatus statusToImport, AddAssembly addAssembly, AddType addType, AddTypeForwarder addTypeForwarder, AddMember addMember)
        {
            foreach (ThinAssembly assembly in _thinModel.Assemblies.Values)
            {
                if (assembly.IncludeStatus == statusToImport)
                    addAssembly(assembly);

                foreach (ThinTypeForwarder typeForwarder in assembly.TypeForwarders.Values)
                {
                    if (typeForwarder.IncludeStatus == statusToImport)
                    {
                        // Assembly may not have already been added because they might not have the correct IncludedStatus.
                        addAssembly(assembly);
                        addTypeForwarder(typeForwarder);
                    }
                }

                foreach (ThinType type in assembly.Types.Values)
                {
                    if (type.IncludeStatus == statusToImport)
                    {
                        // Assembly may not have already been added because they might not have the correct IncludedStatus.
                        addAssembly(assembly);
                        addType(type);
                    }

                    foreach (ThinMember member in type.Members.Values)
                    {
                        if (member.IncludeStatus == statusToImport)
                        {
                            // Assembly and Type may not have already been added because they might not have the correct IncludedStatus.
                            addAssembly(assembly);
                            addType(type);
                            addMember(member);
                        }
                    }
                }
            }
        }
Пример #42
0
 public TrimTypeForwarder(String assemblyName, String typeName, IncludeStatus includeStatus)
 {
     _assemblyName  = assemblyName;
     _typeName      = typeName;
     _includeStatus = includeStatus;
 }
Пример #43
0
        internal CodeAssemblyElement(IncludeStatus includeStatus, string key)
        {
            m_types = new Dictionary<string, TypeElement>();
            m_typeForwarders = new Dictionary<string, TypeForwarderElement>();

            _includeStatus = includeStatus;
            _key = key;
        }
Пример #44
0
        public override AssemblyElement CreateAssemblyElement(ModelElement model, string assemblyName, IncludeStatus includeStatus)
        {
            IncludeSet   includeSet   = (IncludeSet)model;
            TrimAssembly trimAssembly = new TrimAssembly(assemblyName, includeStatus);;

            includeSet.AddAssembly(trimAssembly);
            return(trimAssembly);
        }
Пример #45
0
 internal CodeTypeForwarderElement(IncludeStatus includeStatus, string assemblyName, string typeName)
 {
     _includeStatus = includeStatus;
     _assemblyName = assemblyName;
     _typeName = typeName;
 }
Пример #46
0
 public static bool IsApi(IncludeStatus status)
 {
     return((status == IncludeStatus.ApiRoot) || (status == IncludeStatus.ApiClosure) || (status == IncludeStatus.ApiFxInternal));
 }
Пример #47
0
        public void RecursivelyReadBlock(XmlReader reader, object parentObj, bool include)
        {
            while (reader.Read() && (reader.NodeType != XmlNodeType.EndElement))
            {
                XmlParseAssert(reader.IsStartElement());

                switch (reader.Name)
                {
                case XmlKeywords.Elements.Xml:
                {
                    XmlParseAssert(include);
                    XmlParseAssert(parentObj is ModelElement);
                    RecursivelyReadBlock(reader, parentObj, true);
                    break;
                }

                case XmlKeywords.Elements.ThinModel:
                {
                    XmlParseAssert(include);
                    XmlParseAssert(parentObj is ModelElement);
                    RecursivelyReadBlock(reader, parentObj, true);
                    break;
                }

                case XmlKeywords.Elements.Assembly:
                {
                    XmlParseAssert(include);
                    XmlParseAssert(parentObj is ModelElement);
                    XmlParseAssert(reader.AttributeCount > 0);
                    string assemblyName = reader.GetAttribute(XmlKeywords.Attributes.Name);
                    XmlParseAssert(assemblyName != null);

                    string includeStatusString = reader.GetAttribute(XmlKeywords.Attributes.IncludeStatus);

                    IncludeStatus includeStatus = IncludeStatus.Inherit;
                    if (includeStatusString != null)
                    {
                        includeStatus = XmlKeywords.ParseIncludeStatus(includeStatusString);
                    }

                    string platform     = reader.GetAttribute(XmlKeywords.Attributes.Platform);
                    string architecture = reader.GetAttribute(XmlKeywords.Attributes.Architecture);
                    string flavor       = reader.GetAttribute(XmlKeywords.Attributes.Flavor);
                    string condition    = reader.GetAttribute(XmlKeywords.Attributes.Condition);
                    bool   included     = IncludeBuild(platform, architecture, flavor, condition);

                    AssemblyElement assembly = null;
                    if (included)
                    {
                        assembly = CreateAssemblyElement((ModelElement)parentObj, assemblyName, includeStatus);
                    }

                    if (!reader.IsEmptyElement)
                    {
                        RecursivelyReadBlock(reader, assembly, included);
                    }
                    break;
                }

                case XmlKeywords.Elements.Type:
                {
                    TypeElement type     = null;
                    bool        included = false;

                    if (include)
                    {
                        XmlParseAssert(parentObj is AssemblyElement);
                        XmlParseAssert(reader.AttributeCount > 0);
                        string fullyQualifiedTypeName = reader.GetAttribute(XmlKeywords.Attributes.Name);
                        XmlParseAssert(fullyQualifiedTypeName != null);

                        AssemblyElement declaringAssembly = (AssemblyElement)parentObj;

                        IncludeStatus includeStatus       = declaringAssembly.IncludeStatus;
                        string        includeStatusString = reader.GetAttribute(XmlKeywords.Attributes.IncludeStatus);
                        if (includeStatusString != null)
                        {
                            includeStatus = XmlKeywords.ParseIncludeStatus(includeStatusString);
                        }

                        SecurityTransparencyStatus securityTransparencyStatus = SecurityTransparencyStatus.Transparent;
                        string securityTransparencyStatusString = reader.GetAttribute(XmlKeywords.Attributes.SecurityTransparencyStatus);
                        if (securityTransparencyStatusString != null)
                        {
                            securityTransparencyStatus = XmlKeywords.ParseSecurityTransparencyStatus(securityTransparencyStatusString);
                        }

                        string             visibilityOverrideString = reader.GetAttribute(XmlKeywords.Attributes.VisibilityOverride);
                        VisibilityOverride visibilityOverride       = XmlKeywords.ParseVisibilityOverride(visibilityOverrideString);

                        string platform     = reader.GetAttribute(XmlKeywords.Attributes.Platform);
                        string architecture = reader.GetAttribute(XmlKeywords.Attributes.Architecture);
                        string flavor       = reader.GetAttribute(XmlKeywords.Attributes.Flavor);
                        string condition    = reader.GetAttribute(XmlKeywords.Attributes.Condition);
                        included = IncludeBuild(platform, architecture, flavor, condition);

                        if (included)
                        {
                            type = CreateTypeElement(declaringAssembly, fullyQualifiedTypeName, includeStatus, visibilityOverride, securityTransparencyStatus);
                        }
                    }

                    if (!reader.IsEmptyElement)
                    {
                        RecursivelyReadBlock(reader, type, included);
                    }
                    break;
                }

                case XmlKeywords.Elements.TypeForwarder:
                {
                    TypeForwarderElement type = null;
                    bool included             = false;

                    if (include)
                    {
                        XmlParseAssert(parentObj is AssemblyElement);
                        XmlParseAssert(reader.AttributeCount > 1);
                        string assemblyName = reader.GetAttribute(XmlKeywords.Attributes.AssemblyName);
                        string typeName     = reader.GetAttribute(XmlKeywords.Attributes.TypeName);

                        XmlParseAssert(assemblyName != null);
                        XmlParseAssert(typeName != null);

                        AssemblyElement declaringAssembly = (AssemblyElement)parentObj;

                        IncludeStatus includeStatus       = declaringAssembly.IncludeStatus;
                        string        includeStatusString = reader.GetAttribute(XmlKeywords.Attributes.IncludeStatus);
                        if (includeStatusString != null)
                        {
                            includeStatus = XmlKeywords.ParseIncludeStatus(includeStatusString);
                        }

                        string platform     = reader.GetAttribute(XmlKeywords.Attributes.Platform);
                        string architecture = reader.GetAttribute(XmlKeywords.Attributes.Architecture);
                        string flavor       = reader.GetAttribute(XmlKeywords.Attributes.Flavor);
                        string condition    = reader.GetAttribute(XmlKeywords.Attributes.Condition);
                        included = IncludeBuild(platform, architecture, flavor, condition);

                        if (included)
                        {
                            type = CreateTypeForwarderElement(declaringAssembly, assemblyName, typeName, includeStatus);
                        }
                    }

                    if (!reader.IsEmptyElement)
                    {
                        RecursivelyReadBlock(reader, type, included);
                    }
                    break;
                }

                case XmlKeywords.Elements.Member:
                {
                    if (include)
                    {
                        XmlParseAssert(parentObj is TypeElement);
                        XmlParseAssert(reader.AttributeCount > 0);
                        string memberName = reader.GetAttribute(XmlKeywords.Attributes.Name);
                        XmlParseAssert(memberName != null);

                        TypeElement declaringType = (TypeElement)parentObj;

                        string returnType = reader.GetAttribute(XmlKeywords.Attributes.ReturnType);

                        string      memberTypeString = reader.GetAttribute(XmlKeywords.Attributes.MemberType);
                        MemberTypes memberType       = XmlKeywords.ParseMemberType(memberTypeString);
                        XmlParseAssert(memberType != MemberTypes.Unknown);

                        IncludeStatus includeStatus       = declaringType.IncludeStatus;
                        string        includeStatusString = reader.GetAttribute(XmlKeywords.Attributes.IncludeStatus);
                        if (includeStatusString != null)
                        {
                            includeStatus = XmlKeywords.ParseIncludeStatus(includeStatusString);
                        }
                        if (includeStatus == IncludeStatus.Inherit)
                        {
                            throw new FormatException(String.Format("Specify include status for Member \"{0}\" in Type \"{1}\"", memberName, declaringType.Key));
                        }
                        XmlParseAssert(includeStatus != IncludeStatus.Inherit);

                        // Inherited virtual members "sometimes" don't inherit transparency status (when following certain rulesets) and we don't know
                        // inheritance or rule status here. Therefore we can't say what the transparency status is here unless it's explicitly defined.
                        SecurityTransparencyStatus securityTransparencyStatus = SecurityTransparencyStatus.Undefined;
                        string securityTransparencyStatusString = reader.GetAttribute(XmlKeywords.Attributes.SecurityTransparencyStatus);
                        if (securityTransparencyStatusString != null)
                        {
                            securityTransparencyStatus = XmlKeywords.ParseSecurityTransparencyStatus(securityTransparencyStatusString);
                        }

                        string             visibilityOverrideString = reader.GetAttribute(XmlKeywords.Attributes.VisibilityOverride);
                        VisibilityOverride visibilityOverride       = XmlKeywords.ParseVisibilityOverride(visibilityOverrideString);

                        string platform     = reader.GetAttribute(XmlKeywords.Attributes.Platform);
                        string architecture = reader.GetAttribute(XmlKeywords.Attributes.Architecture);
                        string flavor       = reader.GetAttribute(XmlKeywords.Attributes.Flavor);
                        string condition    = reader.GetAttribute(XmlKeywords.Attributes.Condition);
                        bool   included     = IncludeBuild(platform, architecture, flavor, condition);

                        if (included)
                        {
                            CreateMemberElement(declaringType, memberName, returnType, memberType, includeStatus, visibilityOverride, securityTransparencyStatus);
                        }
                    }

                    break;
                }
                }
            }
        }
Пример #48
0
        private IncludeStatus AdjustIncludeStatus(IncludeStatus includeStatus)
        {
            if (_options.TreatFxInternalAsPublic && includeStatus == IncludeStatus.ApiFxInternal)
                return IncludeStatus.ApiRoot;

            return includeStatus;
        }
Пример #49
0
 abstract public TypeElement CreateTypeElement(AssemblyElement assembly, string typeName, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus);
Пример #50
0
        private void CombineIncludeStatusWithModel(IncludeStatus targetStatusToAdd, ThinModel otherModel)
        {
            // TODO: which one should we keep, the one in this model or the other model?
            foreach (ThinAssembly assembly in Assemblies.Values)
            {
                AssemblyElement newAssembly;
                if (!otherModel.Assemblies.TryGetValue(assembly.Name, out newAssembly) &&
                    (assembly.IncludeStatus == targetStatusToAdd))
                {
                    newAssembly = new ThinAssembly(otherModel, assembly);
                    otherModel.Assemblies.Add(newAssembly.Key, newAssembly);
                }

                foreach (ThinTypeForwarder typeForwarder in assembly.TypeForwarders.Values)
                {
                    TypeForwarderElement newTypeForwarder;
                    if (!newAssembly.TypeForwarders.TryGetValue(typeForwarder.Key, out newTypeForwarder) &&
                        (typeForwarder.IncludeStatus == targetStatusToAdd))
                    {
                        newTypeForwarder = new ThinTypeForwarder((ThinAssembly)newAssembly, typeForwarder);
                        newAssembly.TypeForwarders.Add(newTypeForwarder.Key, newTypeForwarder);
                    }
                }

                foreach (ThinType type in assembly.Types.Values)
                {
                    TypeElement newType;
                    if (!newAssembly.Types.TryGetValue(type.Name, out newType) &&
                        (type.IncludeStatus == targetStatusToAdd))
                    {
                        newType = new ThinType((ThinAssembly)newAssembly, type);
                        newAssembly.Types.Add(newType.Key, newType);
                    }
                    foreach (ThinMember member in type.Members.Values)
                    {
                        MemberElement newMember;
                        if (!newType.Members.TryGetValue(member.Key, out newMember) &&
                            (member.IncludeStatus == targetStatusToAdd))
                        {
                            newMember = new ThinMember((ThinType)newType, member);
                            newType.Members.Add(newMember.Key, newMember);
                        }
                    }
                }
            }
        }
Пример #51
0
 abstract public MemberElement CreateMemberElement(TypeElement type, string memberName, string returnType, MemberTypes memberType, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus);
Пример #52
0
 public override AssemblyElement CreateAssemblyElement(ModelElement model, string assemblyName, IncludeStatus includeStatus)
 {
     CodeAssemblyElement assembly = new CodeAssemblyElement(includeStatus, assemblyName);
     (model as CodeModelElement).m_assemblies.Add(assemblyName, assembly);
     return assembly;
 }
        public override TypeElement CreateTypeElement(AssemblyElement assembly, string typeName, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus)
        {
            CodeTypeElement type = new CodeTypeElement(includeStatus, visibilityOverride, securityTransparencyStatus, typeName);

            (assembly as CodeAssemblyElement).m_types.Add(typeName, type);
            return(type);
        }
Пример #54
0
 public override TypeElement CreateTypeElement(AssemblyElement assembly, string typeName, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus)
 {
     CodeTypeElement type = new CodeTypeElement(includeStatus, visibilityOverride, securityTransparencyStatus, typeName);
     (assembly as CodeAssemblyElement).m_types.Add(typeName, type);
     return type;
 }
        public override MemberElement CreateMemberElement(TypeElement type, string memberName, string returnType, MemberTypes memberType, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus)
        {
            // Identify the member by category (method/prop/field/event), name, and return type.  These
            // strings are what matched by ModelSigFormatter

            string memberSig = memberType.ToString() + " : " + memberName;

            if (returnType != null)
            {
                memberSig = memberSig + " : " + returnType;
            }

            CodeMemberElement member = new CodeMemberElement(includeStatus, visibilityOverride, securityTransparencyStatus, memberSig, returnType, memberType, memberName);

            (type as CodeTypeElement).m_members.Add(memberSig, member);
            return(member);
        }
Пример #56
0
 public override TypeForwarderElement CreateTypeForwarderElement(AssemblyElement parent, string assemblyName, string typeName, IncludeStatus includeStatus)
 {
     CodeTypeForwarderElement typeForwarder = new CodeTypeForwarderElement(includeStatus, assemblyName, typeName);
     (parent as CodeAssemblyElement).TypeForwarders.Add(typeForwarder.Key, typeForwarder);
     return typeForwarder;
 }