private void ProcessCallable(ICallable callable)
            {
                var fspec = callable as FunctionSpec;

                if (fspec != null && fspec.GenericSysDOMRep != null)
                {
                    var owner    = (IPackageOrComponentDescriptor)fspec.GenericSysDOMRep.Owner;
                    var ownerpkg = owner as PackageDescriptor;
                    if (ownerpkg != null)
                    {
                        _design.AddChild(ownerpkg, ownerpkg.Name);
                        if (owner != _stack.Peek())
                        {
                            _stack.Peek().AddDependency(ownerpkg);
                        }
                    }

                    if (!fspec.GenericSysDOMRep.IsActive)
                    {
                        fspec.GenericSysDOMRep.IsActive = true;
                        _stack.Push(owner);
                        if (fspec.GenericSysDOMRep.Implementation != null)
                        {
                            fspec.GenericSysDOMRep.Implementation.Body.Accept(this);
                        }
                        _stack.Pop();
                    }
                }
            }
Ejemplo n.º 2
0
        /// <summary>
        /// Retrieves a suitable package to put a certain type into.
        /// </summary>
        /// <param name="type">type for which a suitable package is desired</param>
        /// <returns>suitable package</returns>
        public PackageDescriptor GetPackage(Type type)
        {
            string pkgName = type.Namespace;

            if (pkgName == null)
            {
                pkgName = "DefaultPackage";
            }
            PackageDescriptor pd;

            if (!_pkgMap.TryGetValue(pkgName, out pd))
            {
                pd = new PackageDescriptor(pkgName);
            }
            _pkgMap[pkgName] = pd;
            _design.AddChild(pd, pd.Name);
            return(pd);
        }