/// <summary> /// Creates an evaluation result for an expression which successfully returned a value. /// </summary> public NodeEvaluationResult(int handle, string stringValue, string hexValue, string typeName, string expression, string fullName, NodeExpressionType type, NodeStackFrame frame) { Handle = handle; Frame = frame; Expression = expression; StringValue = stringValue; HexValue = hexValue; TypeName = typeName; FullName = fullName; Type = type; }
/// <summary> /// Creates a evaluation result for an expression which successfully returned a value. /// </summary> public NodeEvaluationResult(IDebuggerManager debugger, string stringValue, string hexValue, string typeName, string expression, string fullName, NodeExpressionType type, NodeStackFrame stackFrame, int id) { Debugger = debugger; Name = expression; FullName = fullName; StackFrame = stackFrame; _stringValue = stringValue; HexValue = hexValue; TypeName = typeName; Id = id; Type = type; }
/// <summary> /// Creates an evaluation result for an expression which successfully returned a value. /// </summary> public NodeEvaluationResult(int handle, string stringValue, string hexValue, string typeName, string expression, string fullName, NodeExpressionType type, NodeStackFrame frame) { this.Handle = handle; this.Frame = frame; this.Expression = expression; this.StringValue = stringValue; this.HexValue = hexValue; this.TypeName = typeName; this.FullName = fullName; this.Type = type; }
public static NodeEvaluationResult CreateVariable(IVariableProvider variable) { int id = variable.Id; IDebuggerManager debugger = variable.Debugger; NodeStackFrame stackFrame = variable.StackFrame; NodeEvaluationResult parent = variable.Parent; string name = variable.Name; string fullName = GetFullName(parent, variable.Name, ref name); string stringValue; string typeName = variable.TypeName; NodeExpressionType type = 0; if (variable.Attributes.HasFlag(PropertyAttribute.ReadOnly)) { type |= NodeExpressionType.ReadOnly; } if (variable.Attributes.HasFlag(PropertyAttribute.DontEnum)) { type |= NodeExpressionType.Private; } switch (typeName) { case "undefined": stringValue = "undefined"; typeName = "Undefined"; break; case "null": stringValue = "null"; typeName = "Null"; break; case "number": stringValue = variable.Value; typeName = "Number"; break; case "boolean": stringValue = variable.Value.ToLowerInvariant(); typeName = "Boolean"; type |= NodeExpressionType.Boolean; break; case "regexp": stringValue = variable.Value; typeName = "Regular Expression"; type |= NodeExpressionType.Expandable; break; case "function": stringValue = string.IsNullOrEmpty(variable.Text) ? "{Function}" : variable.Text; typeName = "Function"; type |= NodeExpressionType.Function | NodeExpressionType.Expandable; break; case "string": stringValue = variable.Value; typeName = "String"; type |= NodeExpressionType.String; break; case "object": stringValue = variable.Class == "Object" ? "{...}" : string.Format("{{{0}}}", variable.Class); typeName = "Object"; type |= NodeExpressionType.Expandable; break; case "error": stringValue = variable.Value; if (!string.IsNullOrEmpty(stringValue) && stringValue.StartsWith("Error: ")) { stringValue = variable.Value.Substring(7); } typeName = "Error"; type |= NodeExpressionType.Expandable; break; default: stringValue = variable.Value; break; } return(new NodeEvaluationResult(debugger, stringValue, null, typeName, name, fullName, type, stackFrame, id)); }