* Evaluates the expression on the stackframe.
(
stackFrame: StackFrame | InlinedFrame | undefined,
args: Dap.EvaluateParamsExtended,
variables: VariableStore,
)
| 534 | * Evaluates the expression on the stackframe. |
| 535 | */ |
| 536 | private async _evaluteJs( |
| 537 | stackFrame: StackFrame | InlinedFrame | undefined, |
| 538 | args: Dap.EvaluateParamsExtended, |
| 539 | variables: VariableStore, |
| 540 | ): Promise<Dap.Variable> { |
| 541 | // For clipboard evaluations, return a safe JSON-stringified string. |
| 542 | let params: Cdp.Runtime.EvaluateParams; |
| 543 | let transformRanges: Range[] | undefined; |
| 544 | if (args.context === 'clipboard') { |
| 545 | transformRanges = serializeForClipboardTmpl.exprArgRanges(args.expression, '2'); |
| 546 | params = { |
| 547 | expression: serializeForClipboardTmpl.expr(args.expression, '2'), |
| 548 | includeCommandLineAPI: true, |
| 549 | returnByValue: true, |
| 550 | objectGroup: 'console', |
| 551 | }; |
| 552 | } else { |
| 553 | params = { |
| 554 | expression: args.expression, |
| 555 | includeCommandLineAPI: true, |
| 556 | objectGroup: 'console', |
| 557 | generatePreview: true, |
| 558 | timeout: args.context === 'hover' ? this.getHoverEvalTimeout() : undefined, |
| 559 | }; |
| 560 | } |
| 561 | |
| 562 | if (args.context === 'repl') { |
| 563 | params.expression = sourceUtils.wrapObjectLiteral(params.expression); |
| 564 | if (params.expression.indexOf('await') !== -1) { |
| 565 | const rewritten = sourceUtils.rewriteTopLevelAwait(params.expression); |
| 566 | if (rewritten) { |
| 567 | params.expression = rewritten; |
| 568 | params.awaitPromise = true; |
| 569 | } |
| 570 | } |
| 571 | params.expression += getReplSourceSuffix(); |
| 572 | } |
| 573 | |
| 574 | if (args.evaluationOptions) { |
| 575 | this.cdp().DotnetDebugger.setEvaluationOptions({ |
| 576 | options: args.evaluationOptions, |
| 577 | type: 'evaluation', |
| 578 | }); |
| 579 | } |
| 580 | |
| 581 | let location: LocationEvaluateOptions | undefined; |
| 582 | if (args.source && args.line && args.column) { |
| 583 | const variables = this._pausedVariables; |
| 584 | const source = this._sourceContainer.source(args.source); |
| 585 | if (source && variables) { |
| 586 | location = { source, position: new Base1Position(args.line, args.column), variables }; |
| 587 | } |
| 588 | } |
| 589 | |
| 590 | const callFrameId = stackFrame?.root.callFrameId(); |
| 591 | const responsePromise = this.evaluator.evaluate( |
| 592 | callFrameId |
| 593 | ? { ...params, callFrameId } |
no test coverage detected