Ejemplo n.º 1
0
        public void Resolve(IDictionary <Identifier, IReferencable> referencables)
        {
            if (referencables.ContainsKey(identifier))
            {
                IsResolved = true;

                IReferencable referencable = referencables[identifier];
                var           type         = referencable as DeclaredType;

                if (type == null)
                {
                    throw new InvalidOperationException("Cannot resolve to '" + referencable.GetType().FullName + "'");
                }

                Namespace   = type.Namespace;
                declaration = type.declaration;
                ParentType  = type.ParentType;
                Interfaces  = type.Interfaces;

                if (!Namespace.IsResolved)
                {
                    Namespace.Resolve(referencables);
                }

                if (ParentType != null && !ParentType.IsResolved)
                {
                    ParentType.Resolve(referencables);
                }

                foreach (IReferencable face in Interfaces)
                {
                    if (!face.IsResolved)
                    {
                        face.Resolve(referencables);
                    }
                }

                if (declaration != null && declaration.IsDefined(typeof(ObsoleteAttribute)))
                {
                    ObsoleteReason = declaration.GetCustomAttribute <ObsoleteAttribute>().Message;
                }

                if (!Summary.IsResolved)
                {
                    Summary.Resolve(referencables);
                }

                foreach (Method method in Methods)
                {
                    if (!method.IsResolved)
                    {
                        method.Resolve(referencables);
                    }
                }

                foreach (Property property in Properties)
                {
                    if (!property.IsResolved)
                    {
                        property.Resolve(referencables);
                    }
                }

                foreach (Event ev in Events)
                {
                    if (!ev.IsResolved)
                    {
                        ev.Resolve(referencables);
                    }
                }

                foreach (Field field in Fields)
                {
                    if (!field.IsResolved)
                    {
                        field.Resolve(referencables);
                    }
                }
            }
            else
            {
                ConvertToExternalReference();
            }
        }
Ejemplo n.º 2
0
        public void Resolve(IDictionary <Identifier, IReferencable> referencables)
        {
            if (referencables.ContainsKey(identifier))
            {
                IsResolved = true;

                IReferencable referencable = referencables[identifier];
                var           type         = referencable as DeclaredType;

                if (type == null)
                {
                    throw new InvalidOperationException("Cannot resolve to '" + referencable.GetType().FullName + "'");
                }

                Namespace       = type.Namespace;
                representedType = type.representedType;
                ParentType      = type.ParentType;
                Interfaces      = type.Interfaces;

                if (!Namespace.IsResolved)
                {
                    Namespace.Resolve(referencables);
                }
                if (ParentType != null && !ParentType.IsResolved)
                {
                    ParentType.Resolve(referencables);
                }

                foreach (IReferencable face in Interfaces)
                {
                    if (!face.IsResolved)
                    {
                        face.Resolve(referencables);
                    }
                }

                if (!Summary.IsResolved)
                {
                    Summary.Resolve(referencables);
                }

                foreach (var method in Methods)
                {
                    if (!method.IsResolved)
                    {
                        method.Resolve(referencables);
                    }
                }

                foreach (var property in Properties)
                {
                    if (!property.IsResolved)
                    {
                        property.Resolve(referencables);
                    }
                }

                foreach (var ev in Events)
                {
                    if (!ev.IsResolved)
                    {
                        ev.Resolve(referencables);
                    }
                }

                foreach (var field in Fields)
                {
                    if (!field.IsResolved)
                    {
                        field.Resolve(referencables);
                    }
                }
            }
            else
            {
                ConvertToExternalReference();
            }
        }