private Method FindMatchingMethodInClass(Method activatedMethod)
        {
            ISourceTreeResolver resolver = new SourceTreeResolver();
            Method matchingMethod = null;
            foreach (IElement node in _targetClass.Nodes)
            {
                if (node is Method)
                {
                    if (node.Name != activatedMethod.Name)
                        continue;

                    if (SignatureHelper.SignaturesMatch(resolver, activatedMethod, node as Method))
                    {
                        matchingMethod = node as Method;
                    }
                }
            }
            return matchingMethod;
        }
        } // IsElementOfType(DeclaredTypeElement, type)

        /// <summary>
        /// Is element of type
        /// </summary>
        public bool IsElementOfType(ITypeReferenceExpression declaredTypeExpression, string type)
        {
            try
            {
                if (declaredTypeExpression == null)
                {
                    return(false);
                }
                if (_NewSourceTreeResolver == null)
                {
                    _NewSourceTreeResolver = new SourceTreeResolver();
                }
                ITypeElement DeclaredTypeElement = _NewSourceTreeResolver.ResolveExpression(declaredTypeExpression) as ITypeElement;
                return(IsElementOfType(DeclaredTypeElement, type));
            } // try
            catch (Exception ex)
            {
                Trace.WriteLine("Exception in IsElementOfType Function: " + ex.Message);
            }
            return(false);
        } // IsElementOfType(declaredTypeExpression, type)
예제 #3
0
        private Method FindMatchingMethodInClass(Method activatedMethod)
        {
            ISourceTreeResolver resolver = new SourceTreeResolver();
            Method matchingMethod        = null;

            foreach (IElement node in _targetClass.Nodes)
            {
                if (node is Method)
                {
                    if (node.Name != activatedMethod.Name)
                    {
                        continue;
                    }

                    if (SignatureHelper.SignaturesMatch(resolver, activatedMethod, node as Method))
                    {
                        matchingMethod = node as Method;
                    }
                }
            }
            return(matchingMethod);
        }
        } // IsElementOfType(DeclaredTypeElement, type)

        /// <summary>
        /// Is element of type
        /// </summary>
        public bool IsElementOfType(ITypeReferenceExpression declaredTypeExpression, string type)
        {
            try
            {
                if (declaredTypeExpression == null)
                    return false;
                if (_NewSourceTreeResolver == null)
                    _NewSourceTreeResolver = new SourceTreeResolver();
                ITypeElement DeclaredTypeElement = _NewSourceTreeResolver.ResolveExpression(declaredTypeExpression) as ITypeElement;
                return IsElementOfType(DeclaredTypeElement, type);
            } // try
            catch (Exception ex)
            {
                Trace.WriteLine("Exception in IsElementOfType Function: " + ex.Message);
            }
            return false;
        } // IsElementOfType(declaredTypeExpression, type)