Пример #1
0
        public override object VisitLambdaExpression(CsharpSubsetParser.LambdaExpressionContext context)
        {
            string body    = null;
            bool   isTyped = false;

            if (context.lambdaBody() != null)
            {
                body    = GetContextSource(context.lambdaBody());
                isTyped = context.lambdaBody().returnStmnt() != null;
            }
            else
            {
                body    = "\nreturn " + GetContextSource(context.mathExpression()) + ";\n";
                isTyped = true;
            }


            var          lambdaExpressionInterval = new Interval(context.Start.StartIndex, context.Stop.StopIndex);
            var          argList = GetArgList(context);
            var          classDefinitionContext = FindClassDefinitionContext(context);
            var          clasStartIndex         = classDefinitionContext.Start.StartIndex;
            RefactorData data = new RefactorData(argList, body, lambdaExpressionInterval, clasStartIndex, isTyped);

            RefactorDataList.Add(data);


            return(base.VisitLambdaExpression(context));
        }
Пример #2
0
 public override object Visit(IParseTree tree)
 {
     RefactorDataList.Clear();
     return(base.Visit(tree));
 }