1 package polyglot.ext.jl.ast; 2 3 import polyglot.ast.*; 4 import polyglot.types.*; 5 import polyglot.visit.*; 6 import polyglot.util.*; 7 8 import java.util.*; 9 10 14 public abstract class Term_c extends Node_c implements Term 15 { 16 public Term_c(Position pos) { 17 super(pos); 18 } 19 20 protected boolean reachable; 21 22 26 public abstract Term entry(); 27 28 31 public abstract List acceptCFG(CFGBuilder v, List succs); 32 33 39 public boolean reachable() { 40 return reachable; 41 } 42 43 46 public Term reachable(boolean reachability) { 47 if (this.reachable == reachability) { 48 return this; 49 } 50 51 Term_c t = (Term_c) copy(); 52 t.reachable = reachability; 53 return t; 54 } 55 56 57 public static Term listEntry(List l, Term alt) { 58 Term c = (Term) CollectionUtil.firstOrElse(l, alt); 59 if (c != alt) return c.entry(); 60 return alt; 61 } 62 63 protected SubtypeSet exceptions; 64 65 public SubtypeSet exceptions() { 66 return exceptions; 67 } 68 69 public Term exceptions(SubtypeSet exceptions) { 70 Term_c n = (Term_c) copy(); 71 n.exceptions = new SubtypeSet(exceptions); 72 return n; 73 } 74 75 public Node exceptionCheck(ExceptionChecker ec) throws SemanticException { 76 Term t = (Term) super.exceptionCheck(ec); 77 return t.exceptions(ec.throwsSet()); 79 } 80 } 81 | Popular Tags |