1 24 25 package org.aspectj.compiler.crosscuts.ast; 26 import org.aspectj.compiler.base.ast.*; 27 import org.aspectj.compiler.crosscuts.joinpoints.*; 28 29 import org.aspectj.compiler.base.JavaCompiler; 30 31 import java.util.*; 32 import org.aspectj.util.FuzzyBoolean; 33 34 38 public class ArgsPcd extends Pcd { 39 public String toShortString() { 40 return "args(" + getArgTypeNames().toShortString() + ")"; 41 } 42 43 public boolean allowsNameBinding() { return true; } 44 public void checkStatic() { showNonStaticError(); } 45 46 public JpPlanner makePlanner(PlanData planData) { 47 return new JpPlanner() { 48 public FuzzyBoolean fastMatch(JoinPoint jp) { 49 return FuzzyBoolean.MAYBE; 51 } 52 public JpPlan makePlan(JoinPoint jp) { 53 Exprs argsExprs = jp.makeArgsExprs(); 54 if (argsExprs == null) return JpPlan.NO_PLAN; 55 return getArgTypeNames().makePlan(argsExprs, jp); 56 } 57 }; 58 } 59 60 protected FormalsPattern argTypeNames; 62 public FormalsPattern getArgTypeNames() { return argTypeNames; } 63 public void setArgTypeNames(FormalsPattern _argTypeNames) { 64 if (_argTypeNames != null) _argTypeNames.setParent(this); 65 argTypeNames = _argTypeNames; 66 } 67 68 public ArgsPcd(SourceLocation location, FormalsPattern _argTypeNames) { 69 super(location); 70 setArgTypeNames(_argTypeNames); 71 } 72 protected ArgsPcd(SourceLocation source) { 73 super(source); 74 } 75 76 public ASTObject copyWalk(CopyWalker walker) { 77 ArgsPcd ret = new ArgsPcd(getSourceLocation()); 78 ret.preCopy(walker, this); 79 if (argTypeNames != null) ret.setArgTypeNames( (FormalsPattern)walker.process(argTypeNames) ); 80 return ret; 81 } 82 83 public ASTObject getChildAt(int childIndex) { 84 switch(childIndex) { 85 case 0: return argTypeNames; 86 default: return super.getChildAt(childIndex); 87 } 88 } 89 public String getChildNameAt(int childIndex) { 90 switch(childIndex) { 91 case 0: return "argTypeNames"; 92 default: return super.getChildNameAt(childIndex); 93 } 94 } 95 public void setChildAt(int childIndex, ASTObject child) { 96 switch(childIndex) { 97 case 0: setArgTypeNames((FormalsPattern)child); return; 98 default: super.setChildAt(childIndex, child); return; 99 } 100 } 101 public int getChildCount() { 102 return 1; 103 } 104 105 public String getDefaultDisplayName() { 106 return "ArgsPcd()"; 107 } 108 109 } 111 112 | Popular Tags |