(
String sourceString,
String sourceName,
int lineno,
Object securityDomain,
Evaluator compiler,
ErrorReporter compilationErrorReporter,
Consumer<CompilerEnvirons> compilerEnvironProcessor,
SourceMapper sourceMapper,
boolean returnFunction,
CompileFn<T> compileFn)
| 2652 | } |
| 2653 | |
| 2654 | private <T extends ScriptOrFn<T>> Compiled<T> compileImpl( |
| 2655 | String sourceString, |
| 2656 | String sourceName, |
| 2657 | int lineno, |
| 2658 | Object securityDomain, |
| 2659 | Evaluator compiler, |
| 2660 | ErrorReporter compilationErrorReporter, |
| 2661 | Consumer<CompilerEnvirons> compilerEnvironProcessor, |
| 2662 | SourceMapper sourceMapper, |
| 2663 | boolean returnFunction, |
| 2664 | CompileFn<T> compileFn) { |
| 2665 | if (sourceName == null) { |
| 2666 | sourceName = "unnamed script"; |
| 2667 | } |
| 2668 | |
| 2669 | if (securityDomain != null && getSecurityController() == null) { |
| 2670 | throw new IllegalArgumentException( |
| 2671 | "securityDomain should be null if setSecurityController() was never called"); |
| 2672 | } |
| 2673 | |
| 2674 | CompilerEnvirons compilerEnv = new CompilerEnvirons(); |
| 2675 | compilerEnv.initFromContext(this); |
| 2676 | compilerEnv.setSecurityDomain(securityDomain); |
| 2677 | if (sourceMapper != null) { |
| 2678 | compilerEnv.setSourceMapper(sourceMapper); |
| 2679 | } |
| 2680 | |
| 2681 | if (compilationErrorReporter == null) { |
| 2682 | compilationErrorReporter = compilerEnv.getErrorReporter(); |
| 2683 | } |
| 2684 | |
| 2685 | if (compilerEnvironProcessor != null) { |
| 2686 | compilerEnvironProcessor.accept(compilerEnv); |
| 2687 | } |
| 2688 | |
| 2689 | ScriptNode tree = |
| 2690 | parse( |
| 2691 | sourceString, |
| 2692 | sourceName, |
| 2693 | lineno, |
| 2694 | compilerEnv, |
| 2695 | compilationErrorReporter, |
| 2696 | returnFunction); |
| 2697 | |
| 2698 | CompilationResult<T> result; |
| 2699 | try { |
| 2700 | if (compiler == null) { |
| 2701 | compiler = createCompiler(); |
| 2702 | } |
| 2703 | |
| 2704 | result = compileFn.compile(compiler, compilerEnv, tree, sourceString); |
| 2705 | } catch (ClassSizeException e) { |
| 2706 | // we hit some class file limit, fall back to interpreter or report |
| 2707 | |
| 2708 | // we have to recreate the tree because the compile call might have changed the tree |
| 2709 | // already |
| 2710 | tree = |
| 2711 | parse( |
no test coverage detected