private void AppendPropertyAccessor(SSTPrintingContext c, IKaVEList <IStatement> body, string keyword) { if (body.Any()) { c.Indentation().Text(keyword); c.StatementBlock(body, this); } else { c.Indentation().Text(keyword).Text(";"); } c.NewLine(); }
/// <summary> /// Appends a statement block to the context with correct indentation. /// </summary> /// <param name="block">The block to append.</param> /// <param name="visitor">The visitor to use for printing each statement.</param> /// <param name="withBrackets">If false, opening and closing brackets will be omitted.</param> public SSTPrintingContext StatementBlock(IKaVEList <IStatement> block, ISSTNodeVisitor <SSTPrintingContext> visitor, bool withBrackets = true) { if (!block.Any()) { if (withBrackets) { Text(" { }"); } return(this); } if (withBrackets) { NewLine().Indentation().Text("{"); } IndentationLevel++; foreach (var statement in block) { NewLine(); statement.Accept(visitor, this); } IndentationLevel--; if (withBrackets) { NewLine().Indentation().Text("}"); } return(this); }