Exemple #1
0
        /// <summary>
        /// Find last declared constructor and makes it the current node.
        /// </summary>
        /// <returns>True if found and made current, false otherwise.</returns>
        public T SelectLastConstructorDeclaration()
        {
            SelectOverloadedConstructorDeclarations();
            var result = CurrentNodesList?.LastOrDefault();

            NextStep(result);
            return(Composer);
        }
Exemple #2
0
        /// <summary>
        /// Finds a method with a specified name (if such exists) and makes it the current node. If there is method overloading the first one is made current.
        /// </summary>
        /// <param name="methodName">Method's name</param>
        /// <returns>True if found and made current, false otherwise.</returns>
        public T SelectMethodDeclaration([NotBlank] string methodName)
        {
            SelectOverloadedMethodDeclarations(methodName);

            var result = CurrentNodesList?.FirstOrDefault();

            NextStep(result);
            return(Composer);
        }
Exemple #3
0
        public MethodComposer ToMethodComposer() //TODO: Solve the situation between Constructors, Coverter Operators, Operators.
        {
            if (CurrentNode != null && CurrentNode is BaseMethodDeclarationSyntax)
            {
                return(new MethodComposer(CurrentNode as MethodDeclarationSyntax, Composer));
            }

            if (CurrentNodesList != null && CurrentNodesList.Any())
            {
                if (CurrentNodesList.First() is BaseMethodDeclarationSyntax)
                {
                    return(new MethodComposer(CurrentNodesList.Cast <MethodDeclarationSyntax>().ToList()));
                }
            }

            return(null);
        }