| 9 | import java.io.Reader; |
| 10 | |
| 11 | public class Runner { |
| 12 | |
| 13 | private final DynJS runtime; |
| 14 | private Compiler compiler; |
| 15 | private ExecutionContext context; |
| 16 | |
| 17 | private boolean directEval; |
| 18 | |
| 19 | private JSProgram source; |
| 20 | |
| 21 | public Runner(DynJS runtime) { |
| 22 | this.compiler = new Compiler(runtime.getConfig()); |
| 23 | this.runtime = runtime; |
| 24 | } |
| 25 | |
| 26 | public Runner forceStrict() { |
| 27 | this.compiler.forceStrict(); |
| 28 | return this; |
| 29 | } |
| 30 | |
| 31 | public Runner forceStrict(boolean forceStrict) { |
| 32 | this.compiler.forceStrict( forceStrict ); |
| 33 | return this; |
| 34 | } |
| 35 | |
| 36 | public Runner directEval() { |
| 37 | return directEval(true); |
| 38 | } |
| 39 | |
| 40 | public Runner directEval(boolean directEval) { |
| 41 | this.directEval = directEval; |
| 42 | return this; |
| 43 | } |
| 44 | |
| 45 | public Runner withSource(JSProgram source) { |
| 46 | this.source = source; |
| 47 | return this; |
| 48 | } |
| 49 | |
| 50 | public Runner withSource(String source) { |
| 51 | this.compiler.withSource( source ); |
| 52 | return this; |
| 53 | } |
| 54 | |
| 55 | public Runner withSource(Reader source) { |
| 56 | this.compiler.withSource( source ); |
| 57 | return this; |
| 58 | } |
| 59 | |
| 60 | public Runner withSource(File source) throws FileNotFoundException { |
| 61 | this.compiler.withSource( source ); |
| 62 | return this; |
| 63 | } |
| 64 | |
| 65 | public Runner withContext(ExecutionContext context) { |
| 66 | this.context = context; |
| 67 | this.compiler.withContext( context ); |
| 68 | return this; |
nothing calls this directly
no outgoing calls
no test coverage detected