Example #1
0
        public override object VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data)
        {
            AnonymousMethodReturnType amrt = new AnonymousMethodReturnType(resolver.CompilationUnit);

            foreach (ParameterDeclarationExpression param in anonymousMethodExpression.Parameters)
            {
                amrt.MethodParameters.Add(NRefactoryASTConvertVisitor.CreateParameter(param, resolver.CallingMember as IMethod, resolver.CallingClass, resolver.CompilationUnit));
            }
            return(amrt);
        }
Example #2
0
        internal LambdaReturnType(AnonymousMethodExpression expression, NRefactoryResolver resolver)
            : base(resolver.CompilationUnit)
        {
            this.resolver = resolver;

            if (expression.HasParameterList)
            {
                base.MethodParameters = new List <IParameter>();
                foreach (ParameterDeclarationExpression param in expression.Parameters)
                {
                    base.MethodParameters.Add(NRefactoryASTConvertVisitor.CreateParameter(param, resolver.CallingMember as IMethod, resolver.CallingClass, resolver.CompilationUnit));
                }
            }
            expression.Body.AcceptVisitor(new ReturnStatementFinder(returnExpressions), null);
        }
Example #3
0
        internal LambdaReturnType(LambdaExpression expression, NRefactoryResolver resolver)
            : base(resolver.CompilationUnit)
        {
            this.resolver         = resolver;
            this.lambdaExpression = expression;

            base.MethodParameters = new List <IParameter>();
            foreach (ParameterDeclarationExpression param in expression.Parameters)
            {
                base.MethodParameters.Add(NRefactoryASTConvertVisitor.CreateParameter(param, resolver.CallingMember as IMethod, resolver.CallingClass, resolver.CompilationUnit));
            }
            if (expression.ExpressionBody.IsNull)
            {
                expression.StatementBody.AcceptVisitor(new ReturnStatementFinder(returnExpressions), null);
            }
            else
            {
                returnExpressions.Add(expression.ExpressionBody);
            }
        }