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

  1. package espresso;
  2.  
  3. class DoLoop extends JumpTarget {
  4.    AST body;
  5.    AST cond;
  6.  
  7.    void print(int var1) {
  8.       System.out.print("do ");
  9.       this.body.print();
  10.       System.out.print(" while (");
  11.       this.cond.print();
  12.       System.out.print(")");
  13.    }
  14.  
  15.    Item gen() {
  16.       int var1 = Gen.curPc();
  17.       this.body.genDrop();
  18.       Gen.resolve(super.cont);
  19.       Gen.statBegin(this.cond.pos);
  20.       CondItem var2 = this.cond.gen().mkCond();
  21.       Gen.resolve(var2.jumpTrue(), var1);
  22.       Gen.resolve(var2.falseJumps);
  23.       Gen.resolve(super.exit);
  24.       return Item.voidItem;
  25.    }
  26.  
  27.    AST simplify() {
  28.       this.cond = this.cond.simplify();
  29.       this.body = this.body.simplify();
  30.       return this;
  31.    }
  32.  
  33.    void markCaptured(Bits var1) {
  34.       var1.orSet(super.contCapt);
  35.       this.body.markCaptured(var1);
  36.       this.cond.markCaptured(var1);
  37.       super.contCapt.orSet(var1);
  38.       var1.orSet(super.exitCapt);
  39.    }
  40.  
  41.    Typ attr(Env var1, int var2, Typ var3) {
  42.       Env var4 = new Env(var1, this);
  43.       super.typ = this.body.attr(var4, 12, var3);
  44.       this.cond.attr(var1, 12, Typ.booleanTyp);
  45.       return super.typ;
  46.    }
  47.  
  48.    DoLoop(int var1, AST var2, AST var3) {
  49.       super(var1, 8);
  50.       this.cond = var3;
  51.       this.body = var2;
  52.       super.contCapt = new Bits();
  53.       super.exitCapt = new Bits();
  54.    }
  55. }
  56.