Пример #1
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);
        }
Пример #2
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);
            }
        }