internal int GetChildPosition(int slot) { var result = Position; while (slot > 0) { slot--; var greenChild = _green.GetSlot(slot); if (greenChild != null) { result += greenChild.FullWidth; } } return(result); }
private static IEnumerable <SyntaxDiagnostic> GetDiagnosticsRecursive(Internal.GreenNode node, int position) { if (node.HasDiagnostics) { foreach (var diagnostic in node.GetDiagnostics()) { yield return(SyntaxDiagnostic.From(diagnostic, position)); } } for (var i = 0; i < node.Slots; i++) { var maybeChild = node.GetSlot(i); if (maybeChild is Internal.GreenNode child) { foreach (var diagnostic in GetDiagnosticsRecursive(child, position)) { yield return(diagnostic); } position += child.FullWidth; } } }