(input)
| 574 | } |
| 575 | |
| 576 | function prepareControlCode(input) { |
| 577 | if (input === '\n') return lastCommand; |
| 578 | // Add parentheses: exec process.title => exec("process.title"); |
| 579 | const match = RegExpPrototypeExec(/^\s*(?:exec|p)\s+([^\n]*)/, input); |
| 580 | input = match ? match[1] : input; |
| 581 | |
| 582 | if (isObjectLiteral(input)) { |
| 583 | // Add parentheses to make sure `input` is parsed as an expression |
| 584 | input = `(${StringPrototypeTrim(input)})\n`; |
| 585 | } |
| 586 | |
| 587 | if (match) { |
| 588 | lastCommand = `exec(${JSONStringify(input)})`; |
| 589 | } else { |
| 590 | lastCommand = input; |
| 591 | } |
| 592 | return lastCommand; |
| 593 | } |
| 594 | |
| 595 | async function evalInCurrentContext(code) { |
| 596 | // Repl asked for scope variables |
no test coverage detected
searching dependent graphs…