예제 #1
0
        /// <summary>
        /// Finds <c>MethodDefinition</c> corresponding to <c>method</c> given.
        /// </summary>
        /// <param name="asmDef">Assembly to be searched in.</param>
        /// <param name="moduleName">Name of module conating method.</param>
        /// <param name="method">Method description interface.</param>
        /// <returns><c>MethodDefinition</c> corresponding to <c>method</c></returns>
        public MethodDefinition FindMethod(AssemblyDefinition asmDef, string moduleName, IMethod method)
        {
            TypeDefinition typDef = FindTypeDefinition(asmDef, moduleName, method.DeclaringType.FullyQualifiedName);

            if (typDef == null)
            {
                return(null);
            }
            // Look up method with same signature in class.
            foreach (MethodDefinition element in typDef.Methods)
            {
                if (MemberComparator.SameMethodOverloads(element, method))
                {
                    return(element);
                }
            }
            return(null);
        }
예제 #2
0
        /// <summary>
        /// Finds <c>PropertyDefinition</c> corresponding to <c>property</c> given.
        /// </summary>
        /// <param name="asmDef">Assembly to be searched in.</param>
        /// <param name="moduleName">Name of module conating method.</param>
        /// <param name="method">Method description interface.</param>
        /// <returns><c>PropertyDefinition</c> corresponding to <c>property</c></returns>
        public PropertyDefinition FindProperty(AssemblyDefinition asmDef, string moduleName, IProperty property)
        {
            TypeDefinition typDef = FindTypeDefinition(asmDef, moduleName, property.DeclaringType.FullyQualifiedName);

            if (typDef == null)
            {
                return(null);
            }
            // Look up method with same signature in class.
            foreach (PropertyDefinition element in typDef.Properties)
            {
                if (MemberComparator.SamePropertyOverloads(element, property))
                {
                    return(element);
                }
            }
            return(null);
        }
예제 #3
0
        private void regenMovedSymbolsClass(IClass cClass, EditorEvent edEvent, SymbolWriterClass emitter)
        {
            Predicate <string> del = delegate(string name){
                return(FileUtility.IsEqualFileName(name, cClass.CompilationUnit.FileName));
            };

            if (edEvent.touched.Exists(del))
            {
                if (cClass is CompoundClass)
                {
                    foreach (IClass tClass in ((CompoundClass)cClass).Parts)
                    {
                        regenMovedSymbolsClass(tClass, edEvent, emitter);
                    }
                }
                else
                {
                    foreach (IMethod method in cClass.Methods)
                    {
                        if (!edEvent.changes.Exists(delegate(SourceChange change){
                            return(change.NewEntity is IMethod && MemberComparator.SameMethodOverloads(method, (IMethod)change.NewEntity));
                        }))
                        {
                            regenMovedSymbolsMethod(method, emitter);
                        }
                    }
                    foreach (IClass tClass in cClass.InnerClasses)
                    {
                        regenMovedSymbolsClass(tClass, edEvent, emitter);
                    }
                    foreach (IProperty tProp in cClass.Properties)
                    {
                        if (!edEvent.changes.Exists(delegate(SourceChange change){
                            return(change.NewEntity is IProperty && MemberComparator.SameProperties(tProp, (IProperty)change.NewEntity));
                        }))
                        {
                            regenMovedSymbolsProperty(tProp, emitter);
                        }
                    }
                }
            }
        }