MCPcopy Index your code
hub / github.com/nodejs/node / controlEval

Function controlEval

lib/internal/debugger/inspect_repl.js:620–644  ·  view source on GitHub ↗
(input, context, filename, callback)

Source from the content-addressed store, hash-verified

618 }
619
620 function controlEval(input, context, filename, callback) {
621 debuglog('eval:', input);
622 function returnToCallback(error, result) {
623 debuglog('end-eval:', input, error);
624 callback(error, result);
625 }
626
627 try {
628 const code = prepareControlCode(input);
629 const result = vm.runInContext(code, context, filename);
630
631 const then = result?.then;
632 if (typeof then === 'function') {
633 FunctionPrototypeCall(
634 then, result,
635 (result) => returnToCallback(null, result),
636 returnToCallback,
637 );
638 } else {
639 returnToCallback(null, result);
640 }
641 } catch (e) {
642 returnToCallback(e);
643 }
644 }
645
646 function debugEval(input, context, filename, callback) {
647 debuglog('eval:', input);

Callers

nothing calls this directly

Calls 4

prepareControlCodeFunction · 0.85
returnToCallbackFunction · 0.85
runInContextMethod · 0.80
debuglogFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…