public Variable[] GetEvaluatedVariables(string expression, int threadId, int frameIndex, int[] path) { var machine = Controller.GetTokenForThread(threadId).Machine; var srcVariable = Evaluate(threadId, frameIndex, expression); IValue value; try { value = GetMachine(threadId).Evaluate(expression, true); } catch (Exception e) { value = ValueFactory.Create(e.Message); } var locals = GetChildVariables(MachineVariable.Create(value, "$eval")); foreach (var step in path) { var variable = locals[step]; locals = GetChildVariables(variable); } return(GetDebugVariables(locals)); }
public void ShowCollectionItems(IEnumerable <IValue> collection) { int index = 0; foreach (var collectionItem in collection) { _children.Add(Variable.Create(collectionItem, index.ToString())); ++index; } }
public virtual Variable Evaluate(int threadId, int contextFrame, string expression) { try { var value = GetMachine(threadId) .Evaluate(expression, true) .GetRawValue(); var variable = _visualizer.GetVariable(MachineVariable.Create(value, "$evalResult")); return(variable); } catch (ScriptException e) { return(CreateDebuggerVariable("$evalFault", e.ErrorDescription, "Ошибка")); } }
private void FillKeyValueProperties(IEnumerable <KeyAndValueImpl> collection, List <IVariable> variables) { var propsCount = collection.Count(); int i = 0; foreach (var kv in collection) { IVariable value; value = MachineVariable.Create(kv, i.ToString()); variables.Add(value); i++; } }
public virtual Variable Evaluate(int threadId, int contextFrame, string expression) { try { var value = GetMachine(threadId).Evaluate(expression, true); var variable = CreateDebuggerVariable("$evalResult", value.AsString(), value.SystemType.Name); variable.IsStructured = IsStructured(MachineVariable.Create(value, "$eval")); return(variable); } catch (ScriptException e) { return(CreateDebuggerVariable("$evalFault", e.ErrorDescription, "Ошибка")); } }
public virtual Variable[] GetEvaluatedVariables(string expression, int threadId, int frameIndex, int[] path) { IValue value; try { value = GetMachine(threadId).Evaluate(expression, true); } catch (Exception e) { value = ValueFactory.Create(e.Message); } var locals = GetChildVariables(MachineVariable.Create(value, "$eval")); foreach (var step in path) { var variable = locals[step]; locals = GetChildVariables(variable); } return(GetDebugVariables(locals)); }
public void ShowProperties(IRuntimeContextInstance context) { var propsCount = context.GetPropCount(); for (int i = 0; i < propsCount; i++) { var propNum = i; var propName = context.GetPropName(propNum); IVariable value; try { value = Variable.Create(context.GetPropValue(propNum), propName); } catch (Exception e) { value = Variable.Create(ValueFactory.Create(e.Message), propName); } _children.Add(value); } }
private void FillProperties(IVariable src, List <IVariable> variables) { var obj = src.AsObject(); var propsCount = obj.GetPropCount(); for (int i = 0; i < propsCount; i++) { string propName = obj.GetPropName(i); IVariable value; try { value = MachineVariable.Create(obj.GetPropValue(i), propName); } catch (Exception e) { value = MachineVariable.Create(ValueFactory.Create(e.Message), propName); } variables.Add(value); } }
public Variable Evaluate(int threadId, int contextFrame, string expression) { try { var value = GetMachine(threadId).Evaluate(expression, true); return(new Variable() { Name = "$evalResult", Presentation = value.AsString(), TypeName = value.SystemType.Name, IsStructured = IsStructured(MachineVariable.Create(value, "$eval")) }); } catch (ScriptException e) { return(new Variable() { Name = "$evalFault", Presentation = e.ErrorDescription, TypeName = "Ошибка", IsStructured = false }); } }
private void FillIndexedProperties(IVariable src, List <IVariable> variables) { var obj = src.AsObject(); if (obj is ICollectionContext cntx) { var itemsCount = cntx.Count(); for (int i = 0; i < itemsCount; i++) { IValue value; try { value = obj.GetIndexedValue(ValueFactory.Create(i)); } catch (Exception) { continue; } variables.Add(MachineVariable.Create(value, i.ToString())); } } }