예제 #1
0
        /// <summary>
        /// Finds the method calls that resolve to this MethodDefintion.
        /// </summary>
        /// <param name="rootScope">The Statement to search below for method calls.</param>
        /// <returns>An enumerable of MethodCalls located at/below <paramref name="rootScope"/> that resolve to this MethodDefinition.</returns>
        public IEnumerable <MethodCall> GetCallsToSelf(Statement rootScope)
        {
            if (null == rootScope)
            {
                throw new ArgumentNullException("rootScope");
            }

            return(rootScope.GetCallsTo(this, true));
        }
예제 #2
0
        /// <summary>
        /// Tests whether this method contains any calls to <paramref name="otherMethod"/>
        /// </summary>
        /// <param name="root">The statement to start searching from</param>
        /// <param name="otherMethod">The other method</param>
        /// <returns>True if any of the calls in this method are a match for <paramref name="otherMethod"/></returns>
        public static bool ContainsCallTo(this Statement root, MethodDefinition otherMethod)
        {
            if (null == otherMethod)
            {
                throw new ArgumentNullException("otherMethod");
            }

            return(root.GetCallsTo(otherMethod, true).Any());
        }