Beispiel #1
0
        public override object VisitList([NotNull] ListContext context)
        {
            var type   = "object";
            var result = new Result();

            for (int i = 0; i < context.expression().Length; i++)
            {
                var r = (Result)Visit(context.expression(i));
                if (i == 0)
                {
                    type         = (string)r.data;
                    result.text += r.text;
                }
                else
                {
                    if (type != (string)r.data)
                    {
                        type = "object";
                    }
                    result.text += "," + r.text;
                }
            }
            result.data = $"{lst}<{type}>";
            result.text = $"(new {result.data}(){{ {result.text} }})";
            return(result);
        }
Beispiel #2
0
        public override object VisitList(ListContext context)
        {
            var type   = Any;
            var result = (new Result());

            foreach (var i in range(0, context.expression().Length - 1, 1, true, true))
            {
                var r = (Result)(Visit(context.expression(i)));
                if (i == 0)
                {
                    type         = (string)(r.data);
                    result.text += r.text;
                }
                else
                {
                    if (type != ((string)(r.data)))
                    {
                        type = Any;
                    }
                    result.text += "," + r.text;
                }
            }
            result.data = (new System.Text.StringBuilder().Append(Lst).Append("<").Append(type).Append(">")).to_str();
            result.text = (new System.Text.StringBuilder().Append("(new ").Append(result.data).Append("(){ ").Append(result.text).Append(" })")).to_str();
            return(result);
        }