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

  1. package espresso;
  2.  
  3. class Select extends IdRef {
  4.    static Name PeriodS = Name.fromString(".");
  5.    static Name periodS = Name.fromString(".");
  6.    AST struc;
  7.  
  8.    void print(int var1) {
  9.       this.struc.print(11);
  10.       System.out.print(String.valueOf(".").concat(String.valueOf(super.name)));
  11.    }
  12.  
  13.    public Name fullName() {
  14.       return ((IdRef)this.struc).fullName().append(PeriodS).append(super.name);
  15.    }
  16.  
  17.    Item gen() {
  18.       if (super.obj instanceof ClassObj) {
  19.          return new ClassItem((ClassObj)super.obj);
  20.       } else if (super.obj.isConstant()) {
  21.          return new ImmediateItem(((VarObj)super.obj).constValue());
  22.       } else if (super.obj == Predef.lengthVar) {
  23.          this.struc.genLoad();
  24.          Gen.emitop(190);
  25.          return Item.stackItem;
  26.       } else if ((super.obj.modifiers & 8) != 0) {
  27.          return new BasedItem(super.pos, (Item)null, super.obj);
  28.       } else {
  29.          return this.struc instanceof IdRef && ((IdRef)this.struc).obj instanceof ClassObj ? new BasedItem(super.pos, Item.nonvirtualItem, super.obj) : new BasedItem(super.pos, this.struc.gen(), super.obj);
  30.       }
  31.    }
  32.  
  33.    AST simplify() {
  34.       this.struc = this.struc.simplify();
  35.       return this;
  36.    }
  37.  
  38.    void markCaptured(Bits var1) {
  39.       this.struc.markCaptured(var1);
  40.    }
  41.  
  42.    Typ attr(Env var1, int var2, Typ var3) {
  43.       int var4 = (var2 & -4) == 0 ? 1 : 31;
  44.       Typ var5 = this.struc.attr(var1, var4, Typ.anyTyp);
  45.       switch (var5.tag) {
  46.          case 11:
  47.          case 13:
  48.             ClassObj var6 = var5.obj;
  49.             Attr.fixupScope(super.pos, var6);
  50.             int var7 = this.struc instanceof Self ? 2 : 1;
  51.             super.obj = Attr.resolve(super.pos, var1, var6.scope, var2, var3, super.name, var7);
  52.             if (this.struc instanceof IdRef && ((IdRef)this.struc).obj instanceof ClassObj) {
  53.                if (var1.enclClass.obj.typ.subtype(var6.typ)) {
  54.                   super.obj = Attr.checkNonAbstract(super.pos, super.obj);
  55.                } else {
  56.                   super.obj = Attr.checkStatic(super.pos, super.obj);
  57.                }
  58.             } else if (this.struc instanceof Self) {
  59.                if (var1.isSelfCall) {
  60.                   super.obj = Attr.checkStaticOrFinal(super.pos, super.obj);
  61.                } else {
  62.                   super.obj = Attr.checkNonAbstract(super.pos, super.obj);
  63.                }
  64.             }
  65.             break;
  66.          case 12:
  67.          case 14:
  68.          case 16:
  69.          default:
  70.             Attr.checkObjectTyp(super.pos, var5);
  71.             super.obj = Typ.errObj;
  72.             break;
  73.          case 15:
  74.             Report.error(super.pos, "null cannot be dereferenced");
  75.             super.obj = Typ.errObj;
  76.             break;
  77.          case 17:
  78.             super.obj = Attr.resolve(super.pos, var1, Predef.scope, var2, var3, var5.obj.fullname.append(PeriodS).append(super.name), 0);
  79.       }
  80.  
  81.       super.typ = Attr.checkTyp(super.pos, super.obj.typ, var3);
  82.       return super.typ;
  83.    }
  84.  
  85.    boolean isType() {
  86.       return this.struc.isType();
  87.    }
  88.  
  89.    boolean isExpr() {
  90.       return this.struc.isExpr();
  91.    }
  92.  
  93.    Select(int var1, AST var2, Name var3) {
  94.       super(var1, 2, var3);
  95.       this.struc = var2;
  96.    }
  97. }
  98.