home *** CD-ROM | disk | FTP | other *** search
- package espresso;
-
- class Select extends IdRef {
- static Name PeriodS = Name.fromString(".");
- static Name periodS = Name.fromString(".");
- AST struc;
-
- void print(int var1) {
- this.struc.print(11);
- System.out.print(String.valueOf(".").concat(String.valueOf(super.name)));
- }
-
- public Name fullName() {
- return ((IdRef)this.struc).fullName().append(PeriodS).append(super.name);
- }
-
- Item gen() {
- if (super.obj instanceof ClassObj) {
- return new ClassItem((ClassObj)super.obj);
- } else if (super.obj.isConstant()) {
- return new ImmediateItem(((VarObj)super.obj).constValue());
- } else if (super.obj == Predef.lengthVar) {
- this.struc.genLoad();
- Gen.emitop(190);
- return Item.stackItem;
- } else if ((super.obj.modifiers & 8) != 0) {
- return new BasedItem(super.pos, (Item)null, super.obj);
- } else {
- 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);
- }
- }
-
- AST simplify() {
- this.struc = this.struc.simplify();
- return this;
- }
-
- void markCaptured(Bits var1) {
- this.struc.markCaptured(var1);
- }
-
- Typ attr(Env var1, int var2, Typ var3) {
- int var4 = (var2 & -4) == 0 ? 1 : 31;
- Typ var5 = this.struc.attr(var1, var4, Typ.anyTyp);
- switch (var5.tag) {
- case 11:
- case 13:
- ClassObj var6 = var5.obj;
- Attr.fixupScope(super.pos, var6);
- int var7 = this.struc instanceof Self ? 2 : 1;
- super.obj = Attr.resolve(super.pos, var1, var6.scope, var2, var3, super.name, var7);
- if (this.struc instanceof IdRef && ((IdRef)this.struc).obj instanceof ClassObj) {
- if (var1.enclClass.obj.typ.subtype(var6.typ)) {
- super.obj = Attr.checkNonAbstract(super.pos, super.obj);
- } else {
- super.obj = Attr.checkStatic(super.pos, super.obj);
- }
- } else if (this.struc instanceof Self) {
- if (var1.isSelfCall) {
- super.obj = Attr.checkStaticOrFinal(super.pos, super.obj);
- } else {
- super.obj = Attr.checkNonAbstract(super.pos, super.obj);
- }
- }
- break;
- case 12:
- case 14:
- case 16:
- default:
- Attr.checkObjectTyp(super.pos, var5);
- super.obj = Typ.errObj;
- break;
- case 15:
- Report.error(super.pos, "null cannot be dereferenced");
- super.obj = Typ.errObj;
- break;
- case 17:
- super.obj = Attr.resolve(super.pos, var1, Predef.scope, var2, var3, var5.obj.fullname.append(PeriodS).append(super.name), 0);
- }
-
- super.typ = Attr.checkTyp(super.pos, super.obj.typ, var3);
- return super.typ;
- }
-
- boolean isType() {
- return this.struc.isType();
- }
-
- boolean isExpr() {
- return this.struc.isExpr();
- }
-
- Select(int var1, AST var2, Name var3) {
- super(var1, 2, var3);
- this.struc = var2;
- }
- }
-