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 Labeled_c extends Stmt_c implements Labeled 14 { 15 protected String label; 16 protected Stmt statement; 17 18 public Labeled_c(Position pos, String label, Stmt statement) { 19 super(pos); 20 this.label = label; 21 this.statement = statement; 22 } 23 24 25 public String label() { 26 return this.label; 27 } 28 29 30 public Labeled label(String label) { 31 Labeled_c n = (Labeled_c) copy(); 32 n.label = label; 33 return n; 34 } 35 36 37 public Stmt statement() { 38 return this.statement; 39 } 40 41 42 public Labeled statement(Stmt statement) { 43 Labeled_c n = (Labeled_c) copy(); 44 n.statement = statement; 45 return n; 46 } 47 48 49 protected Labeled_c reconstruct(Stmt statement) { 50 if (statement != this.statement) { 51 Labeled_c n = (Labeled_c) copy(); 52 n.statement = statement; 53 return n; 54 } 55 56 return this; 57 } 58 59 60 public Node visitChildren(NodeVisitor v) { 61 Stmt statement = (Stmt) visitChild(this.statement, v); 62 return reconstruct(statement); 63 } 64 65 public String toString() { 66 return label + ": " + statement; 67 } 68 69 70 public void prettyPrint(CodeWriter w, PrettyPrinter tr) { 71 w.write(label + ": "); 72 print(statement, w, tr); 73 } 74 75 public Term entry() { 76 return statement.entry(); 77 } 78 79 public List acceptCFG(CFGBuilder v, List succs) { 80 v.push(this).visitCFG(statement, this); 81 return succs; 82 } 83 } 84 | Popular Tags |