1 package polyglot.ext.jl.ast; 2 3 import polyglot.ast.*; 4 import polyglot.types.*; 5 import polyglot.visit.*; 6 import polyglot.util.*; 7 import java.util.*; 8 9 13 public class Branch_c extends Stmt_c implements Branch 14 { 15 protected Branch.Kind kind; 16 protected String label; 17 18 public Branch_c(Position pos, Branch.Kind kind, String label) { 19 super(pos); 20 this.kind = kind; 21 this.label = label; 22 } 23 24 25 public Branch.Kind kind() { 26 return this.kind; 27 } 28 29 30 public Branch kind(Branch.Kind kind) { 31 Branch_c n = (Branch_c) copy(); 32 n.kind = kind; 33 return n; 34 } 35 36 37 public String label() { 38 return this.label; 39 } 40 41 42 public Branch label(String label) { 43 Branch_c n = (Branch_c) copy(); 44 n.label = label; 45 return n; 46 } 47 48 public String toString() { 49 return kind.toString() + (label != null ? " " + label : ""); 50 } 51 52 53 public void prettyPrint(CodeWriter w, PrettyPrinter tr) { 54 w.write(kind.toString()); 55 if (label != null) { 56 w.write(" " + label); 57 } 58 w.write(";"); 59 } 60 61 65 public Term entry() { 66 return this; 67 } 68 69 public List acceptCFG(CFGBuilder v, List succs) { 70 v.visitBranchTarget(this); 71 return Collections.EMPTY_LIST; 72 } 73 } 74 | Popular Tags |