Beispiel #1
0
        protected virtual BoundCallExpression RewriteCallExpression(BoundCallExpression node)
        {
            ImmutableArray <BoundExpression> .Builder builder = null;

            for (var i = 0; i < node.Argument.Length; i++)
            {
                var oldArgument  = node.Argument[i];
                var newArguments = RewriteExpression(oldArgument);
                if (newArguments != oldArgument)
                {
                    if (builder == null)
                    {
                        builder = ImmutableArray.CreateBuilder <BoundExpression>(node.Argument.Length);
                        for (var j = 0; j < i; j++)
                        {
                            builder.Add(node.Argument[j]);
                        }
                    }
                }
                if (builder != null)
                {
                    builder.Add(newArguments);
                }
            }
            if (builder == null)
            {
                return(node);
            }

            return(new BoundCallExpression(node.Function, builder.MoveToImmutable()));
        }
Beispiel #2
0
        private static void WriteCallExpression(BoundCallExpression node, IndentedTextWriter writer)
        {
            writer.WriteIdentifier(node.Function.Name);
            writer.WritePunctuation("(");

            var isFirst = true;

            foreach (var argument in node.Argument)
            {
                if (isFirst)
                {
                    isFirst = false;
                }
                else
                {
                    writer.WritePunctuation(", ");
                }

                argument.WriteTo(writer);
            }

            writer.WritePunctuation(")");
        }