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 / IncDecExpression.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-07-08  |  3.4 KB  |  108 lines

  1. package sun.tools.tree;
  2.  
  3. import java.util.Hashtable;
  4. import sun.tools.asm.Assembler;
  5. import sun.tools.java.CompilerError;
  6. import sun.tools.java.Constants;
  7. import sun.tools.java.Environment;
  8. import sun.tools.java.Type;
  9.  
  10. public class IncDecExpression extends UnaryExpression {
  11.    public IncDecExpression(int var1, int var2, Expression var3) {
  12.       super(var1, var2, var3.type, var3);
  13.    }
  14.  
  15.    public Vset checkValue(Environment var1, Context var2, Vset var3, Hashtable var4) {
  16.       var3 = super.right.checkAssignOp(var1, var2, var3, var4, this);
  17.       if (super.right.type.inMask(254)) {
  18.          super.type = super.right.type;
  19.       } else {
  20.          if (!super.right.type.isType(13)) {
  21.             var1.error(super.where, "invalid.arg.type", super.right.type, Constants.opNames[super.op]);
  22.          }
  23.  
  24.          super.type = Type.tError;
  25.       }
  26.  
  27.       return var3;
  28.    }
  29.  
  30.    public Vset check(Environment var1, Context var2, Vset var3, Hashtable var4) {
  31.       return this.checkValue(var1, var2, var3, var4);
  32.    }
  33.  
  34.    public Expression inline(Environment var1, Context var2) {
  35.       return this.inlineValue(var1, var2);
  36.    }
  37.  
  38.    public Expression inlineValue(Environment var1, Context var2) {
  39.       super.right = super.right.inlineValue(var1, var2);
  40.       return this;
  41.    }
  42.  
  43.    void codeIncDec(Environment var1, Context var2, Assembler var3, boolean var4, boolean var5, boolean var6) {
  44.       if (super.right.op == 60 && super.type.isType(4) && ((IdentifierExpression)super.right).field.isLocal()) {
  45.          if (var6 && !var5) {
  46.             super.right.codeLoad(var1, var2, var3);
  47.          }
  48.  
  49.          int var9 = ((LocalField)((IdentifierExpression)super.right).field).number;
  50.          int[] var8 = new int[]{var9, var4 ? 1 : -1};
  51.          var3.add(super.where, 132, var8);
  52.          if (var6 && var5) {
  53.             super.right.codeLoad(var1, var2, var3);
  54.          }
  55.  
  56.       } else {
  57.          int var7 = super.right.codeLValue(var1, var2, var3);
  58.          ((Expression)this).codeDup(var1, var2, var3, var7, 0);
  59.          super.right.codeLoad(var1, var2, var3);
  60.          if (var6 && !var5) {
  61.             ((Expression)this).codeDup(var1, var2, var3, super.type.stackSize(), var7);
  62.          }
  63.  
  64.          switch (super.type.getTypeCode()) {
  65.             case 1:
  66.                var3.add(super.where, 18, new Integer(1));
  67.                var3.add(super.where, var4 ? 96 : 100);
  68.                var3.add(super.where, 145);
  69.                break;
  70.             case 2:
  71.                var3.add(super.where, 18, new Integer(1));
  72.                var3.add(super.where, var4 ? 96 : 100);
  73.                var3.add(super.where, 146);
  74.                break;
  75.             case 3:
  76.                var3.add(super.where, 18, new Integer(1));
  77.                var3.add(super.where, var4 ? 96 : 100);
  78.                var3.add(super.where, 147);
  79.                break;
  80.             case 4:
  81.                var3.add(super.where, 18, new Integer(1));
  82.                var3.add(super.where, var4 ? 96 : 100);
  83.                break;
  84.             case 5:
  85.                var3.add(super.where, 20, new Long(1L));
  86.                var3.add(super.where, var4 ? 97 : 101);
  87.                break;
  88.             case 6:
  89.                var3.add(super.where, 18, new Float(1.0F));
  90.                var3.add(super.where, var4 ? 98 : 102);
  91.                break;
  92.             case 7:
  93.                var3.add(super.where, 20, new Double((double)1.0F));
  94.                var3.add(super.where, var4 ? 99 : 103);
  95.                break;
  96.             default:
  97.                throw new CompilerError("invalid type");
  98.          }
  99.  
  100.          if (var6 && var5) {
  101.             ((Expression)this).codeDup(var1, var2, var3, super.type.stackSize(), var7);
  102.          }
  103.  
  104.          super.right.codeStore(var1, var2, var3);
  105.       }
  106.    }
  107. }
  108.