1 24 25 package org.aspectj.compiler.base.cst; 26 27 import java.util.*; 28 import org.aspectj.compiler.base.ast.*; 29 30 import org.aspectj.compiler.base.JavaCompiler; 31 import org.aspectj.compiler.base.CodeWriter; 32 33 34 38 39 public class UnresolvedFieldAccessExpr extends FieldAccessExpr { 40 public UnresolvedFieldAccessExpr(SourceLocation source, Expr expr, String id) { 41 this(source,expr, null, false, id); 42 } 43 44 public Field resolveField() { 45 Type type = expr.getType(); 46 if (type == null) { 47 expr.showError("bad type"); 48 return null; 49 } 50 51 return type.getField(id, this, true); 52 } 53 54 public ASTObject postScope(ScopeWalker walker) { 56 57 if (expr != null && expr instanceof SuperExpr) { 58 setIsSuper(true); 59 } 60 61 return new FieldAccessExpr(getSourceLocation(), getExpr(), resolveField(), getIsSuper()); 62 63 } 64 65 protected String id; 67 public String getId() { return id; } 68 public void setId(String _id) { id = _id; } 69 70 public UnresolvedFieldAccessExpr(SourceLocation location, Expr _expr, Field _field, boolean _isSuper, String _id) { 71 super(location, _expr, _field, _isSuper); 72 setId(_id); 73 } 74 protected UnresolvedFieldAccessExpr(SourceLocation source) { 75 super(source); 76 } 77 78 public ASTObject copyWalk(CopyWalker walker) { 79 UnresolvedFieldAccessExpr ret = new UnresolvedFieldAccessExpr(getSourceLocation()); 80 ret.preCopy(walker, this); 81 if (expr != null) ret.setExpr( (Expr)walker.process(expr) ); 82 ret.field = field; 83 ret.isSuper = isSuper; 84 ret.id = id; 85 return ret; 86 } 87 88 89 public String getDefaultDisplayName() { 90 return "UnresolvedFieldAccessExpr(field: "+field+", "+"isSuper: "+isSuper+", "+"id: "+id+")"; 91 } 92 93 } 95 | Popular Tags |