home *** CD-ROM | disk | FTP | other *** search
/ Tutto per Internet / Internet.iso / soft95 / Java / espints / espinst.exe / classes / espresso / CondItem.class (.txt) < prev    next >
Encoding:
Java Class File  |  1996-02-28  |  1.4 KB  |  66 lines

  1. package espresso;
  2.  
  3. class CondItem extends Item {
  4.    int opcode;
  5.    Label falseJumps;
  6.    Label trueJumps;
  7.  
  8.    CondItem negate() {
  9.       return new CondItem(Gen.negate(this.opcode), this.falseJumps, this.trueJumps);
  10.    }
  11.  
  12.    Label jumpFalse() {
  13.       return Gen.mergeLabels(this.falseJumps, Gen.branch(Gen.negate(this.opcode)));
  14.    }
  15.  
  16.    Label jumpTrue() {
  17.       return Gen.mergeLabels(this.trueJumps, Gen.branch(this.opcode));
  18.    }
  19.  
  20.    CondItem mkCond() {
  21.       return this;
  22.    }
  23.  
  24.    void stash(Typ var1, int var2) {
  25.       throw new CompilerError("stash");
  26.    }
  27.  
  28.    void drop(Typ var1) {
  29.       this.load(var1);
  30.       Item.stackItem.drop(var1);
  31.    }
  32.  
  33.    void duplicate(Typ var1) {
  34.       this.load(var1);
  35.       Item.stackItem.duplicate(var1);
  36.    }
  37.  
  38.    void load(Typ var1) {
  39.       Label var2 = null;
  40.       Label var3 = this.jumpFalse();
  41.       if (this.trueJumps != null || this.opcode != Gen.dontgoto) {
  42.          Gen.resolve(this.trueJumps);
  43.          Gen.emitop(4);
  44.          var2 = Gen.branch(167);
  45.       }
  46.  
  47.       if (var3 != null) {
  48.          Gen.resolve(var3);
  49.          Gen.emitop(3);
  50.       }
  51.  
  52.       Gen.resolve(var2);
  53.    }
  54.  
  55.    CondItem(int var1) {
  56.       this(var1, (Label)null, (Label)null);
  57.    }
  58.  
  59.    CondItem(int var1, Label var2, Label var3) {
  60.       super(12);
  61.       this.opcode = var1;
  62.       this.trueJumps = var2;
  63.       this.falseJumps = var3;
  64.    }
  65. }
  66.