test/script/trusted/JDK-8006529.js

changeset 1543
8173e810dc17
parent 991
b7a2db4de254
child 1544
689cb2dfe091
equal deleted inserted replaced
1542:89477d713a96 1543:8173e810dc17
118 var getContextMethod = Context.class.getMethod("getContext") 118 var getContextMethod = Context.class.getMethod("getContext")
119 var getEnvMethod = Context.class.getMethod("getEnv") 119 var getEnvMethod = Context.class.getMethod("getEnv")
120 120
121 var sourceForMethod = Source.class.getMethod("sourceFor", java.lang.String.class, java.lang.String.class) 121 var sourceForMethod = Source.class.getMethod("sourceFor", java.lang.String.class, java.lang.String.class)
122 var ParserConstructor = Parser.class.getConstructor(ScriptEnvironment.class, Source.class, ErrorManager.class) 122 var ParserConstructor = Parser.class.getConstructor(ScriptEnvironment.class, Source.class, ErrorManager.class)
123 var CompilerConstructor = Compiler.class.getConstructor(Context.class, ScriptEnvironment.class, CodeInstaller.class, Source.class, ErrorManager.class, boolean.class); 123 var CompilerConstructor = Compiler.class.getMethod("createNoInstallerCompiler", Context.class, Source.class, boolean.class);
124 124
125 // compile(script) -- compiles a script specified as a string with its 125 // compile(script) -- compiles a script specified as a string with its
126 // source code, returns a jdk.nashorn.internal.ir.FunctionNode object 126 // source code, returns a jdk.nashorn.internal.ir.FunctionNode object
127 // representing it. 127 // representing it.
128 function compile(source, phases) { 128 function compile(source, phases) {
132 var env = getEnvMethod.invoke(ctxt); 132 var env = getEnvMethod.invoke(ctxt);
133 133
134 var parser = ParserConstructor.newInstance(env, source, ThrowErrorManager.class.newInstance()); 134 var parser = ParserConstructor.newInstance(env, source, ThrowErrorManager.class.newInstance());
135 var func = parseMethod.invoke(parser); 135 var func = parseMethod.invoke(parser);
136 136
137 var compiler = CompilerConstructor.newInstance(ctxt, env, null, source, null, false); 137 var compiler = CompilerConstructor.invoke(null, ctxt, source, false);
138 138
139 return compileMethod.invoke(compiler, func, phases); 139 return compileMethod.invoke(compiler, func, phases);
140 }; 140 };
141 141
142 var allAssertions = (function() { 142 var allAssertions = (function() {

mercurial