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

  1. package espresso;
  2.  
  3. class Ident extends IdRef {
  4.    void print(int var1) {
  5.       System.out.print(super.name);
  6.    }
  7.  
  8.    Item gen() {
  9.       if (super.obj instanceof ClassObj) {
  10.          return new ClassItem((ClassObj)super.obj);
  11.       } else if (super.obj.isConstant()) {
  12.          return new ImmediateItem(((VarObj)super.obj).constValue());
  13.       } else if (super.obj.owner instanceof FunObj) {
  14.          VarObj var1 = (VarObj)super.obj;
  15.          LocalItem var2 = new LocalItem(super.pos, var1.adr);
  16.          return var2;
  17.       } else if (super.obj.owner instanceof ClassObj) {
  18.          return new BasedItem(super.pos, Item.thisItem, super.obj);
  19.       } else {
  20.          throw new CompilerError("gen");
  21.       }
  22.    }
  23.  
  24.    AST simplify() {
  25.       return (AST)(super.obj instanceof VarObj && ((VarObj)super.obj).passByRef ? new Subscript(super.pos, this, new Literal(super.pos, 90, new Integer(0))) : this);
  26.    }
  27.  
  28.    Typ attr(Env var1, int var2, Typ var3) {
  29.       super.obj = Attr.resolve(super.pos, var1, var1.scope, var2, var3, super.name, 0);
  30.       if (var1.isStatic) {
  31.          super.obj = Attr.checkStatic(super.pos, super.obj);
  32.       } else if (var1.isSelfCall) {
  33.          super.obj = Attr.checkStaticOrFinal(super.pos, super.obj);
  34.       }
  35.  
  36.       Simplify.markFree(var1, super.obj);
  37.       super.typ = Attr.checkTyp(super.pos, super.obj.typ, var3);
  38.       return super.typ;
  39.    }
  40.  
  41.    boolean isType() {
  42.       return true;
  43.    }
  44.  
  45.    boolean isExpr() {
  46.       return true;
  47.    }
  48.  
  49.    Ident(int var1, Name var2) {
  50.       super(var1, 1, var2);
  51.    }
  52. }
  53.