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

  1. package espresso;
  2.  
  3. class Self extends AST {
  4.    Obj constructor;
  5.  
  6.    void print(int var1) {
  7.       System.out.print(super.tag == 81 ? "super" : "this");
  8.    }
  9.  
  10.    Item gen() {
  11.       if (this.constructor != null) {
  12.          return new BasedItem(super.pos, Item.nonvirtualItem, this.constructor);
  13.       } else {
  14.          return super.tag == 81 ? Item.superItem : Item.thisItem;
  15.       }
  16.    }
  17.  
  18.    AST simplify() {
  19.       return this;
  20.    }
  21.  
  22.    Typ attr(Env var1, int var2, Typ var3) {
  23.       super.typ = Typ.errTyp;
  24.       this.constructor = null;
  25.       if (!var1.isStatic) {
  26.          ClassObj var4 = (ClassObj)var1.enclClass.obj;
  27.          if (var4 != null) {
  28.             if (super.tag == 81) {
  29.                var4 = var4.superclass;
  30.             }
  31.  
  32.             if (var2 == 32) {
  33.                this.constructor = Attr.resolveConstructor(super.pos, var1, var4, var3, 2);
  34.                super.typ = this.constructor.typ;
  35.             } else if (Attr.checkKind(super.pos, 12, var2)) {
  36.                super.typ = Attr.checkTyp(super.pos, var4.typ, var3);
  37.             }
  38.          }
  39.       } else {
  40.          Report.error(super.pos, String.valueOf("undefined variable: ").concat(String.valueOf(super.tag == 81 ? "super" : "this")));
  41.       }
  42.  
  43.       return super.typ;
  44.    }
  45.  
  46.    boolean isExpr() {
  47.       return true;
  48.    }
  49.  
  50.    Self(int var1, int var2) {
  51.       super(var1, var2);
  52.    }
  53. }
  54.