当前位置: 首页>>代码示例>>C#>>正文


C# ISymbol.OverriddenMember方法代码示例

本文整理汇总了C#中ISymbol.OverriddenMember方法的典型用法代码示例。如果您正苦于以下问题:C# ISymbol.OverriddenMember方法的具体用法?C# ISymbol.OverriddenMember怎么用?C# ISymbol.OverriddenMember使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISymbol的用法示例。


在下文中一共展示了ISymbol.OverriddenMember方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FindSymbols

		void FindSymbols (ISymbol sym)
		{
			if (sym == null)
				return;
			Task.Run (delegate {
				using (var monitor = IdeApp.Workbench.ProgressMonitors.GetSearchProgressMonitor (true, true)) {
					var foundSymbol = sym.OverriddenMember ();
					while (foundSymbol != null) {
						foreach (var loc in foundSymbol.Locations)
							monitor.ReportResult (new MemberReference (foundSymbol, loc.SourceTree.FilePath, loc.SourceSpan.Start, loc.SourceSpan.Length));
						foundSymbol = foundSymbol.OverriddenMember ();
					}
				}
			});
		}
开发者ID:powerumc,项目名称:monodevelop_korean,代码行数:15,代码来源:FindBaseSymbolsHandler.cs

示例2: CreateFinders

        public async Task<IEnumerable<AbstractCallFinder>> CreateFinders(ISymbol symbol, Project project, CancellationToken cancellationToken)
        {
            if (symbol.Kind == SymbolKind.Property ||
                    symbol.Kind == SymbolKind.Event ||
                    symbol.Kind == SymbolKind.Method)
            {
                var finders = new List<AbstractCallFinder>();

                finders.Add(new MethodCallFinder(symbol, project, _asyncListener, this));

                if (symbol.IsVirtual || symbol.IsAbstract)
                {
                    finders.Add(new OverridingMemberFinder(symbol, project, _asyncListener, this));
                }

                var @overrides = await SymbolFinder.FindOverridesAsync(symbol, project.Solution, cancellationToken: cancellationToken).ConfigureAwait(false);
                if (overrides.Any())
                {
                    finders.Add(new CallToOverrideFinder(symbol, project, _asyncListener, this));
                }

                if (symbol.OverriddenMember() != null)
                {
                    finders.Add(new BaseMemberFinder(symbol.OverriddenMember(), project, _asyncListener, this));
                }

                var implementedInterfaceMembers = await SymbolFinder.FindImplementedInterfaceMembersAsync(symbol, project.Solution, cancellationToken: cancellationToken).ConfigureAwait(false);
                foreach (var implementedInterfaceMember in implementedInterfaceMembers)
                {
                    finders.Add(new InterfaceImplementationCallFinder(implementedInterfaceMember, project, _asyncListener, this));
                }

                if (symbol.IsImplementableMember())
                {
                    finders.Add(new ImplementerFinder(symbol, project, _asyncListener, this));
                }

                return finders;
            }

            if (symbol.Kind == SymbolKind.Field)
            {
                return SpecializedCollections.SingletonEnumerable(new FieldReferenceFinder(symbol, project, _asyncListener, this));
            }

            return null;
        }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:47,代码来源:CallHierarchyProvider.cs

示例3: GetVBPropertyFromAccessorOrAnOverrideAsync

        private static async Task<ISymbol> GetVBPropertyFromAccessorOrAnOverrideAsync(ISymbol symbol, Solution solution, CancellationToken cancellationToken)
        {
            try
            {
                if (symbol.IsPropertyAccessor())
                {
                    var property = ((IMethodSymbol)symbol).AssociatedSymbol;

                    return property.Language == LanguageNames.VisualBasic ? property : null;
                }

                if (symbol.IsOverride && symbol.OverriddenMember() != null)
                {
                    var originalSourceSymbol = await SymbolFinder.FindSourceDefinitionAsync(symbol.OverriddenMember(), solution, cancellationToken).ConfigureAwait(false);

                    if (originalSourceSymbol != null)
                    {
                        return await GetVBPropertyFromAccessorOrAnOverrideAsync(originalSourceSymbol, solution, cancellationToken).ConfigureAwait(false);
                    }
                }

                return null;
            }
            catch (Exception e) when (FatalError.ReportUnlessCanceled(e))
            {
                throw ExceptionUtilities.Unreachable;
            }
        }
开发者ID:nemec,项目名称:roslyn,代码行数:28,代码来源:CSharpRenameRewriterLanguageService.cs

示例4: GetPropertyFromAccessorOrAnOverride

            internal static async Task<ISymbol> GetPropertyFromAccessorOrAnOverride(ISymbol symbol, Solution solution, CancellationToken cancellationToken)
            {
                if (symbol.IsPropertyAccessor())
                {
                    return ((IMethodSymbol)symbol).AssociatedSymbol;
                }

                if (symbol.IsOverride && symbol.OverriddenMember() != null)
                {
                    var originalSourceSymbol = await SymbolFinder.FindSourceDefinitionAsync(symbol.OverriddenMember(), solution, cancellationToken).ConfigureAwait(false);

                    if (originalSourceSymbol != null)
                    {
                        return await GetPropertyFromAccessorOrAnOverride(originalSourceSymbol, solution, cancellationToken).ConfigureAwait(false);
                    }
                }

                if (symbol.Kind == SymbolKind.Method &&
                    symbol.ContainingType.TypeKind == TypeKind.Interface)
                {
                    var methodImplementors = await SymbolFinder.FindImplementationsAsync(symbol, solution, cancellationToken: cancellationToken).ConfigureAwait(false);

                    foreach (var methodImplementor in methodImplementors)
                    {
                        var propertyAccessorOrAnOverride = await GetPropertyFromAccessorOrAnOverride(methodImplementor, solution, cancellationToken).ConfigureAwait(false);
                        if (propertyAccessorOrAnOverride != null)
                        {
                            return propertyAccessorOrAnOverride;
                        }
                    }
                }

                return null;
            }
开发者ID:jerriclynsjohn,项目名称:roslyn,代码行数:34,代码来源:RenameLocation.ReferenceProcessing.cs

示例5: GetVBPropertyFromAccessorOrAnOverrideAsync

        private static async Task<ISymbol> GetVBPropertyFromAccessorOrAnOverrideAsync(ISymbol symbol, Solution solution, CancellationToken cancellationToken)
        {
            if (symbol.IsPropertyAccessor())
            {
                var property = ((IMethodSymbol)symbol).AssociatedSymbol;

                return property.Language == LanguageNames.VisualBasic ? property : null;
            }

            if (symbol.IsOverride && symbol.OverriddenMember() != null)
            {
                var originalSourceSymbol = await SymbolFinder.FindSourceDefinitionAsync(symbol.OverriddenMember(), solution, cancellationToken).ConfigureAwait(false);

                if (originalSourceSymbol != null)
                {
                    return await GetVBPropertyFromAccessorOrAnOverrideAsync(originalSourceSymbol, solution, cancellationToken).ConfigureAwait(false);
                }
            }

            return null;
        }
开发者ID:riversky,项目名称:roslyn,代码行数:21,代码来源:CSharpRenameRewriterLanguageService.cs

示例6: GetBaseMember

        static ISymbol GetBaseMember(ISymbol declaredSymbol, out string documentation, CancellationToken cancellationToken)
        {
            var overriddenMember = declaredSymbol.OverriddenMember();
            documentation = overriddenMember != null ? overriddenMember.GetDocumentationCommentXml(null, false, cancellationToken) : "";

            if (!string.IsNullOrEmpty(documentation) || declaredSymbol.Kind == SymbolKind.NamedType)
                return overriddenMember;

            var containingType = declaredSymbol.ContainingType;
            if (containingType == null)
            {
                documentation = null;
                return null;
            }
            foreach (var iface in containingType.AllInterfaces)
            {
                foreach (var member in iface.GetMembers())
                {
                    var implementation = containingType.FindImplementationForInterfaceMember(member);
                    if (implementation == declaredSymbol)
                    {
                        documentation = member.GetDocumentationCommentXml(null, false, cancellationToken);
                        if (!string.IsNullOrEmpty(documentation))
                            return implementation;
                    }
                }
            }
            return null;
        }
开发者ID:alecor191,项目名称:RefactoringEssentials,代码行数:29,代码来源:CopyCommentsFromBaseCodeRefactoringProvider.cs

示例7: CheckAutomaticToStringCallers

        static void CheckAutomaticToStringCallers(SyntaxNodeAnalysisContext nodeContext, InvocationExpressionSyntax invocationExpression, ISymbol member)
        {
            if (member.IsOverride)
            {
                member = member.OverriddenMember();
                if (member == null)
                {
                    return;
                }
            }

            var method = member as IMethodSymbol;
            if (method == null)
                return;
            var id = method.GetDocumentationCommentId ();
            if (!membersCallingToString.Any (m => id.StartsWith (m, StringComparison.Ordinal)))
                return;

            var arguments = invocationExpression.ArgumentList.Arguments;
            for (int i = 0; i < arguments.Count; ++i)
            {
                CheckExpressionInAutoCallContext(nodeContext, arguments[i].Expression);
            }
        }
开发者ID:yeaicc,项目名称:RefactoringEssentials,代码行数:24,代码来源:RedundantToStringCallAnalyzer.cs


注:本文中的ISymbol.OverriddenMember方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。