public Ui5Method(Ui5Method x, Ui5Complex newowner)
 {
     deprecated  = x.deprecated;
     description = x.description;
     name        = x.name;
     owner       = newowner;
     parameters  = x.parameters.Select(y => y.Clone() as Ui5Parameter).ToList();
     returnValue = x.returnValue != null ? new Ui5Value(x.returnValue) : null;
     since       = x.since;
     @static     = x.@static;
     visibility  = x.visibility;
 }
Esempio n. 2
0
        /// <summary>
        /// Will check base class for any methods that are overridden and not type matching. The class will create overloads for those and add it to its method list.
        /// </summary>
        /// <param name="allcontent"></param>
        public void CheckOverloads(IEnumerable <Ui5Complex> allcontent, Ui5Complex requestor = null, Ui5Complex basetype = null)
        {
            if (requestor == null)
            {
                requestor = this;
            }

            if (basetype == null)
            {
                basetype = this;
            }

            Ui5Complex extender = allcontent.FirstOrDefault(x => x.fullname == basetype.extends);

            if (extender == null)
            {
                return;
            }

            if (!extender.Overloaded)
            {
                extender.CheckOverloads(allcontent);
            }

            if (extender.extends != null)
            {
                extender.CheckOverloads(allcontent, requestor, extender);
            }

            List <Ui5Method> appendmethods = new List <Ui5Method>();

            foreach (Ui5Method m in requestor.methods)
            {
                // bm = basemethod
                string[] mdefs = m.GetMethodDefinitions();
                if (mdefs == null)
                {
                    continue;
                }

                foreach (Ui5Method bm in extender.methods.Where(x => x.name == m.name))
                {
                    foreach (string defbase in bm.GetMethodDefinitions())
                    {
                        foreach (string mdef in mdefs)
                        {
                            if (!mdef.Equals(defbase))
                            {
                                appendmethods.Add(bm);
                            }
                        }
                    }
                }
            }

            requestor.methods.AddRange(appendmethods.Select(x =>
            {
                Ui5Method overload    = new Ui5Method(x, requestor);
                overload.description += Environment.NewLine + "@note Overload from base type " + x.owner.fullname;
                return(overload);
            }));
            requestor.methods    = requestor.methods.Distinct(new Ui5MethodEqualityComparer()).OrderBy(x => x.name).ToList();
            requestor.Overloaded = true;
        }