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


C# Semantics.ResolveResult类代码示例

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


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

示例1: GetArgumentsForCall

		public override IList<ResolveResult> GetArgumentsForCall()
		{
			ResolveResult[] results = new ResolveResult[Member.Parameters.Count];
			List<ResolveResult> paramsArguments = IsExpandedForm ? new List<ResolveResult>() : null;
			// map arguments to parameters:
			for (int i = 0; i < Arguments.Count; i++) {
				int mappedTo;
				if (argumentToParameterMap != null)
					mappedTo = argumentToParameterMap[i];
				else
					mappedTo = IsExpandedForm ? Math.Min(i, results.Length - 1) : i;
				
				if (mappedTo >= 0 && mappedTo < results.Length) {
					if (IsExpandedForm && mappedTo == results.Length - 1)
						paramsArguments.Add(Arguments[i]);
					else
						results[mappedTo] = Arguments[i];
				}
			}
			if (IsExpandedForm)
				results[results.Length - 1] = new ArrayCreateResolveResult(Member.Parameters.Last().Type, null, paramsArguments.ToArray());
			
			for (int i = 0; i < results.Length; i++) {
				if (results[i] == null) {
					if (Member.Parameters[i].IsOptional) {
						results[i] = new ConstantResolveResult(Member.Parameters[i].Type, Member.Parameters[i].ConstantValue);
					} else {
						results[i] = ErrorResolveResult.UnknownError;
					}
				}
			}
			
			return results;
		}
开发者ID:KAW0,项目名称:Alter-Native,代码行数:34,代码来源:CppInvocationResolveResult.cs

示例2: FromResolveResult

		public static AccessPath FromResolveResult(ResolveResult resolveResult)
		{
			var memberPath = new List<IMember>();
			var currentResolveResult = resolveResult;
			do {
				if (currentResolveResult is MemberResolveResult) {
					var memberResolveResult = (MemberResolveResult)currentResolveResult;
					memberPath.Add(memberResolveResult.Member);
					currentResolveResult = memberResolveResult.TargetResult;
				} else if (currentResolveResult is LocalResolveResult) {
					// This is the root variable
					var localResolveResult = (LocalResolveResult)currentResolveResult;
					memberPath.Reverse();
					return new AccessPath(localResolveResult.Variable) {
						MemberPath = memberPath
					};
				} else if (currentResolveResult is ThisResolveResult) {
					break;
				} else {
					// Unsupported path
					return null;
				}
			} while (currentResolveResult != null);

			memberPath.Reverse();
			return new AccessPath(null) {
				MemberPath = memberPath
			};
		}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:29,代码来源:AccessPath.cs

示例3: ToolTipData

			public ToolTipData (ICSharpCode.NRefactory.PlayScript.SyntaxTree unit, ICSharpCode.NRefactory.Semantics.ResolveResult result, ICSharpCode.NRefactory.PlayScript.AstNode node, CSharpAstResolver file)
			{
				this.Unit = unit;
				this.Result = result;
				this.Node = node;
				this.Resolver = file;
			}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:7,代码来源:LanguageItemTooltipProvider.cs

示例4: FromResolveResult

		public static InitializerPath FromResolveResult(ResolveResult resolveResult)
		{
			InitializerPath initializerPath = null;
			var memberPath = new List<IMember>();
			var currentResolveResult = resolveResult;
			do {
				if (currentResolveResult is MemberResolveResult) {
					var memberResolveResult = (MemberResolveResult)currentResolveResult;
					memberPath.Add(memberResolveResult.Member);
					currentResolveResult = memberResolveResult.TargetResult;
				} else if (currentResolveResult is LocalResolveResult) {
					var localResolveResult = (LocalResolveResult)currentResolveResult;
					memberPath.Reverse();
					initializerPath = new InitializerPath(localResolveResult.Variable) {
						MemberPath = memberPath
					};
					break;
				} else if (currentResolveResult is ThisResolveResult) {
					break;
				} else {
					return null;
				}

			} while (currentResolveResult != null);

			if (initializerPath == null) {
				// This path is rooted at a member
				memberPath.Reverse();
				initializerPath = new InitializerPath(memberPath [0]) {
					MemberPath = memberPath.Skip(1).ToList()
				};
			}
			return initializerPath;
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:34,代码来源:InitializerPath.cs

示例5: TryResolveAt

        public static bool TryResolveAt(this Document doc, DocumentLocation loc, out ResolveResult result, out AstNode node)
        {
            if(doc == null)
                throw new ArgumentNullException("doc");

            result = null;
            node = null;
            var parsed_doc = doc.ParsedDocument;
            if(parsed_doc == null)
                return false;

            var unit = parsed_doc.GetAst<SyntaxTree>();
            var parsed_file = parsed_doc.ParsedFile as BVE5UnresolvedFile;

            if(unit == null || parsed_file == null)
                return false;

            try{
                result = ResolveAtLocation.Resolve(new Lazy<ICompilation>(() => doc.Compilation), parsed_file, unit, loc, out node);
                if(result == null || node is Statement)
                    return false;
            }catch(Exception e){
                Console.WriteLine("Got resolver exception:" + e);
                return false;
            }
            return true;
        }
开发者ID:hazama-yuinyan,项目名称:monodevelop-bvebinding,代码行数:27,代码来源:HelperMethods.cs

示例6: Run

		public override void Run(ResolveResult symbol)
		{
			var entity = GetSymbol(symbol);
			if ((entity is IMember) && ((entity.SymbolKind == SymbolKind.Constructor) || (entity.SymbolKind == SymbolKind.Destructor))) {
				// Don't rename constructors/destructors, rename their declaring type instead
				entity = ((IMember) entity).DeclaringType.GetDefinition();
			}
			if (entity != null) {
				var project = GetProjectFromSymbol(entity);
				if (project != null) {
					var languageBinding = project.LanguageBinding;
					
					RenameSymbolDialog renameDialog = new RenameSymbolDialog(name => CheckName(name, languageBinding))
					{
						Owner = SD.Workbench.MainWindow,
						OldSymbolName = entity.Name,
						NewSymbolName = entity.Name
					};
					if ((bool) renameDialog.ShowDialog()) {
						AsynchronousWaitDialog.ShowWaitDialogForAsyncOperation(
							"${res:SharpDevelop.Refactoring.Rename}",
							progressMonitor =>
							FindReferenceService.RenameSymbol(entity, renameDialog.NewSymbolName, progressMonitor)
							.ObserveOnUIThread()
							.Subscribe(error => SD.MessageService.ShowError(error.Message), ex => SD.MessageService.ShowException(ex), () => {}));
					}
				}
			}
		}
开发者ID:dgrunwald,项目名称:SharpDevelop,代码行数:29,代码来源:FindReferencesCommand.cs

示例7: Run

		public override void Run(ResolveResult symbol)
		{
			var entity = GetSymbol(symbol) as IEntity;
			if (entity != null) {
				ILSpyController.OpenInILSpy(entity);
			}
		}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:7,代码来源:OpenInILSpyCommand.cs

示例8: Run

        public override void Run(ResolveResult symbol)
        {
            if (symbol == null)
                return;

            var trr = symbol as TypeResolveResult;
            var def = symbol.Type.GetDefinition();
            if (trr != null && def != null && def.Parts.Count > 1) {
                ShowPopupWithPartialClasses(def);
                return;
            }

            DomRegion pos = symbol.GetDefinitionRegion();
            if (string.IsNullOrEmpty(pos.FileName)) {
                IEntity entity = GetSymbol(symbol) as IEntity;
                if (entity != null) {
                    NavigationService.NavigateTo(entity);
                }
            } else {
                try {
                    if (pos.Begin.IsEmpty)
                        FileService.OpenFile(pos.FileName);
                    else
                        FileService.JumpToFilePosition(pos.FileName, pos.BeginLine, pos.BeginColumn);
                } catch (Exception ex) {
                    MessageService.ShowException(ex, "Error jumping to '" + pos.FileName + "'.");
                }
            }
        }
开发者ID:ichengzi,项目名称:SharpDevelop,代码行数:29,代码来源:GoToDefinition.cs

示例9: InvocationResolveResult

		public InvocationResolveResult(
			ResolveResult targetResult, IParameterizedMember member, IType returnType,
			IList<ResolveResult> arguments)
			: base(targetResult, member, returnType)
		{
			this.Arguments = arguments ?? EmptyList<ResolveResult>.Instance;
		}
开发者ID:jiguixin,项目名称:ILSpy,代码行数:7,代码来源:InvocationResolveResult.cs

示例10: Run

		public override void Run(ResolveResult symbol)
		{
			var entity = GetSymbol(symbol);
			if (entity != null) {
				var project = GetProjectFromSymbol(entity);
				if (project != null) {
					var languageBinding = project.LanguageBinding;
					
					RenameSymbolDialog renameDialog = new RenameSymbolDialog(name => CheckName(name, languageBinding))
					{
						Owner = SD.Workbench.MainWindow,
						OldSymbolName = entity.Name,
						NewSymbolName = entity.Name
					};
					if ((bool) renameDialog.ShowDialog()) {
						AsynchronousWaitDialog.ShowWaitDialogForAsyncOperation(
							"${res:SharpDevelop.Refactoring.Rename}",
							progressMonitor =>
							FindReferenceService.RenameSymbol(entity, renameDialog.NewSymbolName, progressMonitor)
							.ObserveOnUIThread()
							.Subscribe(error => SD.MessageService.ShowError(error.Message), ex => SD.MessageService.ShowException(ex), () => {}));
					}
				}
			}
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:25,代码来源:FindReferencesCommand.cs

示例11: MemberResolveResult

		public MemberResolveResult(ResolveResult targetResult, IMember member, IType returnType) : base(returnType)
		{
			if (member == null)
				throw new ArgumentNullException("member");
			this.targetResult = targetResult;
			this.member = member;
		}
开发者ID:AdamLStevenson,项目名称:SharpDevelop,代码行数:7,代码来源:MemberResolveResult.cs

示例12: InvocationResolveResult

		public InvocationResolveResult(ResolveResult targetResult, IParameterizedMember member,
		                               IList<ResolveResult> arguments = null,
		                               IList<ResolveResult> initializerStatements = null)
			: base(targetResult, member)
		{
			this.Arguments = arguments ?? EmptyList<ResolveResult>.Instance;
			this.InitializerStatements = initializerStatements ?? EmptyList<ResolveResult>.Instance;
		}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:8,代码来源:InvocationResolveResult.cs

示例13: ConversionResolveResult

		public ConversionResolveResult(IType targetType, ResolveResult input, Conversion conversion)
			: base(targetType)
		{
			if (input == null)
				throw new ArgumentNullException("input");
			this.Input = input;
			this.Conversion = conversion;
		}
开发者ID:nylen,项目名称:SharpDevelop,代码行数:8,代码来源:ConversionResolveResult.cs

示例14: MemberResolveResult

		public MemberResolveResult(ResolveResult targetResult, IMember member, IType returnType, bool isConstant, object constantValue)
			: base(returnType)
		{
			this.targetResult = targetResult;
			this.member = member;
			this.isConstant = isConstant;
			this.constantValue = constantValue;
		}
开发者ID:xamarin-release-manager,项目名称:monodevelop,代码行数:8,代码来源:MemberResolveResult.cs

示例15: Run

		public override void Run(ResolveResult symbol)
		{
			IEntity entityUnderCaret = GetSymbol(symbol) as IEntity;
			if (entityUnderCaret is ITypeDefinition) {
				MakePopupWithBaseClasses((ITypeDefinition)entityUnderCaret).OpenAtCaretAndFocus();
			} else {
				MessageService.ShowError("${res:ICSharpCode.Refactoring.NoClassUnderCursorError}");
			}
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:9,代码来源:FindBaseClasses.cs


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