Example #1
0
        public override object VisitTypeFunction(TypeFunctionContext context)
        {
            var obj  = "";
            var @in  = ((string)Visit(context.typeFunctionParameterClause(0)));
            var @out = ((string)Visit(context.typeFunctionParameterClause(1)));

            if (@out.Length == 0)
            {
                if (@in.Length == 0)
                {
                    obj = "Action";
                }
                else
                {
                    obj = (new System.Text.StringBuilder().Append("Action<").Append(@in).Append(">")).To_Str();
                }
            }
            else
            {
                if (@out.First_index_of(",") >= 0)
                {
                    @out = (new System.Text.StringBuilder().Append("(").Append(@out).Append(")")).To_Str();
                }
                if (@in.Length == 0)
                {
                    obj = (new System.Text.StringBuilder().Append("Func<").Append(@out).Append(">")).To_Str();
                }
                else
                {
                    obj = (new System.Text.StringBuilder().Append("Func<").Append(@in).Append(", ").Append(@out).Append(">")).To_Str();
                }
            }
            return(obj);
        }
Example #2
0
        public override object VisitTypeFunction([NotNull] TypeFunctionContext context)
        {
            var obj  = "";
            var @in  = (string)Visit(context.typeFunctionParameterClause(0));
            var @out = (string)Visit(context.typeFunctionParameterClause(1));

            if (@out.Length == 0)
            {
                if (@in.Length == 0)
                {
                    obj += "Action";
                }
                else
                {
                    obj += "Action<";
                    obj += @in;
                    obj += ">";
                }
            }
            else
            {
                if (@out.IndexOf(",") >= 0)
                {
                    @out = "(" + @out + ")";
                }
                if (@in.Length == 0)
                {
                    obj += "Func<";
                    obj += @out;
                    obj += ">";
                }
                else
                {
                    obj += "Func<";
                    obj += @in + ", ";
                    obj += @out;
                    obj += ">";
                }
            }
            return(obj);
        }
Example #3
0
        public override object VisitTypeFunction(TypeFunctionContext context)
        {
            var obj  = "";
            var @in  = (string)(Visit(context.typeFunctionParameterClause(0)));
            var @out = (string)(Visit(context.typeFunctionParameterClause(1)));

            if (context.t.Type == Right_Arrow)
            {
                if (@out.Length == 0)
                {
                    if (@in.Length == 0)
                    {
                        obj = "Action";
                    }
                    else
                    {
                        obj = (new System.Text.StringBuilder().Append("Action<").Append(@in).Append(">")).to_str();
                    }
                }
                else
                {
                    if (@out.first_index_of(",") >= 0)
                    {
                        @out = (new System.Text.StringBuilder().Append("(").Append(@out).Append(")")).to_str();
                    }
                    if (context.y != null)
                    {
                        @out = (new System.Text.StringBuilder().Append(IEnum).Append("<").Append(@out).Append(">")).to_str();
                    }
                    if (@in.Length == 0)
                    {
                        obj = (new System.Text.StringBuilder().Append("Func<").Append(@out).Append(">")).to_str();
                    }
                    else
                    {
                        obj = (new System.Text.StringBuilder().Append("Func<").Append(@in).Append(", ").Append(@out).Append(">")).to_str();
                    }
                }
            }
            else
            {
                if (@out.Length == 0)
                {
                    if (@in.Length == 0)
                    {
                        obj = (new System.Text.StringBuilder().Append("Func<").Append(Task).Append(">")).to_str();
                    }
                    else
                    {
                        obj = (new System.Text.StringBuilder().Append("Func<").Append(@in).Append(", ").Append(Task).Append(">")).to_str();
                    }
                }
                else
                {
                    if (context.y != null)
                    {
                        @out = (new System.Text.StringBuilder().Append(IEnum).Append("<(").Append(@out).Append(")>")).to_str();
                    }
                    if (@in.Length == 0)
                    {
                        obj = (new System.Text.StringBuilder().Append("Func<").Append(Task).Append("<").Append(@out).Append(">>")).to_str();
                    }
                    else
                    {
                        obj = (new System.Text.StringBuilder().Append("Func<").Append(@in).Append(", ").Append(Task).Append("<").Append(@out).Append(">>")).to_str();
                    }
                }
            }
            return(obj);
        }