MCPcopy Create free account
hub / github.com/WebFreak001/code-debug / addOne

Method addOne

src/mibase.ts:578–618  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

576 this.sendResponse(response);
577 };
578 const addOne = async () => {
579 // TODO: this evaluates on an (effectively) unknown thread for multithreaded programs.
580 const variable = await this.miDebugger.evalExpression(JSON.stringify(`${varReq.name}+${arrIndex})`), 0, 0);
581 try {
582 const expanded = expandValue(createVariable, variable.result("value"), varReq.name, variable);
583 if (!expanded) {
584 this.sendErrorResponse(response, 15, `Could not expand variable`);
585 } else {
586 if (typeof expanded == "string") {
587 if (expanded == "<nullptr>") {
588 if (argsPart)
589 argsPart = false;
590 else
591 return submit();
592 } else if (expanded[0] != '"') {
593 strArr.push({
594 name: "[err]",
595 value: expanded,
596 variablesReference: 0
597 });
598 return submit();
599 }
600 strArr.push({
601 name: `[${(arrIndex++)}]`,
602 value: expanded,
603 variablesReference: 0
604 });
605 addOne();
606 } else {
607 strArr.push({
608 name: "[err]",
609 value: expanded,
610 variablesReference: 0
611 });
612 submit();
613 }
614 }
615 } catch (e) {
616 this.sendErrorResponse(response, 14, `Could not expand variable: ${e}`);
617 }
618 };
619 addOne();
620 } else
621 this.sendErrorResponse(response, 13, `Unimplemented variable request options: ${JSON.stringify(varReq.options)}`);

Callers

nothing calls this directly

Calls 3

expandValueFunction · 0.90
resultMethod · 0.80
evalExpressionMethod · 0.65

Tested by

no test coverage detected