コード例 #1
0
        internal static async Task <GraphNodeId> GetIdForAssemblyAsync(IAssemblySymbol assemblySymbol, Solution solution, CancellationToken cancellationToken)
        {
            Uri assembly = await GetAssemblyFullPathAsync(assemblySymbol, solution, cancellationToken).ConfigureAwait(false);

            if (assembly != null)
            {
                CodeQualifiedIdentifierBuilder builder = new CodeQualifiedIdentifierBuilder();
                builder.Assembly = assembly;
                return(builder.ToQualifiedIdentifier());
            }

            return(null);
        }
コード例 #2
0
        internal static async Task<GraphNodeId> GetIdForNamespaceAsync(INamespaceSymbol symbol, Solution solution, CancellationToken cancellationToken)
        {
            CodeQualifiedIdentifierBuilder builder = new CodeQualifiedIdentifierBuilder();

            var assembly = await GetAssemblyFullPathAsync(symbol, solution, cancellationToken).ConfigureAwait(false);
            if (assembly != null)
            {
                builder.Assembly = assembly;
            }

            builder.Namespace = symbol.ToDisplayString();

            return builder.ToQualifiedIdentifier();
        }
コード例 #3
0
        internal static async Task <GraphNodeId> GetIdForNamespaceAsync(INamespaceSymbol symbol, Solution solution, CancellationToken cancellationToken)
        {
            CodeQualifiedIdentifierBuilder builder = new CodeQualifiedIdentifierBuilder();

            var assembly = await GetAssemblyFullPathAsync(symbol, solution, cancellationToken).ConfigureAwait(false);

            if (assembly != null)
            {
                builder.Assembly = assembly;
            }

            builder.Namespace = symbol.ToDisplayString();

            return(builder.ToQualifiedIdentifier());
        }
コード例 #4
0
ファイル: GraphNodeIdCreation.cs プロジェクト: belav/roslyn
        internal static async Task <GraphNodeId> GetIdForLocalVariableAsync(
            ISymbol symbol,
            Solution solution,
            CancellationToken cancellationToken
            )
        {
            if (
                symbol.ContainingSymbol == null ||
                (
                    symbol.ContainingSymbol.Kind != SymbolKind.Method &&
                    symbol.ContainingSymbol.Kind != SymbolKind.Property
                )
                )
            {
                // We are only support local variables inside methods or properties.
                throw new ArgumentException("symbol");
            }

            var memberId = await GetIdForMemberAsync(
                symbol.ContainingSymbol,
                solution,
                cancellationToken
                )
                           .ConfigureAwait(false);

            if (memberId != null)
            {
                var builder = new CodeQualifiedIdentifierBuilder(memberId);
                builder.LocalVariable      = symbol.Name;
                builder.LocalVariableIndex = await GetLocalVariableIndexAsync(
                    symbol,
                    solution,
                    cancellationToken
                    )
                                             .ConfigureAwait(continueOnCapturedContext: false);

                return(builder.ToQualifiedIdentifier());
            }

            return(null);
        }
コード例 #5
0
        internal static async Task<GraphNodeId> GetIdForLocalVariableAsync(ISymbol symbol, Solution solution, CancellationToken cancellationToken)
        {
            if (symbol.ContainingSymbol == null ||
                (symbol.ContainingSymbol.Kind != SymbolKind.Method && symbol.ContainingSymbol.Kind != SymbolKind.Property))
            {
                // We are only support local variables inside methods or properties.
                throw new ArgumentException("symbol");
            }

            GraphNodeId memberId = await GetIdForMemberAsync(symbol.ContainingSymbol, solution, cancellationToken).ConfigureAwait(false);
            if (memberId != null)
            {
                CodeQualifiedIdentifierBuilder builder = new CodeQualifiedIdentifierBuilder(memberId);
                builder.LocalVariable = symbol.Name;
                builder.LocalVariableIndex = await GetLocalVariableIndexAsync(symbol, solution, cancellationToken).ConfigureAwait(continueOnCapturedContext: false);

                return builder.ToQualifiedIdentifier();
            }

            return null;
        }
コード例 #6
0
        internal static async Task<GraphNodeId> GetIdForAssemblyAsync(IAssemblySymbol assemblySymbol, Solution solution, CancellationToken cancellationToken)
        {
            Uri assembly = await GetAssemblyFullPathAsync(assemblySymbol, solution, cancellationToken).ConfigureAwait(false);
            if (assembly != null)
            {
                CodeQualifiedIdentifierBuilder builder = new CodeQualifiedIdentifierBuilder();
                builder.Assembly = assembly;
                return builder.ToQualifiedIdentifier();
            }

            return null;
        }