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


C# IMemberEmitter类代码示例

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


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

示例1: Emit

		public override void Emit(IMemberEmitter member, ILGenerator gen)
		{
			foreach (Statement s in statements)
			{
				s.Emit(member, gen);
			}
		}
开发者ID:jeremymeng,项目名称:Core,代码行数:7,代码来源:MultiStatementExpression.cs

示例2: Emit

 public override void Emit(IMemberEmitter member, ILGenerator gen)
 {
     ArgumentsUtil.EmitLoadOwnerAndReference(reference, gen);
     var notNull = gen.DefineLabel();
     gen.Emit(OpCodes.Brtrue_S, notNull);
     ifNull.Emit(member, gen);
     gen.MarkLabel(notNull);
     ifNotNull.Emit(member, gen);
 }
开发者ID:JohnsonYuan,项目名称:n2cms,代码行数:9,代码来源:IfNullExpression.cs

示例3: Emit

		public override void Emit(IMemberEmitter member, ILGenerator gen)
		{
			right.Emit(member, gen);

			if (fromType == target)
			{
				return;
			}

			if (fromType.IsByRef)
			{
				fromType = fromType.GetElementType();
			}

			if (target.IsByRef)
			{
				target = target.GetElementType();
			}

			if (target.IsArray())
			{
				if (fromType.IsValueType())
				{
					throw new NotImplementedException("Cannot convert between distinct value types");
				}
				else
				{
					// Unbox conversion
					// Assumes fromType is a boxed value
					// if we can, we emit a box and ldind, otherwise, we will use unbox.any
					if (LdindOpCodesDictionary.Instance[target] != LdindOpCodesDictionary.EmptyOpCode)
					{
						gen.Emit(OpCodes.Unbox, target);
						OpCodeUtil.EmitLoadIndirectOpCodeForType(gen, target);
					}
					else
					{
						gen.Emit(OpCodes.Unbox_Any, target);
					}
				}
			}
			else
			{
				if (fromType.IsValueType())
				{
					// Box conversion
					gen.Emit(OpCodes.Box, fromType);
					EmitCastIfNeeded(typeof(object), target, gen);
				}
				else
				{
					// Possible down-cast
					EmitCastIfNeeded(fromType, target, gen);
				}
			}
		}
开发者ID:rajgit31,项目名称:MetroUnitTestsDemoApp,代码行数:56,代码来源:ConvertExpression.cs

示例4: Emit

 public override void Emit(IMemberEmitter member, ILGenerator gen)
 {
     expression.Emit(member, gen);
     gen.Emit(OpCodes.Dup);
     var label = gen.DefineLabel();
     gen.Emit(OpCodes.Brtrue_S, label);
     gen.Emit(OpCodes.Pop);
     @default.Emit(member, gen);
     gen.MarkLabel(label);
 }
开发者ID:brianmatic,项目名称:n2cms,代码行数:10,代码来源:NullCoalescingOperatorExpression.cs

示例5: Emit

		public override void Emit(IMemberEmitter member, ILGenerator il)
		{
			ArgumentsUtil.EmitLoadOwnerAndReference(targetArray, il);

			il.Emit(OpCodes.Ldc_I4, targetPosition);

			value.Emit(member, il);

			il.Emit(OpCodes.Stelem_Ref);
		}
开发者ID:ralescano,项目名称:castle,代码行数:10,代码来源:AssignArrayStatement.cs

示例6: Emit

		public override void Emit(IMemberEmitter member, ILGenerator gen)
		{
			var ci = exceptionType.GetConstructor(new[] { typeof(String) });
			var constRef = new ConstReference(errorMessage);

			var creationStmt = new NewInstanceExpression(ci, constRef.ToExpression());

			creationStmt.Emit(member, gen);

			gen.Emit(OpCodes.Throw);
		}
开发者ID:rajgit31,项目名称:MetroUnitTestsDemoApp,代码行数:11,代码来源:ThrowStatement.cs

示例7: Emit

		public override void Emit(IMemberEmitter member, ILGenerator gen)
		{
			gen.Emit(OpCodes.Ldarg_0);

			foreach (var exp in args)
			{
				exp.Emit(member, gen);
			}

			gen.Emit(OpCodes.Call, cmethod);
		}
开发者ID:ArthurYiL,项目名称:JustMockLite,代码行数:11,代码来源:ConstructorInvocationStatement.cs

示例8: Generate

		internal void Generate(IMemberEmitter member, ILGenerator il)
		{
			foreach (Reference local in ilmarkers)
			{
				local.Generate(il);
			}

			foreach (Statement stmt in stmts)
			{
				stmt.Emit(member, il);
			}
		}
开发者ID:ralescano,项目名称:castle,代码行数:12,代码来源:AbstractCodeBuilder.cs

示例9: Generate

		internal void Generate(IMemberEmitter member, ILGenerator il)
		{
			foreach (var local in ilmarkers)
			{
				local.Generate(il);
			}

			foreach (var stmt in stmts)
			{
				stmt.Emit(member, il);
			}
		}
开发者ID:BiBongNet,项目名称:JustMockLite,代码行数:12,代码来源:AbstractCodeBuilder.cs

示例10: Emit

		public override void Emit(IMemberEmitter member, ILGenerator gen)
		{
			gen.Emit(OpCodes.Ldtoken, method);
			if (declaringType == null)
			{
				throw new GeneratorException("declaringType can't be null for this situation");
			}
			gen.Emit(OpCodes.Ldtoken, declaringType);

			var minfo = MethodBaseMethods.GetMethodFromHandle2;
			gen.Emit(OpCodes.Call, minfo);
			gen.Emit(OpCodes.Castclass, typeof(MethodInfo));
		}
开发者ID:elevine,项目名称:Core,代码行数:13,代码来源:MethodTokenExpression.cs

示例11: Emit

 public override void Emit(IMemberEmitter member, ILGenerator gen)
 {
     owner.Emit(member, gen);
     gen.Emit(OpCodes.Dup);
     if (methodToBindTo.IsFinal)
     {
         gen.Emit(OpCodes.Ldftn, methodToBindTo);
     }
     else
     {
         gen.Emit(OpCodes.Ldvirtftn, methodToBindTo);
     }
     gen.Emit(OpCodes.Newobj, delegateCtor);
 }
开发者ID:JohnsonYuan,项目名称:n2cms,代码行数:14,代码来源:BindDelegateExpression.cs

示例12: Emit

		public override void Emit(IMemberEmitter member, ILGenerator gen)
		{
			right.Emit(member, gen);

			if (fromType == target)
			{
				return;
			}

			if (fromType.IsByRef)
			{
				fromType = fromType.GetElementType();
			}

			if (target.IsByRef)
			{
				target = target.GetElementType();
			}

			if (target.IsValueType)
			{
				if (fromType.IsValueType)
				{
					throw new NotImplementedException("Cannot convert between distinct value types");
				}
				else
				{
					// Unbox conversion
					// Assumes fromType is a boxed value
					gen.Emit(OpCodes.Unbox, target);
					OpCodeUtil.EmitLoadIndirectOpCodeForType(gen, target);
				}
			}
			else
			{
				if (fromType.IsValueType)
				{
					// Box conversion
					gen.Emit(OpCodes.Box, fromType);
					EmitCastIfNeeded(typeof(object), target, gen);
				}
				else
				{
					// Possible down-cast
					EmitCastIfNeeded(fromType, target, gen);
				}
			}
		}
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:48,代码来源:ConvertExpression.cs

示例13: Emit

		public override void Emit(IMemberEmitter member, ILGenerator gen)
		{
			ArgumentsUtil.EmitLoadOwnerAndReference(owner, gen);

			foreach (var exp in args)
			{
				exp.Emit(member, gen);
			}

			if (VirtualCall)
			{
				gen.Emit(OpCodes.Callvirt, method);
			}
			else
			{
				gen.Emit(OpCodes.Call, method);
			}
		}
开发者ID:leloulight,项目名称:Core,代码行数:18,代码来源:MethodInvocationExpression.cs

示例14: Emit

		public override void Emit(IMemberEmitter member, ILGenerator gen)
		{
			foreach (Expression exp in arguments)
			{
				exp.Emit(member, gen);
			}

			if (constructor == null)
			{
				constructor = type.GetConstructor(constructor_args);
			}

			if (constructor == null)
			{
				throw new ProxyGenerationException("Could not find constructor matching specified arguments");
			}

			gen.Emit(OpCodes.Newobj, constructor);
		}
开发者ID:ralescano,项目名称:castle,代码行数:19,代码来源:NewInstanceExpression.cs

示例15: Emit

		public override void Emit(IMemberEmitter member, ILGenerator gen)
		{
			gen.Emit(OpCodes.Ldtoken, method);
#if !MONO
			if (declaringType == null)
			{
				throw new GeneratorException("declaringType can't be null for this situation");
			}
			gen.Emit(OpCodes.Ldtoken, declaringType);
#endif

			MethodInfo minfo = Constants.GetMethodFromHandle1;

#if !MONO
			minfo = Constants.GetMethodFromHandle2;
#endif

			gen.Emit(OpCodes.Call, minfo);
			gen.Emit(OpCodes.Castclass, typeof(MethodInfo));
		}
开发者ID:pallmall,项目名称:WCell,代码行数:20,代码来源:MethodTokenExpression.cs


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