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


C# IMethod.ToCorFunction方法代码示例

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


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

示例1: AsyncNewObject

		public static Eval AsyncNewObject(Thread evalThread, IMethod constructor, Value[] constructorArguments)
		{
			ICorDebugType[] typeArgs = constructor.GetTypeArguments();
			ICorDebugValue[] ctorArgs = ValuesAsCorDebug(constructorArguments);
			return new Eval(
				evalThread,
				"New object: " + constructor.FullName,
				delegate(Eval eval) {
					eval.CorEval2.NewParameterizedObject(
						constructor.ToCorFunction(),
						(uint)typeArgs.Length, typeArgs,
						(uint)ctorArgs.Length, ctorArgs);
				}
			);
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:15,代码来源:Eval.cs

示例2: 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

示例3: MethodInvokeStarter

		/// <exception cref="GetValueException"><c>GetValueException</c>.</exception>
		static void MethodInvokeStarter(Eval eval, IMethod method, Value thisValue, Value[] args)
		{
			List<ICorDebugValue> corArgs = new List<ICorDebugValue>();
			args = args ?? new Value[0];
			if (args.Length != method.Parameters.Count) {
				throw new GetValueException("Invalid parameter count");
			}
			if (!method.IsStatic) {
				if (thisValue == null)
					throw new GetValueException("'this' is null");
				if (thisValue.IsNull)
					throw new GetValueException("Null reference");
				corArgs.Add(thisValue.CorValue);
			}
			for(int i = 0; i < args.Length; i++) {
				Value arg = args[i];
				IType paramType = method.Parameters[i].Type;
				if (!arg.IsNull &&
				    arg.Type.GetDefinition() != null &&
				    paramType.GetDefinition() != null &&
				    !arg.Type.GetDefinition().IsDerivedFrom(paramType.GetDefinition())) {
					throw new GetValueException("Inncorrect parameter type. Expected " + paramType.ToString());
				}
				// It is importatnt to pass the parameter in the correct form (boxed/unboxed)
				if (paramType.IsReferenceType == true) {
					if (!arg.IsReference)
						throw new DebuggerException("Reference expected as method argument");
					corArgs.Add(arg.CorValue);
				} else {
					corArgs.Add(arg.CorGenericValue); // Unbox
				}
			}
			
			ICorDebugType[] genericArgs = method.GetTypeArguments();
			
			eval.CorEval2.CallParameterizedFunction(
				method.ToCorFunction(),
				(uint)genericArgs.Length, genericArgs,
				(uint)corArgs.Count, corArgs.ToArray()
			);
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:42,代码来源:Eval.cs

示例4: 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


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