Blackmire.CppImplWalker.VisitMethodDeclaration C# (CSharp) Метод

VisitMethodDeclaration() публичный Метод

public VisitMethodDeclaration ( Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax node ) : void
node Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax
Результат void
        public override void VisitMethodDeclaration(MethodDeclarationSyntax node)
        {
            bool parentIsInterface = node.Parent is InterfaceDeclarationSyntax;

              var s = model.GetDeclaredSymbol(node);

              cb.AppendIndent();

              // check if function has template arguments
              if (s.IsGenericMethod)
              {
            cb.Append("template <");

            int len = s.TypeArguments.Length;
            for (int i = 0; i < len; ++i)
            {
              cb.Append("typename ");
              cb.Append(s.TypeArguments[i].Name);
              if (i + 1 != len)
            cb.Append(", ");
            }

            cb.Append("> ");
              }

              //cb.Append("virtual ", parentIsInterface || s.IsVirtual);
              cb.Append(node.ReturnType.ToString());
              cb.Append(" ");

              // get owner name, eh? this might not be a class, though
              var parent = node.Parent as ClassDeclarationSyntax;
              if (parent == null) return;
              cb.Append(parent.Identifier.Text).Append("::");
              cb.Append(node.Identifier.ToString());
              cb.Append("(");
              var pars = node.ParameterList.Parameters;
              for (int i = 0; i < pars.Count; ++i)
              {
            var p = pars[i];
            var symbol = model.GetDeclaredSymbol(p);
            cb.Append(ArgumentTypeFor(symbol.Type)).Append(" ").Append(p.Identifier.ToString());
            if (i + 1 < pars.Count)
              cb.Append(", ");
              }
              cb.AppendLine(")"); // end of parameter block, body follows

              cb.Scope(() =>
              {
            base.VisitMethodDeclaration(node);
              });

              cb.AppendLine(); // put a blank line after the method
        }