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 40 public class StaticInitializerPcd extends Pcd { 41 public String toShortString() { 42 return "staticinitialization(" + getTypeName().toShortString() + ")"; 43 } 44 public void checkStatic() { } 45 public int getJpKind() { 46 return JoinPoint.STATIC_INITIALIZER_EXECUTION; 47 } 48 49 public JpPlanner makePlanner(PlanData planData) { 50 return new JpPlanner() { 51 public FuzzyBoolean fastMatch(JoinPoint jp) { 52 if (!(jp.getTypeCode() == getJpKind())) return FuzzyBoolean.NO; 53 return getTypeName().matches(jp.getTargetType()) ? 54 FuzzyBoolean.YES : FuzzyBoolean.NO; 55 } 56 }; 57 } 58 59 protected GenTypeName typeName; 61 public GenTypeName getTypeName() { return typeName; } 62 public void setTypeName(GenTypeName _typeName) { 63 if (_typeName != null) _typeName.setParent(this); 64 typeName = _typeName; 65 } 66 67 public StaticInitializerPcd(SourceLocation location, GenTypeName _typeName) { 68 super(location); 69 setTypeName(_typeName); 70 } 71 protected StaticInitializerPcd(SourceLocation source) { 72 super(source); 73 } 74 75 public ASTObject copyWalk(CopyWalker walker) { 76 StaticInitializerPcd ret = new StaticInitializerPcd(getSourceLocation()); 77 ret.preCopy(walker, this); 78 if (typeName != null) ret.setTypeName( (GenTypeName)walker.process(typeName) ); 79 return ret; 80 } 81 82 public ASTObject getChildAt(int childIndex) { 83 switch(childIndex) { 84 case 0: return typeName; 85 default: return super.getChildAt(childIndex); 86 } 87 } 88 public String getChildNameAt(int childIndex) { 89 switch(childIndex) { 90 case 0: return "typeName"; 91 default: return super.getChildNameAt(childIndex); 92 } 93 } 94 public void setChildAt(int childIndex, ASTObject child) { 95 switch(childIndex) { 96 case 0: setTypeName((GenTypeName)child); return; 97 default: super.setChildAt(childIndex, child); return; 98 } 99 } 100 public int getChildCount() { 101 return 1; 102 } 103 104 public String getDefaultDisplayName() { 105 return "StaticInitializerPcd()"; 106 } 107 108 } 110 111 | Popular Tags |