1 16 package com.google.gwt.dev.jjs.ast; 17 18 import com.google.gwt.dev.jjs.SourceInfo; 19 20 import java.util.List ; 21 22 25 public class JForStatement extends JStatement { 26 27 private JStatement body; 28 private final List increments; 29 private final List initializers; 30 private JExpression testExpr; 31 32 public JForStatement(JProgram program, SourceInfo info, 33 List initializers, JExpression testExpr, 34 List increments, JStatement body) { 35 super(program, info); 36 this.initializers = initializers; 37 this.testExpr = testExpr; 38 this.increments = increments; 39 this.body = body; 40 } 41 42 public JStatement getBody() { 43 return body; 44 } 45 46 public List getIncrements() { 47 return increments; 48 } 49 50 public List getInitializers() { 51 return initializers; 52 } 53 54 public JExpression getTestExpr() { 55 return testExpr; 56 } 57 58 public void traverse(JVisitor visitor, Context ctx) { 59 if (visitor.visit(this, ctx)) { 60 visitor.acceptWithInsertRemove(initializers); 61 if (testExpr != null) { 62 testExpr = visitor.accept(testExpr); 63 } 64 visitor.acceptWithInsertRemove(increments); 65 if (body != null) { 66 body = visitor.accept(body); 67 } 68 } 69 visitor.endVisit(this, ctx); 70 } 71 72 } 73 | Popular Tags |