/// <summary> /// outputs a semicolon for an empty block, just the statement for a single-statement block, /// and recurses to the Block visitor for mutiple-statement blocks /// </summary> /// <param name="block">block to output</param> private void OutputBlock(JsBlock block) { if (block != null && block.ForceBraces) { // always output the braces OutputBlockWithBraces(block); } else if (block == null || block.Count == 0) { // semicolon-replacement cannot generate an empty statement OutputPossibleLineBreak(';'); MarkSegment(block, null, block.IfNotNull(b => b.Context)); } else if (block.Count == 1) { Indent(); NewLine(); if (block[0].HideFromOutput) { // semicolon-replacement cannot generate an empty statement OutputPossibleLineBreak(';'); MarkSegment(block, null, block.Context); } else if (block[0] is JsImportantComment) { // not a REAL statement, so follow the comment with a semicolon to // be the actual statement for this block. block[0].Accept(this); OutputPossibleLineBreak(';'); MarkSegment(block, null, block.Context); } else { m_startOfStatement = true; block[0].Accept(this); } Unindent(); } else { // always output the braces OutputBlockWithBraces(block); } }