1 package net.sourceforge.phpdt.internal.compiler.ast;
8 * @author Matthieu Casanova
10 public class Block extends Statement {
12 /** An array of statements inside the block. */
13 public Statement[] statements;
17 * @param statements the statements
18 * @param sourceStart starting offset
19 * @param sourceEnd ending offset
21 public Block(Statement[] statements,int sourceStart, int sourceEnd) {
22 super(sourceStart, sourceEnd);
23 this.statements = statements;
26 public boolean isEmptyBlock() {
27 return statements == null;
30 public String toString(int tab) {
31 final String s = AstNode.tabString(tab);
32 final StringBuffer buff = new StringBuffer(s);
33 buff.append("{\n"); //$NON-NLS-1$
34 if (this.statements == null) {
35 for (int i = 0; i < statements.length; i++) {
36 buff.append(statements[i].toString(tab+1)).append(";\n");//$NON-NLS-1$
39 buff.append("}\n"); //$NON-NLS-1$
40 return buff.toString();