Пример #1
0
 public string newName(string name)
 {
     NameCreator2 nameCreator;
     if (!nameCreators.TryGetValue(name, out nameCreator))
         nameCreators[name] = nameCreator = new NameCreator2(name);
     return nameCreator.newName();
 }
Пример #2
0
        void renameMethod(MethodDef methodDef)
        {
            if (methodDef.isVirtual())
                throw new ApplicationException("Can't rename virtual methods here");
            if (!canRenameMethod(methodDef))
                return;

            var info = method(methodDef);
            if (info.renamed)
                return;
            info.renamed = true;
            var checker = NameChecker;

            if (!NameChecker.isValidMethodName(info.oldName)) {
                INameCreator nameCreator = null;
                string newName = info.suggestedName;
                if (methodDef.MethodDefinition.PInvokeInfo != null)
                    newName = getPinvokeName(methodDef);
                else if (methodDef.isStatic())
                    nameCreator = variableNameState.staticMethodNameCreator;
                else
                    nameCreator = variableNameState.instanceMethodNameCreator;
                if (newName != null)
                    nameCreator = new NameCreator2(newName);
                renameMethod(methodDef, variableNameState.getNewMethodName(info.oldName, nameCreator));
            }
        }