Пример #1
0
        public ICode Printout()
        {
            var code = new CodeSpan(Name);

            if (Parameters.Any())
            {
                code.Append("<");
                code.Append(Parameters, ",");
                code.Append(">");
            }
            return(code);
        }
Пример #2
0
        public override ICode Printout()
        {
            CodeSpan code = new CodeSpan(this, Name).Prepend(this.Modifier.HasReassignable ? "var " : "let ");

            if (this.TypeName != null)
            {
                code.Append(" of ").Append(this.TypeName);
            }
            if (this.InitValue != null)
            {
                code.Append(" " + (this.ReadMode == ExpressionReadMode.ReadRequired ? "<-" : "=") + " ").Append(this.InitValue);
            }
            if (this.ReadMode == ExpressionReadMode.ReadRequired)
            {
                code.Prepend("(").Append(")");
            }

            return(code);
        }
Пример #3
0
        public override ICode Printout()
        {
            var code = new CodeSpan("throw");

            if (Expr != null)
            {
                code.Append(" ").Append(Expr.Printout());
            }
            return(code);
        }
Пример #4
0
        public ICode Printout()
        {
            var code = new CodeSpan(IsBreak ? "break" : "continue");

            if (Label != null)
            {
                code.Append(" ").Append(Label);
            }
            return(code);
        }
Пример #5
0
        public override ICode Printout()
        {
            var code = new CodeSpan($"new {(this.IsHeapInitialization ? "*" : "")}").Append(allocTypeName).Append("(")
                       .Append(InitConstructorCall.UserArguments, ",")
                       .Append(")");

            if (this.objectInitialization.Any())
            {
                code.Append("{").Append(this.objectInitialization, ",").Append("}");
            }

            return(code);
        }
Пример #6
0
        public ICode Printout()
        {
            string variadic_str = this.Variadic.ToString();

            if (variadic_str != "")
            {
                variadic_str = " " + variadic_str;
            }
            var code = new CodeSpan(this.Name).Append(this.IsNameRequired ? ": " : " ").Append(this.ElementTypeName)
                       .Append(variadic_str);

            if (this.IsOptional)
            {
                code.Append(" = ").Append(DefaultValue);
            }
            return(code);
        }