Beispiel #1
0
            private static StringBuilder Print(MemberCall call, StringBuilder sb, int depth, bool openNewLine = false, bool closeNewLine = false, bool useCurly = false)
            {
                var openParen  = useCurly ? "{" : "(";
                var closeParen = useCurly ? "}" : ")";

                Print(call.Name, sb, depth);
                MethodCall methodCall = call as MethodCall;

                if (methodCall == null)
                {
                    return(sb);
                }
                if (methodCall.Arguments == null || !methodCall.Arguments.Any( ))
                {
                    Print(openParen + closeParen, sb, 0); return(sb);
                }
                sb = openNewLine ? Print(openParen, PrintNewLine(sb), depth) : Print(openParen, sb, 0);
                PrintNewLine(sb);
                bool needComma = false;

                foreach (var block in methodCall.Arguments)
                {
                    if (needComma)
                    {
                        Print(",", sb, 0); PrintNewLine(sb);
                    }
                    if (block is string)
                    {
                        Print((string)block, sb, depth + 1);
                    }
                    else if (block is SyntaxKind)
                    {
                        Print("SyntaxKind." + ((SyntaxKind)block).ToString( ), sb, depth + 1);
                    }
                    else if (block is ApiCall)
                    {
                        Print(block as ApiCall, sb, depth + 1, openNewLine: openNewLine, closeNewLine: closeNewLine);
                    }
                    needComma = true;
                }
                return(closeNewLine ? Print(closeParen, PrintNewLine(sb), depth) : Print(closeParen, sb, 0));
            }
Beispiel #2
0
 abstract public string Print(MemberCall node);
Beispiel #3
0
 public override string Print(MemberCall node)
 {
     return(Print(node, new StringBuilder( ), 0).ToString( ));
 }
Beispiel #4
0
 public ApiCall(string parentPropertyName, string factoryMethodName) : this( parentPropertyName )
 { FactoryMethodCall = new MemberCall(factoryMethodName); }