Example #1
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);
        }