01: // Autogenerated AST node
02: package org.python.parser.ast;
03:
04: import org.python.parser.SimpleNode;
05: import java.io.DataOutputStream;
06: import java.io.IOException;
07:
08: public class FunctionDef extends stmtType {
09: public String name;
10: public argumentsType args;
11: public stmtType[] body;
12:
13: public FunctionDef(String name, argumentsType args, stmtType[] body) {
14: this .name = name;
15: this .args = args;
16: this .body = body;
17: }
18:
19: public FunctionDef(String name, argumentsType args,
20: stmtType[] body, SimpleNode parent) {
21: this (name, args, body);
22: this .beginLine = parent.beginLine;
23: this .beginColumn = parent.beginColumn;
24: }
25:
26: public String toString() {
27: StringBuffer sb = new StringBuffer("FunctionDef[");
28: sb.append("name=");
29: sb.append(dumpThis(this .name));
30: sb.append(", ");
31: sb.append("args=");
32: sb.append(dumpThis(this .args));
33: sb.append(", ");
34: sb.append("body=");
35: sb.append(dumpThis(this .body));
36: sb.append("]");
37: return sb.toString();
38: }
39:
40: public void pickle(DataOutputStream ostream) throws IOException {
41: pickleThis(5, ostream);
42: pickleThis(this .name, ostream);
43: pickleThis(this .args, ostream);
44: pickleThis(this .body, ostream);
45: }
46:
47: public Object accept(VisitorIF visitor) throws Exception {
48: return visitor.visitFunctionDef(this );
49: }
50:
51: public void traverse(VisitorIF visitor) throws Exception {
52: if (args != null)
53: args.accept(visitor);
54: if (body != null) {
55: for (int i = 0; i < body.length; i++) {
56: if (body[i] != null)
57: body[i].accept(visitor);
58: }
59: }
60: }
61:
62: }
|