public bool MoveNext() { while (_count > 0) { int diagIndex = _stack[_count - 1].DiagnosticIndex; GreenNode node = _stack[_count - 1].Node; DiagnosticInfo[] diags = node.GetDiagnostics(); if (diagIndex < diags.Length - 1) { diagIndex++; Current = diags[diagIndex]; _stack[_count - 1].DiagnosticIndex = diagIndex; return(true); } int slotIndex = _stack[_count - 1].SlotIndex; tryAgain: if (slotIndex < node.SlotCount - 1) { slotIndex++; GreenNode child = node.GetSlot(slotIndex); if (child == null || !child.ContainsDiagnostics) { goto tryAgain; } _stack[_count - 1].SlotIndex = slotIndex; this.PushNodeOrToken(child); } else { this.Pop(); } } return(false); }
/* <summary> * ''' Add all the tokens in this node and children to the build token list builder. While doing this, add any * ''' diagnostics not on tokens to the given diagnostic info list. * ''' </summary> */ /*internal virtual void CollectConstituentTokensAndDiagnostics(SyntaxListBuilder<SyntaxToken> tokenListBuilder, IList<DiagnosticInfo> nonTokenDiagnostics) * { * DiagnosticInfo[] diagnostics = this.GetDiagnostics(); * if (diagnostics != null && diagnostics.Length > 0) * { * foreach (var diag in diagnostics) * { * nonTokenDiagnostics.Add(diag); * } * } * * // Recurse to subtrees. * for (var i = 0; i < SlotCount; i++) * { * var green = GetSlot(i); * if (green != null) * { * green.CollectConstituentTokensAndDiagnostics(tokenListBuilder, nonTokenDiagnostics); * } * } * }*/ internal DiagnosticInfo[] GetDiagnostics() => GreenNode.GetDiagnostics();
public DiagnosticInfo[] GetDiagnostics() => GreenNode.GetDiagnostics();