public IDebugVariable[] GetChildren(DebugVariableLinkCollection collection, IDebugVariable parent) { // The class reference of the parent variable. int reference = (int)((CsvNumber)parent.Value).Value; IDebugVariable[] variables = new IDebugVariable[Class.ObjectVariables.Count]; for (int i = 0; i < variables.Length; i++) { CsvPart value = new CsvNull(); // Get the related object variable array. var objectVariableArray = collection.ActionStream.Variables.FirstOrDefault(v => v.Name == ClassData.ObjectVariableTag + i); if (objectVariableArray != null && objectVariableArray.Value is Csv.CsvArray csvArray) { value = csvArray.Values[reference]; } variables[i] = new ChildDebugVariable( // Child variable resolver Class.ObjectVariables[i].Variable.Type()?.DebugVariableResolver ?? new DefaultResolver(), // Value value, // Name Class.ObjectVariables[i].Variable.Name, // Type Class.ObjectVariables[i].Variable.Type()?.GetName() ?? "define" ); collection.Add(variables[i]); } return(variables); }
public EvaluateResponse GetEvaluation(DebugVariableLinkCollection collection, IDebugVariable debugVariable) { // Return null if there is no value. if (debugVariable.Value == null) { return(EvaluateResponse.Empty); } // Create the evaluation response. IDebugVariable.ApplyReference(collection, debugVariable); EvaluateResponse response = new EvaluateResponse(collection, debugVariable); response.namedVariables = Class.ObjectVariables.Count; return(response); }
public DBPVariable GetVariable(DebugVariableLinkCollection collection, IDebugVariable debugVariable) { // Return null if there is no value. if (debugVariable.Value == null) { return(null); } // Create the variable. DBPVariable variable = new DBPVariable(debugVariable, Class.Name); variable.namedVariables = Class.ObjectVariables.Count; variable.variablesReference = IDebugVariable.ApplyReference(collection, debugVariable); return(variable); }
public IDebugVariable[] GetChildren(DebugVariableLinkCollection collection, IDebugVariable parent) { // Use the default resolver if the value is not a number. if (parent.Value is CsvNumber == false) { return(new DefaultResolver().GetChildren(collection, parent)); } // The class reference of the parent variable. int reference = (int)((CsvNumber)parent.Value).Value; IDebugVariable[] variables = new IDebugVariable[Class.Variables.Length]; for (int i = 0; i < variables.Length; i++) { CsvPart value = new CsvNull(); // Get the related object variable array. var objectVariableArray = collection.ActionStream.Variables.FirstOrDefault(v => v.Name == ClassData.ObjectVariableTag + i); if (objectVariableArray != null && objectVariableArray.Value is Csv.CsvArray csvArray && reference < csvArray.Values.Length) { value = csvArray.Values[reference]; } var type = Class.Variables[i].CodeType.GetCodeType(_deltinScript); variables[i] = new ChildDebugVariable( // Child variable resolver type.DebugVariableResolver ?? new DefaultResolver(), // Value value, // Name Class.Variables[i].Name, // Type type.GetName() ); collection.Add(variables[i]); } return(variables); }
public EvaluateResponse(DebugVariableLinkCollection collection, IDebugVariable variable) { type = variable.Type; result = variable.Value.ToString(); collection.References.TryGetValue(variable, out variablesReference); }