コード例 #1
0
 protected virtual void MarkCachedMember(DefMember m)
 {
     if (m.IsStatic || AllowCachedMemberFields)
     {
         _cachedMembers.Add(m);
     }
 }
コード例 #2
0
        private void AddAttributesInMember(DefMember member, XmlElement elem)
        {
            foreach (XmlAttribute attr in elem.Attributes)
            {
                if (attr.Name != "name")
                {
                    AddAttributeInHolder(member, CreateAttribute(attr));
                }
            }

            foreach (XmlNode child in elem.ChildNodes)
            {
                if (!(child is XmlElement))
                {
                    continue;
                }

                if (child.Name[0] == '_')
                {
                    AddAttributeInHolder(member, CreateAttribute(child as XmlElement));
                    continue;
                }

                switch (child.Name)
                {
                case "param":
                    if (!(member is DefFunction))
                    {
                        throw new Exception("Unexpected");
                    }

                    string   name  = (child as XmlElement).GetAttribute("name");
                    DefParam param = null;
                    foreach (DefParam p in (member as DefFunction).Parameters)
                    {
                        if (p.Name == name)
                        {
                            param = p;
                            break;
                        }
                    }
                    if (param == null)
                    {
                        throw new Exception("Wrong param name");
                    }

                    foreach (XmlAttribute attr in child.Attributes)
                    {
                        if (attr.Name != "name")
                        {
                            AddAttributeInHolder(param, CreateAttribute(attr));
                        }
                    }
                    break;

                default:
                    throw new Exception("Unexpected");
                }
            }
        }
コード例 #3
0
        protected virtual string NameToPrivate(DefMember m)
        {
            string name = m.Name;

            if (m is DefFunction &&
                (m as DefFunction).IsGetProperty &&
                name.StartsWith("get"))
            {
                name = name.Substring(3);
            }

            return(NameToPrivate(name));
        }