KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > polyglot > frontend > SpawnPass


1 package polyglot.frontend;
2  
3 import polyglot.ast.*;
4 import polyglot.util.InternalCompilerError;
5
6 /**
7  * The <code>SpawnPass</code> spawns a new job and runs it on the current
8  * job's top-level context and ast. This allows passes to be re-run.
9  */

10 public class SpawnPass extends AbstractPass {
11     Job job;
12     Pass.ID begin;
13     Pass.ID end;
14      
15     public SpawnPass(Pass.ID id, Job job, Pass.ID begin, Pass.ID end) {
16         super(id);
17     this.job = job;
18     this.begin = begin;
19     this.end = end;
20     }
21        
22     public boolean run() {
23         if (job.ast() == null) {
24             throw new InternalCompilerError("Null AST.");
25         }
26
27         Job j = job.spawn(job.context(), job.ast(), begin, end);
28         return j.status();
29     }
30 }
31
Popular Tags