MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / fork

Method fork

src/main/java/fieldnashorn/Nashorn.java:235–249  ·  view source on GitHub ↗
(NashornExecution from, Map<String, Object> parameters)

Source from the content-addressed store, hash-verified

233 NashornExecution ex = new NashornExecution(this, next.first, next.second, b, en);
234 ex.setTernSupport(ternSupport);
235
236 return ex;
237 }, (x) -> x);
238
239
240 NashornExecution fork(NashornExecution from, Map<String, Object> parameters) {
241 ScriptEngine se = factory.getScriptEngine("-scripting", "--language=es6");
242 ScriptContext context = se.getContext();
243
244 Bindings dest = from.context.getBindings(ScriptContext.GLOBAL_SCOPE);
245 Bindings source = from.context.getBindings(ScriptContext.GLOBAL_SCOPE);
246
247 dest.entrySet().forEach(e -> source.put(e.getKey(), e.getValue()));
248
249 context.setAttribute("_", from.box, ScriptContext.ENGINE_SCOPE);
250 from.box.find(Boxes.root, from.box.both()).findFirst().ifPresent(x -> context.setAttribute("__", x, ScriptContext.ENGINE_SCOPE));
251
252 NashornExecution ex = new NashornExecution(this, from.box, from.property, context, se);

Callers 1

beginMethod · 0.45

Calls 6

getContextMethod · 0.80
forEachMethod · 0.45
putMethod · 0.45
getValueMethod · 0.45
findMethod · 0.45
bothMethod · 0.45

Tested by

no test coverage detected