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; } } }
private protected SyntaxNode(Internal.GreenNode green, int position) { _parent = this; _green = green; Position = position; }
internal RootSyntaxNode(Internal.GreenNode green, int position) : base(green, position) { }
internal MethodDeclarationSyntaxNode(SyntaxNode parent, Internal.GreenNode green, int position) : base(parent, green, position) { }
internal FunctionHandleExpressionSyntaxNode(SyntaxNode parent, Internal.GreenNode green, int position) : base(parent, green, position) { }
internal StatementSyntaxNode(SyntaxNode parent, Internal.GreenNode green, int position) : base(parent, green, position) { }
internal SyntaxNode(SyntaxNode parent, Internal.GreenNode green, int position) { _parent = parent; _green = green; Position = position; }
internal SyntaxTrivia(SyntaxNode parent, Internal.GreenNode trivia) { _parent = parent; _trivia = trivia; }
internal SyntaxToken(SyntaxNode parent, Internal.GreenNode token, int position) { _parent = parent; _token = token ?? throw new ArgumentNullException(nameof(token)); Position = position; }