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


C# Refactoring.BaseRefactoringContext类代码示例

本文整理汇总了C#中ICSharpCode.NRefactory.CSharp.Refactoring.BaseRefactoringContext的典型用法代码示例。如果您正苦于以下问题:C# BaseRefactoringContext类的具体用法?C# BaseRefactoringContext怎么用?C# BaseRefactoringContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BaseRefactoringContext类属于ICSharpCode.NRefactory.CSharp.Refactoring命名空间,在下文中一共展示了BaseRefactoringContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetIssues

		public IEnumerable<CodeIssue> GetIssues (BaseRefactoringContext context)
		{
			var unit = context.RootNode as SyntaxTree;
			if (unit == null)
				return Enumerable.Empty<CodeIssue> ();
			return GetGatherVisitor (context, unit).GetIssues ();
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:7,代码来源:VariableOnlyAssignedIssue.cs

示例2: GetIssues

		public IEnumerable<CodeIssue> GetIssues(BaseRefactoringContext context)
		{
			var visitor = new GatherVisitor (context, this);
			context.RootNode.AcceptVisitor (visitor);
			visitor.Collect ();
			return visitor.FoundIssues;
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:7,代码来源:RedundantUsingIssue.cs

示例3: GetIssues

        public IEnumerable<CodeIssue> GetIssues(BaseRefactoringContext context)
        {
            var delegateVisitor = new GetDelgateUsagesVisitor (context);
            context.RootNode.AcceptVisitor (delegateVisitor);

            return new GatherVisitor (context, delegateVisitor).GetIssues ();
        }
开发者ID:Xiaoqing,项目名称:NRefactory,代码行数:7,代码来源:ParameterNotUsedIssue.cs

示例4: GetIssues

			public IEnumerable<CodeIssue> GetIssues(BaseRefactoringContext context)
			{
				// use a separate instance for every call, this is necessary
				// for thread-safety
				var provider = (CodeIssueProvider)Activator.CreateInstance(ProviderType);
				return provider.GetIssues(context);
			}
开发者ID:kristjan84,项目名称:SharpDevelop,代码行数:7,代码来源:IssueManager.cs

示例5: GetIssues

		public IEnumerable<CodeIssue> GetIssues (BaseRefactoringContext context)
		{
			var unit = context.RootNode as CompilationUnit;
			if (unit == null)
				return Enumerable.Empty<CodeIssue> ();
			return new GatherVisitor (context, unit).GetIssues ();
		}
开发者ID:mono-soc-2012,项目名称:NRefactory,代码行数:7,代码来源:TypeParameterNotUsedIssue.cs

示例6: GatherVisitor

			public GatherVisitor (BaseRefactoringContext context, CompilationUnit unit,
								  AccessToClosureIssue issueProvider)
				: base (context)
			{
				this.title = context.TranslateString (issueProvider.Title);
				this.unit = unit;
				this.issueProvider = issueProvider;
			}
开发者ID:mono-soc-2012,项目名称:NRefactory,代码行数:8,代码来源:AccessToClosureIssue.cs

示例7: GatherVisitor

			public GatherVisitor(BaseRefactoringContext context) : base (context)
			{
				this.context = context;
				rules = new Dictionary<string, Func<int, int, bool>>();
				rules [typeof(ArgumentException).FullName] = (left, right) => left > right;
				rules [typeof(ArgumentNullException).FullName] = (left, right) => left < right;
				rules [typeof(ArgumentOutOfRangeException).FullName] = (left, right) => left < right;
				rules [typeof(DuplicateWaitObjectException).FullName] = (left, right) => left < right;
			}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:9,代码来源:IncorrectExceptionParameterOrderingIssue.cs

示例8: GetIssues

		public IEnumerable<CodeIssue> GetIssues(BaseRefactoringContext context)
		{
			var sw = new Stopwatch();
			sw.Start();
			var gatherer = new GatherVisitor(context, tryResolve);
			var issues = gatherer.GetIssues();
			sw.Stop();
			Console.WriteLine("Elapsed time in ParameterCanBeDemotedIssue: {0} (Checked types: {3, 4} Qualified for resolution check: {5, 4} Members with issues: {4, 4} Method bodies resolved: {2, 4} File: '{1}')",
			                  sw.Elapsed, context.UnresolvedFile.FileName, gatherer.MethodResolveCount, gatherer.TypesChecked, gatherer.MembersWithIssues, gatherer.TypeResolveCount);
			return issues;
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:11,代码来源:ParameterCanBeDemotedIssue.cs

示例9: FindUsage

		protected static bool FindUsage (BaseRefactoringContext context, CompilationUnit unit, IVariable variable,
										 AstNode declaration)
		{
			var found = false;
			refFinder.FindLocalReferences (variable, context.ParsedFile, unit, context.Compilation,
				(node, resolveResult) =>
				{
					found = found || node != declaration;
				}, context.CancellationToken);
			return found;
		}
开发者ID:mono-soc-2012,项目名称:NRefactory,代码行数:11,代码来源:VariableNotUsedIssue.cs

示例10: FindUsage

		protected static bool FindUsage (BaseRefactoringContext context, SyntaxTree unit,
										 ITypeParameter typaParameter, AstNode declaration)
		{
			var found = false;
			refFinder.FindTypeParameterReferences (typaParameter, context.UnresolvedFile, unit, context.Compilation,
				(node, resolveResult) =>
				{
					found = found || node != declaration;
				}, context.CancellationToken);
			return found;
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:11,代码来源:TypeParameterNotUsedIssue.cs

示例11: GetIssues

		public override IEnumerable<CodeIssue> GetIssues(BaseRefactoringContext context, string subIssue = null)
		{
			var refactoringContext = context as SDRefactoringContext;
			if (refactoringContext == null)
				return Enumerable.Empty<CodeIssue>();
			
			var syntaxTree = context.RootNode as SyntaxTree;
			if (syntaxTree == null)
				return Enumerable.Empty<CodeIssue>();

			return syntaxTree.Errors.Select(error => CreateCodeIssue(error, refactoringContext));
		}
开发者ID:nataviva,项目名称:SharpDevelop-1,代码行数:12,代码来源:CSharpSyntaxIssue.cs

示例12: GetElementType

        static IType GetElementType(ResolveResult rr, BaseRefactoringContext context)
        {
            if (rr.IsError || rr.Type.Kind == TypeKind.Unknown)
                return null;
            var type = GetCollectionType(rr.Type);
            if (type == null)
                return null;

            var parameterizedType = type as ParameterizedType;
            if (parameterizedType != null)
                return parameterizedType.TypeArguments.First();
            return context.Compilation.FindType(KnownTypeCode.Object);
        }
开发者ID:riviti,项目名称:NRefactory,代码行数:13,代码来源:IterateViaForeachAction.cs

示例13: HidesMember

		protected static bool HidesMember(BaseRefactoringContext ctx, AstNode node, string variableName)
		{
			var typeDecl = node.GetParent<TypeDeclaration> ();
			if (typeDecl == null)
				return false;
			var typeResolveResult = ctx.Resolve (typeDecl) as TypeResolveResult;
			if (typeResolveResult == null)
				return false;

			var entityDecl = node.GetParent<EntityDeclaration> ();
			var isStatic = (entityDecl.Modifiers & Modifiers.Static) == Modifiers.Static;

			return typeResolveResult.Type.GetMembers (m => m.Name == variableName && m.IsStatic	== isStatic).Any ();
		}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:14,代码来源:VariableHidesMemberIssue.cs

示例14: TestOnlyAssigned

		protected static bool TestOnlyAssigned(BaseRefactoringContext ctx, AstNode rootNode, IVariable variable)
		{
			var assignment = false;
			var nonAssignment = false;
			foreach (var result in ctx.FindReferences(rootNode, variable)) {
				var node = result.Node;
				if (node is ParameterDeclaration)
					continue;

				if (node is VariableInitializer) {
					if (!(node as VariableInitializer).Initializer.IsNull)
						assignment = true;
					continue;
				}

				if (node is IdentifierExpression) {
					var parent = node.Parent;
					if (parent is AssignmentExpression) {
						if (((AssignmentExpression)parent).Left == node) {
							assignment = true;
							continue;
						}
					} else if (parent is UnaryOperatorExpression) {
						var op = ((UnaryOperatorExpression)parent).Operator;
						switch (op) {
							case UnaryOperatorType.Increment:
							case UnaryOperatorType.PostIncrement:
							case UnaryOperatorType.Decrement:
							case UnaryOperatorType.PostDecrement:
								assignment = true;
								if (!(parent.Parent is ExpressionStatement))
									nonAssignment = true;
								continue;
						}
					} else if (parent is DirectionExpression) {
						if (((DirectionExpression)parent).FieldDirection == FieldDirection.Out) {
							assignment = true;
							// Using dummy variables is necessary for ignoring
							// out-arguments, so we don't want to warn for those.
							nonAssignment = true;
							continue;
						}
					}
				}
				nonAssignment = true;
			}
			return assignment && !nonAssignment;
		}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:48,代码来源:VariableOnlyAssignedIssue.cs

示例15: HidesMember

        protected static bool HidesMember(BaseRefactoringContext ctx, AstNode node, string variableName)
        {
            var typeDecl = node.GetParent<TypeDeclaration>();
            if (typeDecl == null)
                return false;
            var entityDecl = node.GetParent<EntityDeclaration>();
            var memberResolveResult = ctx.Resolve(entityDecl) as MemberResolveResult;
            if (memberResolveResult == null)
                return false;
            var typeResolveResult = ctx.Resolve(typeDecl) as TypeResolveResult;
            if (typeResolveResult == null)
                return false;

            var sourceMember = memberResolveResult.Member;

            return typeResolveResult.Type.GetMembers(m => m.Name == variableName).Any(m2 => IsAccessible(sourceMember, m2));
        }
开发者ID:segaman,项目名称:NRefactory,代码行数:17,代码来源:VariableHidesMemberIssue.cs


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