Пример #1
0
 public void add(PropertyDef p)
 {
     properties.add(p);
 }
Пример #2
0
        public PropertyDef create(PropertyDefinition newProp)
        {
            if (findAny(newProp) != null)
                throw new ApplicationException("Can't add a property when it's already been added");

            var propDef = new PropertyDef(newProp, this, properties.Count);
            add(propDef);
            TypeDefinition.Properties.Add(newProp);
            return propDef;
        }
Пример #3
0
 public PropertyInfo prop(PropertyDef prop)
 {
     return memberInfos.prop(prop);
 }
Пример #4
0
        void prepareRenameProperty(PropertyDef propDef)
        {
            if (propDef.isVirtual())
                throw new ApplicationException("Can't rename virtual props here");
            var propInfo = prop(propDef);
            if (propInfo.renamed)
                return;

            string propName = propInfo.oldName;
            if (!NameChecker.isValidPropertyName(propName))
                propName = propInfo.suggestedName;
            if (!NameChecker.isValidPropertyName(propName)) {
                if (propDef.isItemProperty())
                    propName = "Item";
                else
                    propName = variableNameState.getNewPropertyName(propDef.PropertyDefinition);
            }
            variableNameState.addPropertyName(propName);
            propInfo.rename(propName);

            renameSpecialMethod(propDef.GetMethod, "get_" + propName);
            renameSpecialMethod(propDef.SetMethod, "set_" + propName);
        }
Пример #5
0
        void createProperty(PropertyDef propDef, MethodDef methodDef, string overridePrefix)
        {
            if (!methodDef.Owner.HasModule)
                return;

            var newPropertyName = overridePrefix + propDef.PropertyDefinition.Name;
            if (!DotNetUtils.hasReturnValue(methodDef.MethodDefinition))
                createPropertySetter(newPropertyName, methodDef);
            else
                createPropertyGetter(newPropertyName, methodDef);
        }
Пример #6
0
        void createProperty(PropertyDef propDef, MethodDef methodDef, string overridePrefix)
        {
            if (!methodDef.Owner.HasModule)
                return;

            var newPropertyName = overridePrefix + propDef.PropertyDefinition.Name;
            if (methodDef.MethodDefinition.MethodReturnType.ReturnType.FullName == "System.Void")
                createPropertySetter(newPropertyName, methodDef);
            else
                createPropertyGetter(newPropertyName, methodDef);
        }
Пример #7
0
 public MPropertyDef FindAny(PropertyDef pr)
 {
     return(properties.FindAny(pr));
 }
Пример #8
0
 public MPropertyDef(PropertyDef propertyDef, MTypeDef owner, int index)
     : base(propertyDef, owner, index)
 {
 }
Пример #9
0
 public void add(PropertyDef p)
 {
     properties.add(p);
 }