コード例 #1
0
        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));
        }
コード例 #2
0
ファイル: StatementState.cs プロジェクト: psxvoid/RoslyJump
        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)}"));
        }