1 24 25 package org.aspectj.compiler.base.ast; 26 27 import org.aspectj.compiler.base.FlowCheckerPass; 28 import org.aspectj.compiler.base.JavaCompiler; 29 import org.aspectj.compiler.base.CodeWriter; 30 import java.io.IOException ; 31 32 import java.util.*; 33 34 38 public class ArrayInitializer extends Expr { 39 protected Type discoverType() { 40 return getTypeManager().anyType; 41 } 42 43 public void unparse(CodeWriter writer) throws IOException { 44 writer.openParen('{'); 45 writer.write(exprs); 46 writer.closeParen('}'); 47 } 48 49 public void cleanup() { 50 exprs = null; 51 super.cleanup(); 52 } 53 54 protected Exprs exprs; 56 public Exprs getExprs() { return exprs; } 57 public void setExprs(Exprs _exprs) { 58 if (_exprs != null) _exprs.setParent(this); 59 exprs = _exprs; 60 } 61 62 public ArrayInitializer(SourceLocation location, Exprs _exprs) { 63 super(location); 64 setExprs(_exprs); 65 } 66 protected ArrayInitializer(SourceLocation source) { 67 super(source); 68 } 69 70 public ASTObject copyWalk(CopyWalker walker) { 71 ArrayInitializer ret = new ArrayInitializer(getSourceLocation()); 72 ret.preCopy(walker, this); 73 if (exprs != null) ret.setExprs( (Exprs)walker.process(exprs) ); 74 return ret; 75 } 76 77 public ASTObject getChildAt(int childIndex) { 78 switch(childIndex) { 79 case 0: return exprs; 80 default: return super.getChildAt(childIndex); 81 } 82 } 83 public String getChildNameAt(int childIndex) { 84 switch(childIndex) { 85 case 0: return "exprs"; 86 default: return super.getChildNameAt(childIndex); 87 } 88 } 89 public void setChildAt(int childIndex, ASTObject child) { 90 switch(childIndex) { 91 case 0: setExprs((Exprs)child); return; 92 default: super.setChildAt(childIndex, child); return; 93 } 94 } 95 public int getChildCount() { 96 return 1; 97 } 98 99 public String getDefaultDisplayName() { 100 return "ArrayInitializer()"; 101 } 102 103 } 105 | Popular Tags |