CodeModel\AbstractCodeModelService.cs (20)
41private readonly ConditionalWeakTable<SyntaxTree, IBidirectionalMap<SyntaxNodeKey, SyntaxNode>> _treeToNodeKeyMaps =
42new ConditionalWeakTable<SyntaxTree, IBidirectionalMap<SyntaxNodeKey, SyntaxNode>>();
104private IBidirectionalMap<SyntaxNodeKey, SyntaxNode> BuildNodeKeyMap(SyntaxTree syntaxTree)
107var nodeKeyMap = BidirectionalMap<SyntaxNodeKey, SyntaxNode>.Empty;
119var key = new SyntaxNodeKey(name, ordinal);
126private IBidirectionalMap<SyntaxNodeKey, SyntaxNode> GetNodeKeyMap(SyntaxTree syntaxTree)
129public SyntaxNodeKey GetNodeKey(SyntaxNode node)
131var nodeKey = TryGetNodeKey(node);
141public SyntaxNodeKey TryGetNodeKey(SyntaxNode node)
144if (!nodeKeyMap.TryGetKey(node, out var nodeKey))
146return SyntaxNodeKey.Empty;
152public SyntaxNode LookupNode(SyntaxNodeKey nodeKey, SyntaxTree syntaxTree)
163public bool TryLookupNode(SyntaxNodeKey nodeKey, SyntaxTree syntaxTree, [NotNullWhen(true)] out SyntaxNode? node)
336.FirstOrDefault(n => TryGetNodeKey(n) != SyntaxNodeKey.Empty);
363var nodeKey = parentNode.AncestorsAndSelf()
365.FirstOrDefault(nk => nk != SyntaxNodeKey.Empty);
367if (nodeKey == SyntaxNodeKey.Empty)
406.FirstOrDefault(n => TryGetNodeKey(n) != SyntaxNodeKey.Empty);
433.FirstOrDefault(n => TryGetNodeKey(n) != SyntaxNodeKey.Empty);
452.FirstOrDefault(n => TryGetNodeKey(n) != SyntaxNodeKey.Empty);