diff --git a/src/adapters/DebugProtocolAdapter.ts b/src/adapters/DebugProtocolAdapter.ts index 7283a471..c9617ca4 100644 --- a/src/adapters/DebugProtocolAdapter.ts +++ b/src/adapters/DebugProtocolAdapter.ts @@ -638,7 +638,7 @@ export class DebugProtocolAdapter { * @param name the name of this variable. For example, `alpha.beta.charlie`, this value would be `charlie`. For local vars, this is the root variable name (i.e. `alpha`) * @param parentEvaluateName the string used to derive the parent, _excluding_ this variable's name (i.e. `alpha.beta` or `alpha[0]`) */ - private createEvaluateContainer(variable: Variable, name: string, parentEvaluateName: string) { + private createEvaluateContainer(variable: Variable, name: string | number, parentEvaluateName: string) { let value; let variableType = variable.type; if (variable.value === null) { @@ -660,7 +660,7 @@ export class DebugProtocolAdapter { //build full evaluate name for this var. (i.e. `alpha["beta"]` + ["charlie"]` === `alpha["beta"]["charlie"]`) let evaluateName: string; if (!parentEvaluateName?.trim()) { - evaluateName = name; + evaluateName = name?.toString(); } else if (typeof name === 'string') { evaluateName = `${parentEvaluateName}["${name}"]`; } else if (typeof name === 'number') { @@ -668,7 +668,7 @@ export class DebugProtocolAdapter { } let container: EvaluateContainer = { - name: name ?? '', + name: name?.toString() ?? '', evaluateName: evaluateName ?? '', type: variableType ?? '', value: value ?? null, @@ -687,7 +687,7 @@ export class DebugProtocolAdapter { const childVariable = variable.children[i]; const childContainer = this.createEvaluateContainer( childVariable, - container.keyType === KeyType.integer ? i?.toString() : childVariable.name, + container.keyType === KeyType.integer ? i : childVariable.name, container.evaluateName ); container.children.push(childContainer);