public VariableHandle Create(uint frameId, VariableScopeEnum scope) { VariableHandle result = new VariableHandle() { FrameId = frameId, Scope = scope, Id = int.MaxValue - id++ }; handles.Add(result.Id, result); return(result); }
private VariablesResponseBody loadVariablesFromScope(VariableHandle handle) { var t = debuggingService.GetStackProperties(handle.FrameId); switch (handle.Scope) { case VariableScopeEnum.Local: var variables = (from item in t.Locals select item.ToVSCodeVarible()).ToList(); variables.Insert(0, t.ThisObject.ToVSCodeVarible("[{0}]")); if (t.Arguments.Handle != 0) { variables.Insert(1, t.Arguments.ToVSCodeVarible()); } return(new VariablesResponseBody(variables)); case VariableScopeEnum.Globals: return(loadVariableProperties(t.Global.Handle)); case VariableScopeEnum.Scopes: if (t.Scopes.Length > 0) { List <Variable> scopes = new List <Variable>(); foreach (var item in t.Scopes) { scopes.Add(new Variable($"Scope #{item.Index}", string.Empty, string.Empty, (int)item.Handle)); } return(new VariablesResponseBody(scopes)); } else { return(null); } default: throw new ArgumentOutOfRangeException(nameof(handle), "Invalid scope type"); } }
public bool TryGet(int id, out VariableHandle result) { return(handles.TryGetValue(id, out result)); }