From 00cbee4bbf66290b81eb737367016586bfbdba25 Mon Sep 17 00:00:00 2001 From: isidor Date: Thu, 4 May 2017 15:23:43 +0200 Subject: [PATCH] debug: remove heuristic for evaluate name fixes #25166 --- .../parts/debug/common/debugModel.ts | 33 +------------------ 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/src/vs/workbench/parts/debug/common/debugModel.ts b/src/vs/workbench/parts/debug/common/debugModel.ts index d1189a6d8ce..4326c55e2d8 100644 --- a/src/vs/workbench/parts/debug/common/debugModel.ts +++ b/src/vs/workbench/parts/debug/common/debugModel.ts @@ -250,15 +250,13 @@ export class Variable extends ExpressionContainer implements IExpression { // Used to show the error message coming from the adapter when setting the value #7807 public errorMessage: string; - private static NOT_PROPERTY_SYNTAX = /^[a-zA-Z_][a-zA-Z0-9_]*$/; - private static ARRAY_ELEMENT_SYNTAX = /\[.*\]$/; constructor( process: IProcess, public parent: IExpressionContainer, reference: number, public name: string, - private _evaluateName: string, + public evaluateName: string, value: string, namedVariables: number, indexedVariables: number, @@ -270,35 +268,6 @@ export class Variable extends ExpressionContainer implements IExpression { this.value = value; } - public get evaluateName(): string { - if (this._evaluateName) { - return this._evaluateName; - } - - // TODO@Isidor get rid of this ugly heuristic - let names = [this.name]; - let v = this.parent; - while (v instanceof Variable || v instanceof Expression) { - names.push((v).name); - v = (v).parent; - } - names = names.reverse(); - - let result = null; - names.forEach(name => { - if (!result) { - result = name; - } else if (Variable.ARRAY_ELEMENT_SYNTAX.test(name) || (this.process.configuration.type === 'node' && !Variable.NOT_PROPERTY_SYNTAX.test(name))) { - // use safe way to access node properties a['property_name']. Also handles array elements. - result = name && name.indexOf('[') === 0 ? `${result}${name}` : `${result}['${name}']`; - } else { - result = `${result}.${name}`; - } - }); - - return result; - } - public setVariable(value: string): TPromise { return this.process.session.setVariable({ name: this.name,