private bool MatchChain([NotNull] IInvocationExpression invocation)
        {
            myCallsCount = 0;

            while (true)
            {
                if (!MatchInvocation(invocation, checkValidity: true))
                {
                    break;
                }

                myCallsCount = myCallsCount + 1;

                var lambdaParameterName = ExtractLambdaParameterName(invocation);
                if (lambdaParameterName != null)
                {
                    myExistingLambdaParameterName = lambdaParameterName;
                }

                var innerInvocation = invocation.GetInnerInvocation();
                if (innerInvocation == null)
                {
                    break;
                }

                invocation = innerInvocation;
            }

            return(myCallsCount >= 2);
        }
Esempio n. 2
0
        private bool MatchChain([NotNull] IInvocationExpression invocation)
        {
            myInvocationsCount = 1;

            while (true)
            {
                var innerInvocation = invocation.GetInnerInvocation();
                if (innerInvocation == null)
                {
                    break;
                }

                invocation         = innerInvocation;
                myInvocationsCount = myInvocationsCount + 1;
            }

            return(myInvocationsCount >= 2);
        }
Esempio n. 3
0
        private void SplitInvocation(
            [NotNull] IInvocationExpression invocation,
            ref LocalList <IDeclarationStatement> declarations,
            ref LocalList <IList <string> > variableNameSuggestions)
        {
            var innerInvocation = invocation.GetInnerInvocation();

            if (innerInvocation == null)
            {
                return;
            }

            var returnType = innerInvocation.Type();

            SplitInvocation(innerInvocation, ref declarations, ref variableNameSuggestions);
            var identifier = AddDeclaration(innerInvocation, returnType, ref declarations, ref variableNameSuggestions);

            SetInvocationTarget(invocation, identifier);
        }