Ejemplo n.º 1
0
        public PostfixTemplateInfo TryCreateInfo(CSharpPostfixTemplateContext context)
        {
            if (context.IsPreciseMode)
            {
                foreach (var expressionContext in context.Expressions)
                {
                    var castExpression = CastExpressionNavigator.GetByOp(expressionContext.Expression);
                    if (castExpression == null)
                    {
                        continue;               // available in auto over cast expressions
                    }
                    var expression = ParenthesizedExpressionNavigator.GetByExpression(castExpression);
                    if (expression != null)
                    {
                        continue;           // not already parenthesized
                    }
                    return(new PostfixTemplateInfo("par", expressionContext));
                }

                return(null);
            }

            var expressions = CSharpPostfixUtis.FindExpressionWithValuesContexts(context);

            if (expressions.Length != 0)
            {
                return(new PostfixTemplateInfo("par", expressions));
            }

            return(null);
        }
Ejemplo n.º 2
0
        public PostfixTemplateInfo TryCreateInfo(CSharpPostfixTemplateContext context)
        {
            if (context.IsPreciseMode)
            {
                return(null);
            }

            var expressions = CSharpPostfixUtis.FindExpressionWithValuesContexts(context);

            if (expressions.Length == 0)
            {
                return(null);
            }

            return(new PostfixTemplateInfo("cast", expressions));
        }
Ejemplo n.º 3
0
        public PostfixTemplateInfo TryCreateInfo(CSharpPostfixTemplateContext context)
        {
            if (context.IsPreciseMode)
            {
                return(null);
            }

            // disable .arg template if .arg hotspot is enabled now
            var textControl = context.ExecutionContext.TextControl;

            if (textControl.GetData(PostfixArgTemplateExpansion) != null)
            {
                return(null);
            }

            var expressions = CSharpPostfixUtis.FindExpressionWithValuesContexts(context, IsNiceArgument);

            if (expressions.Length == 0)
            {
                return(null);
            }

            return(new PostfixTemplateInfo("arg", expressions));
        }