Exemplo n.º 1
0
        private static void GenerateInlineScriptExpression(ScriptGenerator generator, MemberSymbol symbol, InlineScriptExpression expression)
        {
            ScriptTextWriter writer = generator.Writer;

            string script = expression.Script;
            ICollection <Expression> parameters = expression.Parameters;

            if (parameters != null)
            {
                Debug.Assert(parameters.Count != 0);

                string[] parameterScripts = new string[parameters.Count];
                int      i = 0;

                foreach (Expression parameterExpression in parameters)
                {
                    StringWriter sw = new StringWriter();

                    try {
                        writer.StartLocalWriting(sw);
                        ExpressionGenerator.GenerateExpression(generator, symbol, parameterExpression);

                        parameterScripts[i] = sw.ToString();
                        i++;
                    }
                    finally {
                        writer.StopLocalWriting();
                    }
                }

                script = String.Format(CultureInfo.InvariantCulture, script, parameterScripts);
            }

            writer.Write(script);
        }