(Box root)
| 21 | static public final Dict.Prop<Box.BiFunctionOfBoxAnd<String, Triple<Object, List<String>, List<Pair<Integer, String>>>>> exec = new Dict.Prop<>("exec").type().toCanon().doc("`_.exec('foo()')` executes the expression `foo()` as if you'd typed it into the text editor with `_` selected and pressed command-return. This returns a `Triple` containing the the `Object` returned, a `List<String>` of everything 'printed' by this code and the `List<Pair<Integer, String>>` of all the errors and error-line numbers if any."); |
| 22 | |
| 23 | public Exec(Box root) |
| 24 | { |
| 25 | this.properties.put(exec, (box, string) -> { |
| 26 | Execution ex = RemoteEditor.getExecution(box, Execution.code); |
| 27 | Execution.ExecutionSupport support = ex.support(box, Execution.code); |
| 28 | |
| 29 | List<String> out = new ArrayList<>(); |
| 30 | List<Pair<Integer, String>> err = new ArrayList<>(); |
| 31 | Consumer<String> success = out::add; |
| 32 | Consumer<Pair<Integer, String>> errors= err::add; |
| 33 | |
| 34 | Object o = support.executeTextFragment(string, "raw", success, errors); |
| 35 | |
| 36 | return new Triple<>(o, out, err); |
| 37 | }); |
| 38 | } |
| 39 | } |
nothing calls this directly
no test coverage detected