public static IR1Top RMethodDeclaration(this IR1Top r1Top, IGMethodDeclaration gMethodDeclaration)
        {
            r1Top.Sb.RenderMethodDeclarationPreambleStringBuilder(gMethodDeclaration, r1Top.Indent, r1Top.Eol, r1Top.Ct);
            r1Top.RArgument(gArguments: gMethodDeclaration.GArguments);
            if (gMethodDeclaration.GBase != "")
            {
                r1Top.Sb.Append($") : base({gMethodDeclaration.GBase})");
            }
            else if (gMethodDeclaration.GThis != "")
            {
                r1Top.Sb.Append($") : this({gMethodDeclaration.GThis})");
            }
            else
            {
                r1Top.Sb.Append($")");
            }
            if (!gMethodDeclaration.IsForInterface)
            {
                r1Top.Sb.Append($" {{{r1Top.Eol}");
            }
            else
            {
                r1Top.Sb.Append($";{r1Top.Eol}");
            }

            return(r1Top);
        }
示例#2
0
 public GMethod(IGMethodDeclaration gDeclaration = default, IGBody gBody = default,
                IGComment gComment = default, bool isForInterface        = false,
                IGStateConfiguration gStateConfiguration = default)
 {
     GDeclaration        = gDeclaration == default ? new GMethodDeclaration() : gDeclaration;
     GBody               = gBody == default ? new GBody() : gBody;
     GComment            = gComment == default ? new GComment() : gComment;
     IsForInterface      = isForInterface;
     GStateConfiguration = gStateConfiguration == default ? new GStateConfiguration() : gStateConfiguration;
     Id = new GMethodId <TValue>();
 }
 public static StringBuilder RenderMethodDeclarationPreambleStringBuilder(this StringBuilder sb, IGMethodDeclaration gMethodDeclaration, StringBuilder indent, string eol, CancellationToken?ct = default)
 {
     ct?.ThrowIfCancellationRequested();
     sb.Append($"{indent}{gMethodDeclaration.GVisibility} ");
     sb.Append($"{gMethodDeclaration.GAccessModifier} ");
     if (gMethodDeclaration.IsStatic != null && (bool)gMethodDeclaration.IsStatic)
     {
         sb.Append("static ");
     }
     if (gMethodDeclaration.IsConstructor != null && !(bool)gMethodDeclaration.IsConstructor)
     {
         sb.Append($"{gMethodDeclaration.GType} ");
     }
     sb.Append($"{gMethodDeclaration.GName}(");
     return(sb);
 }