private static void ForEachLocalVariableRecursive( ISymUnmanagedScope scope, int offset, bool isScopeEndInclusive, Action<ISymUnmanagedVariable> action) { Debug.Assert(offset < 0 || scope.IsInScope(offset, isScopeEndInclusive)); // apply action on locals of the current scope: foreach (var local in scope.GetLocals()) { action(local); } // recurse: foreach (var child in scope.GetChildren()) { if (offset < 0 || child.IsInScope(offset, isScopeEndInclusive)) { ForEachLocalVariableRecursive(child, offset, isScopeEndInclusive, action); if (offset >= 0) { return; } } } }
private static void ForEachLocalVariableRecursive( ISymUnmanagedScope scope, int offset, bool isScopeEndInclusive, Action <ISymUnmanagedVariable> action) { Debug.Assert(offset < 0 || scope.IsInScope(offset, isScopeEndInclusive)); // apply action on locals of the current scope: foreach (var local in scope.GetLocals()) { action(local); } // recurse: foreach (var child in scope.GetChildren()) { if (offset < 0 || child.IsInScope(offset, isScopeEndInclusive)) { ForEachLocalVariableRecursive(child, offset, isScopeEndInclusive, action); if (offset >= 0) { return; } } } }
private static void ForEachLocalVariableRecursive( ISymUnmanagedScope scope, int offset, ref ISymUnmanagedVariable[] localsBuffer, Action <ISymUnmanagedVariable> action) { Debug.Assert((offset < 0) || scope.IsInScope(offset)); // apply action on locals of the current scope: int localCount; scope.GetLocalCount(out localCount); if (localCount > 0) { EnsureBufferSize(ref localsBuffer, localCount); scope.GetLocals(localCount, out localCount, localsBuffer); for (int i = 0; i < localCount; i++) { action(localsBuffer[i]); } } // recurse: int childCount; scope.GetChildren(0, out childCount, null); if (childCount > 0) { var children = new ISymUnmanagedScope[childCount]; scope.GetChildren(childCount, out childCount, children); foreach (var child in children) { if ((offset < 0) || child.IsInScope(offset)) { ForEachLocalVariableRecursive(child, offset, ref localsBuffer, action); if (offset >= 0) { return; } } } } }
private static void ForEachLocalVariableRecursive( ISymUnmanagedScope scope, int offset, bool isScopeEndInclusive, Action <ISymUnmanagedVariable> action) { Debug.Assert((offset < 0) || scope.IsInScope(offset, isScopeEndInclusive)); // apply action on locals of the current scope: var locals = GetLocalsInternal(scope); if (locals != null) { foreach (var local in locals) { action(local); } } // recurse: var children = GetScopesInternal(scope); if (children != null) { foreach (var child in children) { if ((offset < 0) || child.IsInScope(offset, isScopeEndInclusive)) { ForEachLocalVariableRecursive(child, offset, isScopeEndInclusive, action); if (offset >= 0) { return; } } } } }