1 package polyglot.frontend; 2 3 import polyglot.ast.*; 4 import polyglot.types.*; 5 import polyglot.util.*; 6 7 import java.util.*; 8 9 15 public class InnerJob extends Job 16 { 17 20 protected Job outer; 21 22 25 protected Context context; 26 27 31 protected Pass.ID begin; 32 36 protected Pass.ID end; 37 38 41 public InnerJob(ExtensionInfo lang, JobExt ext, Node ast, Context context, 42 Job outer, Pass.ID begin, Pass.ID end) { 43 super(lang, ext, ast); 44 45 this.context = context; 46 this.outer = outer; 47 this.begin = begin; 48 this.end = end; 49 if (ast == null) { 50 throw new InternalCompilerError("Null ast"); 51 } 52 if (outer == null) { 53 throw new InternalCompilerError("Null outer job"); 54 } 55 } 56 57 public String toString() { 58 String name = "inner-job[" + begin + ".." + end + "](code=" + 59 context.currentCode() + " class=" + context.currentClass() + ") [" + status() + "]"; 60 61 return name + " (" + 62 (isRunning() ? "running " : "before ") + 63 nextPass() + ")" + " <<< passes = " + passes + " >>>"; 64 } 65 66 71 public List getPasses() { 72 List l = lang.passes(this, begin, end); 73 74 for (int i = 0; i < l.size(); i++) { 75 Pass pass = (Pass) l.get(i); 76 if (pass.id() == begin) { 77 nextPass = i; 78 } 79 if (i == l.size()-1 && pass.id() != end) 82 throw new InternalCompilerError("ExtensionInfo.passes returned incorrect list: " + l); 83 } 84 85 return l; 86 } 87 88 public Context context() { 89 return context; 90 } 91 92 95 public SourceJob sourceJob() { 96 return outer.sourceJob(); 97 } 98 } 99 | Popular Tags |