1 24 25 package org.aspectj.compiler.base.ast; 26 27 import org.aspectj.compiler.base.*; 28 29 import org.aspectj.compiler.base.bcg.CodeBuilder; 30 import org.aspectj.compiler.base.bcg.Label; 31 32 35 36 public class ThisExpr extends Expr { 37 38 public Type discoverType() { 39 return getDeclaringType(); 41 } 42 43 public ThisExpr(SourceLocation source, Type type) { 44 super(source); 45 this.setType(type); 46 } 47 48 public Expr makeReference() { 49 return (Expr)this.copy(); 50 } 51 52 public boolean canBeCopied() { 53 return true; 54 } 55 56 public boolean isUltimatelyLiteral() { 57 return false; 58 } 59 60 public ASTObject postMove(MovingWalker walker) { 62 return walker.moveThisExpr(this, getType()); 64 } 65 66 69 public void postInnerInfo(InnerInfoPass walker) { 70 if (!walker.isAccessibleExactly(getType())) { 71 if (!fromSource() && getParent().fromSource()) { 72 getParent().showError("no instance available"); 73 } else { 74 showError("no instance available"); 75 } 76 } 77 } 78 79 public void unparse(CodeWriter writer) { 80 writer.writeKeyword("this"); 81 } 82 83 86 protected void cgValue(CodeBuilder cb) { 87 cb.emitALOAD(0); 88 } 89 protected void cgEffect(CodeBuilder cb) { } 90 91 93 public ThisExpr(SourceLocation location) { 94 super(location); 95 96 } 97 98 public ASTObject copyWalk(CopyWalker walker) { 99 ThisExpr ret = new ThisExpr(getSourceLocation()); 100 ret.preCopy(walker, this); 101 102 return ret; 103 } 104 105 106 public String getDefaultDisplayName() { 107 return "ThisExpr()"; 108 } 109 110 } 112 | Popular Tags |