1 package org.python.parser.ast; 3 import org.python.parser.SimpleNode; 4 import java.io.DataOutputStream ; 5 import java.io.IOException ; 6 7 public class Call extends exprType { 8 public exprType func; 9 public exprType[] args; 10 public keywordType[] keywords; 11 public exprType starargs; 12 public exprType kwargs; 13 14 public Call(exprType func, exprType[] args, keywordType[] keywords, 15 exprType starargs, exprType kwargs) { 16 this.func = func; 17 this.args = args; 18 this.keywords = keywords; 19 this.starargs = starargs; 20 this.kwargs = kwargs; 21 } 22 23 public Call(exprType func, exprType[] args, keywordType[] keywords, 24 exprType starargs, exprType kwargs, SimpleNode parent) { 25 this(func, args, keywords, starargs, kwargs); 26 this.beginLine = parent.beginLine; 27 this.beginColumn = parent.beginColumn; 28 } 29 30 public String toString() { 31 StringBuffer sb = new StringBuffer ("Call["); 32 sb.append("func="); 33 sb.append(dumpThis(this.func)); 34 sb.append(", "); 35 sb.append("args="); 36 sb.append(dumpThis(this.args)); 37 sb.append(", "); 38 sb.append("keywords="); 39 sb.append(dumpThis(this.keywords)); 40 sb.append(", "); 41 sb.append("starargs="); 42 sb.append(dumpThis(this.starargs)); 43 sb.append(", "); 44 sb.append("kwargs="); 45 sb.append(dumpThis(this.kwargs)); 46 sb.append("]"); 47 return sb.toString(); 48 } 49 50 public void pickle(DataOutputStream ostream) throws IOException { 51 pickleThis(35, ostream); 52 pickleThis(this.func, ostream); 53 pickleThis(this.args, ostream); 54 pickleThis(this.keywords, ostream); 55 pickleThis(this.starargs, ostream); 56 pickleThis(this.kwargs, ostream); 57 } 58 59 public Object accept(VisitorIF visitor) throws Exception { 60 return visitor.visitCall(this); 61 } 62 63 public void traverse(VisitorIF visitor) throws Exception { 64 if (func != null) 65 func.accept(visitor); 66 if (args != null) { 67 for (int i = 0; i < args.length; i++) { 68 if (args[i] != null) 69 args[i].accept(visitor); 70 } 71 } 72 if (keywords != null) { 73 for (int i = 0; i < keywords.length; i++) { 74 if (keywords[i] != null) 75 keywords[i].accept(visitor); 76 } 77 } 78 if (starargs != null) 79 starargs.accept(visitor); 80 if (kwargs != null) 81 kwargs.accept(visitor); 82 } 83 84 } 85 | Popular Tags |