001    /* Copyright 2000, 2001, Compaq Computer Corporation */
002    
003    package javafe.tc;
004    
005    import javafe.ast.*;
006    import java.io.OutputStream;
007    
008    public class TypePrint extends DelegatingPrettyPrint
009    {
010      // Caller must establish del != null!
011      //@ requires false;
012      public TypePrint() { }
013    
014      //@ requires self != null && del != null;
015      public TypePrint(PrettyPrint self, PrettyPrint del) {
016        super(self, del);
017      }
018    
019      //@ also
020      //@ requires o != null;
021      public void print(OutputStream o, int ind, VarInit e) {
022        if (e instanceof Expr) {
023          Type t = FlowInsensitiveChecks.getTypeOrNull((Expr)e);
024    
025          write(o, "(/*");
026          if (t==null)
027            write(o, "UNAVAILABLE");
028          else
029            write(o, Types.printName(t));
030          write(o, "*/ ");
031    
032          del.print(o, ind, e);
033          write(o, ')');
034        } else del.print(o, ind, e);
035      }
036    } // end of class TypePrint
037    
038    /*
039     * Local Variables:
040     * Mode: Java
041     * fill-column: 85
042     * End:
043     */
044