Пример #1
0
        private bool TryGeneratingSymbolMetadata(ISymbol symbol, SyntaxNode syntax, out SymbolMetadata generatedSymbolMetadata)
        {
            generatedSymbolMetadata = null;

            var filePathsOfSourceDeclarations = symbol
                                                .Locations
                                                .Where(location => location.IsInSource)
                                                .Select(location => location.GetLineSpan().Path)
                                                .Select(path => CurrentProject.GetRelativePathToFile(path))
                                                .ToArray();

            if (!filePathsOfSourceDeclarations.Any())
            {
                return(false);
            }

            var assignedSymbolId = Guid.NewGuid().ToString("N");

            generatedSymbolMetadata = new SymbolMetadata(
                assignedSymbolId,
                symbol.MetadataName,
                filePathsOfSourceDeclarations,
                symbol.Kind);

            return(true);
        }