bug fixes
[IRC.git] / Robust / src / IR / Tree / BlockNode.java
index 6851ea892bd6ebc2ed73d1f665ca015659b14ef4..47ebb1f5245ff2b52771f7813202e209916928b7 100644 (file)
@@ -1,24 +1,45 @@
 package IR.Tree;
 import java.util.Vector;
+import IR.*;
 
-class BlockNode extends TreeNode {
+public class BlockNode extends TreeNode {
     Vector blockstatements;
     int printStyle=0;
+    protected SymbolTable table;
+
     public final static int NORMAL=0;
     public final static int NOBRACES=1;
     public final static int EXPRLIST=2;
     
     public BlockNode() {
        blockstatements=new Vector();
+       table=new SymbolTable();
+    }
+
+    public SymbolTable getVarTable() {
+       return table;
     }
 
     public void addBlockStatement(BlockStatementNode bsn) {
        blockstatements.add(bsn);
     }
+
+    public void addFirstBlockStatement(BlockStatementNode bsn) {
+       blockstatements.insertElementAt(bsn,0);
+    }
+
     public void setStyle(int style) {
        printStyle=style;
     }
 
+    public int size() {
+       return blockstatements.size();
+    }
+
+    public BlockStatementNode get(int i) {
+       return (BlockStatementNode) blockstatements.get(i);
+    }
+
     public String printNode(int indent) {
        if (printStyle==NORMAL) {
            String st="{\n";
@@ -56,4 +77,8 @@ class BlockNode extends TreeNode {
            return st;
        } else throw new Error();
     }
+    
+    public int kind() {
+       return Kind.BlockNode;
+    }
 }