protected override CombinedSyntaxNode?QueryChildContextNode() { SyntaxNode?firstKnownChild = this.BaseNode.Members .Cast <SyntaxNode>() .FirstOrDefault(x => LocalContext.IsKnownNodeType(x) || x is ExpressionSyntax); return(firstKnownChild == null ? (CombinedSyntaxNode?)null : firstKnownChild.QueryVirtualAndCombine(NestedBlockVirtualQuery.Instance)); }
protected override CombinedSyntaxNode[] QueryTargetNodesFunc() { SyntaxNode?parent = this.BaseNode.Parent; parent = parent is LabeledStatementSyntax ? parent.Parent : parent; return(parent?.ChildNodes() .Select(x => x is LabeledStatementSyntax label ? label.Statement : x) .QueryVirtualAndCombine(VirtualQueryExtensions.GetAllSupportedQueries()) .Where(x => // all known types should have more narrowed states // (child of StatementSyntax) that is why we have to // exclude them. All not implemented statements will // use this state instead !LocalContext.IsKnownNodeType(x) && MethodBodyMemberSyntaxNodeMatcher.Instance.Match(x)) .ToArray() ?? throw new InvalidOperationException( $"Unable to query the target nodes for {nameof(StatementState)}")); }