(args: Dap.EvaluateParamsExtended)
| 622 | } |
| 623 | |
| 624 | public async evaluate(args: Dap.EvaluateParamsExtended): Promise<Dap.EvaluateResult> { |
| 625 | let callFrameId: Cdp.Debugger.CallFrameId | undefined; |
| 626 | let stackFrame: StackFrame | InlinedFrame | undefined; |
| 627 | if (args.frameId !== undefined) { |
| 628 | stackFrame = this._pausedDetails |
| 629 | ? this._pausedDetails.stackTrace.frame(args.frameId) |
| 630 | : undefined; |
| 631 | |
| 632 | if (!stackFrame) { |
| 633 | throw new ProtocolError(this._stackFrameNotFoundError()); |
| 634 | } |
| 635 | |
| 636 | callFrameId = stackFrame.root.callFrameId(); |
| 637 | if (!callFrameId) { |
| 638 | throw new ProtocolError(this._evaluateOnAsyncFrameError()); |
| 639 | } |
| 640 | } |
| 641 | |
| 642 | if (args.context === 'repl' && args.expression.startsWith('cd ')) { |
| 643 | const contextName = args.expression.substring('cd '.length).trim(); |
| 644 | for (const ec of this._executionContexts.values()) { |
| 645 | if (this.target.executionContextName(ec.description) === contextName) { |
| 646 | this._selectedContext = ec; |
| 647 | return { |
| 648 | result: `[${contextName}]`, |
| 649 | variablesReference: 0, |
| 650 | }; |
| 651 | } |
| 652 | } |
| 653 | } |
| 654 | |
| 655 | const variableStore = callFrameId ? this._pausedVariables : this.replVariables; |
| 656 | if (!variableStore) { |
| 657 | throw new ProtocolError(errors.createSilentError(l10n.t('Unable to evaluate'))); |
| 658 | } |
| 659 | |
| 660 | const variable = (await this._evaluteWasm(stackFrame, args, variableStore)) |
| 661 | ?? (await this._evaluteJs(stackFrame, args, variableStore)); |
| 662 | |
| 663 | return { |
| 664 | type: variable.type, |
| 665 | result: variable.value, |
| 666 | variablesReference: variable.variablesReference, |
| 667 | namedVariables: variable.namedVariables, |
| 668 | indexedVariables: variable.indexedVariables, |
| 669 | memoryReference: variable.memoryReference, |
| 670 | valueLocationReference: variable.valueLocationReference, |
| 671 | }; |
| 672 | } |
| 673 | |
| 674 | private getHoverEvalTimeout() { |
| 675 | const configuredTimeout = this.launchConfig.timeouts?.hoverEvaluation; |
nothing calls this directly
no test coverage detected