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


C# IMethod.GetSymMethod方法代码示例

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


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

示例1: GetLocalVariables

		public IEnumerable<ILLocalVariable> GetLocalVariables(IMethod method)
		{
			List<ILLocalVariable> vars = new List<ILLocalVariable>();
			var symMethod = method.GetSymMethod();
			if (symMethod == null)
				return vars;
			
			Stack<ISymUnmanagedScope> scopes = new Stack<ISymUnmanagedScope>();
			scopes.Push(symMethod.GetRootScope());
			while(scopes.Count > 0) {
				ISymUnmanagedScope scope = scopes.Pop();
				foreach (ISymUnmanagedVariable symVar in scope.GetLocals()) {
					int index = (int)symVar.GetAddressField1();
					vars.Add(new ILLocalVariable() {
					         	Index = index,
					         	Type = method.GetLocalVariableType(index),
					         	Name = symVar.GetName(),
					         	IsCompilerGenerated = (symVar.GetAttributes() & 1) == 1,
					         	// symVar also has Get*Offset methods, but the are not implemented
					         	ILRanges = new [] { new ILRange() { From = (int)scope.GetStartOffset(), To = (int)scope.GetEndOffset() } }
					         });
				}
				foreach(ISymUnmanagedScope childScope in scope.GetChildren()) {
					scopes.Push(childScope);
				}
			}
			return vars;
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:28,代码来源:PdbSymbolSource.cs

示例2: GetSequencePoint

		public SequencePoint GetSequencePoint(IMethod method, int iloffset)
		{
			var symMethod = method.GetSymMethod();
			if (symMethod == null)
				return null;
			
			// 0xFEEFEE means "code generated by compiler"
			int codeSize = (int)method.ToCorFunction().GetILCode().GetSize();
			var sequencePoints = symMethod.GetSequencePoints(codeSize);
			var realSeqPoints = sequencePoints.Where(p => p.StartLine != 0xFEEFEE);
			
			// Find point for which (ilstart <= iloffset < ilend) or fallback to the next valid sequence point
			var sequencePoint = realSeqPoints.FirstOrDefault(p => p.ILRanges.Any(r => r.From <= iloffset && iloffset < r.To)) ??
				realSeqPoints.FirstOrDefault(p => iloffset <= p.ILOffset);
			
			if (sequencePoint != null) {
				// VB.NET sometimes produces temporary files which it then deletes
				// (eg 17d14f5c-a337-4978-8281-53493378c1071.vb)
				string name = Path.GetFileName(sequencePoint.Filename);
				if (name.Length == 40 && name.EndsWith(".vb")) {
					if (name.Substring(0, name.Length - 3).All(c => ('0' <= c && c <= '9') || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F') || (c == '-'))) {
						return null;
					}
				}
				

				sequencePoint.Filename = GetSourceCodePath(method.ParentAssembly.GetModule().Process, sequencePoint.Filename);
			}
			
			return sequencePoint;
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:31,代码来源:PdbSymbolSource.cs

示例3: GetIgnoredILRanges

		public IEnumerable<ILRange> GetIgnoredILRanges(IMethod method)
		{
			var symMethod = method.GetSymMethod();
			if (symMethod == null)
				return null;
			
			int codeSize = (int)method.ToCorFunction().GetILCode().GetSize();
			return symMethod.GetSequencePoints(codeSize).Where(p => p.StartLine == 0xFEEFEE).SelectMany(p => p.ILRanges).ToList();
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:9,代码来源:PdbSymbolSource.cs

示例4: IsCompilerGenerated

		public bool IsCompilerGenerated(IMethod method)
		{
			return method.GetSymMethod() == null;
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:4,代码来源:PdbSymbolSource.cs


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