home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / VPage / Java.bin / CLASSES.ZIP / sun / tools / tree / Node.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-07-08  |  2.3 KB  |  73 lines

  1. package sun.tools.tree;
  2.  
  3. import java.io.ByteArrayOutputStream;
  4. import java.io.PrintStream;
  5. import sun.tools.java.ClassNotFound;
  6. import sun.tools.java.CompilerError;
  7. import sun.tools.java.Constants;
  8. import sun.tools.java.Environment;
  9. import sun.tools.java.Type;
  10.  
  11. public class Node implements Constants, Cloneable {
  12.    // $FF: renamed from: op int
  13.    int field_0;
  14.    int where;
  15.  
  16.    Node(int var1, int var2) {
  17.       this.field_0 = var1;
  18.       this.where = var2;
  19.    }
  20.  
  21.    public int getOp() {
  22.       return this.field_0;
  23.    }
  24.  
  25.    public int getWhere() {
  26.       return this.where;
  27.    }
  28.  
  29.    public Expression convert(Environment var1, Context var2, Type var3, Expression var4) {
  30.       if (!var4.type.isType(13) && !var3.isType(13)) {
  31.          if (var4.type.equals(var3)) {
  32.             return var4;
  33.          } else {
  34.             try {
  35.                if (var4.fitsType(var1, var2, var3)) {
  36.                   return new ConvertExpression(this.where, var3, var4);
  37.                }
  38.  
  39.                if (var1.explicitCast(var4.type, var3)) {
  40.                   var1.error(this.where, "explicit.cast.needed", Constants.opNames[this.field_0], var4.type, var3);
  41.                   return new ConvertExpression(this.where, var3, var4);
  42.                }
  43.             } catch (ClassNotFound var6) {
  44.                var1.error(this.where, "class.not.found", var6.name, Constants.opNames[this.field_0]);
  45.             }
  46.  
  47.             var1.error(this.where, "incompatible.type", Constants.opNames[this.field_0], var4.type, var3);
  48.             return new ConvertExpression(this.where, Type.tError, var4);
  49.          }
  50.       } else {
  51.          return var4;
  52.       }
  53.    }
  54.  
  55.    public void print(PrintStream var1) {
  56.       throw new CompilerError("print");
  57.    }
  58.  
  59.    public Object clone() {
  60.       try {
  61.          return super.clone();
  62.       } catch (CloneNotSupportedException var1) {
  63.          throw new InternalError();
  64.       }
  65.    }
  66.  
  67.    public String toString() {
  68.       ByteArrayOutputStream var1 = new ByteArrayOutputStream();
  69.       this.print(new PrintStream(var1));
  70.       return var1.toString();
  71.    }
  72. }
  73.