home *** CD-ROM | disk | FTP | other *** search
- package espresso;
-
- class Self extends AST {
- Obj constructor;
-
- void print(int var1) {
- System.out.print(super.tag == 81 ? "super" : "this");
- }
-
- Item gen() {
- if (this.constructor != null) {
- return new BasedItem(super.pos, Item.nonvirtualItem, this.constructor);
- } else {
- return super.tag == 81 ? Item.superItem : Item.thisItem;
- }
- }
-
- AST simplify() {
- return this;
- }
-
- Typ attr(Env var1, int var2, Typ var3) {
- super.typ = Typ.errTyp;
- this.constructor = null;
- if (!var1.isStatic) {
- ClassObj var4 = (ClassObj)var1.enclClass.obj;
- if (var4 != null) {
- if (super.tag == 81) {
- var4 = var4.superclass;
- }
-
- if (var2 == 32) {
- this.constructor = Attr.resolveConstructor(super.pos, var1, var4, var3, 2);
- super.typ = this.constructor.typ;
- } else if (Attr.checkKind(super.pos, 12, var2)) {
- super.typ = Attr.checkTyp(super.pos, var4.typ, var3);
- }
- }
- } else {
- Report.error(super.pos, String.valueOf("undefined variable: ").concat(String.valueOf(super.tag == 81 ? "super" : "this")));
- }
-
- return super.typ;
- }
-
- boolean isExpr() {
- return true;
- }
-
- Self(int var1, int var2) {
- super(var1, var2);
- }
- }
-