Exemplo n.º 1
0
        public string Build(ReadOnlyCollection <FieldDeclaration> fields, Expression groupBy)
        {
            var sb = new StringBuilder();

            sb.Append("function() { emit(");

            sb.Append(groupBy == null ? "1" : _formatter.FormatJavascript(groupBy));

            sb.Append(", ");

            _initMap = new Dictionary <string, string>();
            VisitFieldDeclarationList(fields);
            FormatInit(sb);

            sb.Append("); }");

            return(sb.ToString());
        }
Exemplo n.º 2
0
            protected override NewExpression VisitNew(NewExpression nex)
            {
                var parameters = nex.Constructor.GetParameters();

                for (int i = 0; i < nex.Arguments.Count; i++)
                {
                    if (i > 0)
                    {
                        _js.Append(", ");
                    }
                    _js.AppendFormat("{0}: {1}", parameters[i].Name, _formatter.FormatJavascript(nex.Arguments[i]));
                }
                return(nex);
            }