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


C# Emit.Label类代码示例

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


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

示例1: EnsureLabel

 internal Label EnsureLabel(CodeGen cg) {
     if (!_initialized) {
         _label = cg.DefineLabel();
         _initialized = true;
     }
     return _label;
 }
开发者ID:JamesTryand,项目名称:IronScheme,代码行数:7,代码来源:YieldTarget.cs

示例2: RecordLabels

 public override void RecordLabels(ILGenerator gen)
 {
     base.RecordLabels(gen);
     returnLabel = gen.DefineLabel();
     returnLabels.Add(returnLabel);
     gosubIndex = returnLabels.Count - 1;
 }
开发者ID:michaelgwelch,项目名称:mbasic99,代码行数:7,代码来源:Gosub.cs

示例3: AppendGuard

		public override void AppendGuard(ILGenerator generator, 
			MethodInfo method, Label done)
		{
			generator.Emit(OpCodes.Ldloc_0);
			generator.Emit(OpCodes.Call, method);
			generator.Emit(OpCodes.Brfalse, done);
		}
开发者ID:radischevo,项目名称:Radischevo.Wahha,代码行数:7,代码来源:MessageFieldString.cs

示例4: ForState

 internal ForState(LocalBuilder indexVar, Label beginLabel, Label testLabel, object end)
 {
     this.indexVar = indexVar;
     this.beginLabel = beginLabel;
     this.testLabel = testLabel;
     this.end = end;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:ForState.cs

示例5: ILForLoop

 public ILForLoop(Label conditionLabel, Label startLoopLogicLabel, LocalBuilder counter, LocalBuilder max)
 {
     ConditionLabel = conditionLabel;
     Counter = counter;
     Max = max;
     StartLoopLogicLabel = startLoopLogicLabel;
 }
开发者ID:dreasgrech,项目名称:yabfcompiler,代码行数:7,代码来源:ILForLoop.cs

示例6: WhileInfo

 public WhileInfo(string condition, Label beginLabel, Label comparasionLabel) :
     this()
 {
     Condition = condition;
     BeginLabel = beginLabel;
     ComparasionLabel = comparasionLabel;
 }
开发者ID:ElemarJR,项目名称:FluentIL,代码行数:7,代码来源:WhileInfo.cs

示例7: OnDefineLabel

 protected override Label OnDefineLabel()
 {
     var result = new Label();
     foreach (var ilEmitter in emittersField)
         result = ilEmitter.DefineLabel();
     return result;
 }
开发者ID:vendettamit,项目名称:FluentIL,代码行数:7,代码来源:EmittersAggregator.cs

示例8: GenerateForBranch

		public override void GenerateForBranch (ILGenerator gen, Label label, bool branchCase)
		{
			Label endLabel = gen.DefineLabel ();
			exp1.Generate (gen);
			
			if (exp1 is CodeConditionExpression) {
				if (branchCase)
					((CodeConditionExpression)exp1).GenerateForBranch (gen, endLabel, false);
				else
					((CodeConditionExpression)exp1).GenerateForBranch (gen, label, false);
			}
			else {
				exp1.Generate (gen);
				if (branchCase)
					gen.Emit (OpCodes.Brfalse, endLabel);
				else
					gen.Emit (OpCodes.Brfalse, label);
			}

			if (exp2 is CodeConditionExpression) {
				if (branchCase)
					((CodeConditionExpression)exp2).GenerateForBranch (gen, label, true);
				else
					((CodeConditionExpression)exp2).GenerateForBranch (gen, label, false);
			}
			else {
				exp2.Generate (gen);
				if (branchCase)
					gen.Emit (OpCodes.Brtrue, label);
				else
					gen.Emit (OpCodes.Brfalse, label);
			}
			
			gen.MarkLabel(endLabel);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:35,代码来源:CodeAnd.cs

示例9: GenerateWriterMethod

		public void GenerateWriterMethod(Type obtype, CodeGenContext ctx, ILGenerator il)
		{
			var getTypeIDMethodInfo = typeof(Serializer).GetMethod("GetTypeID", BindingFlags.NonPublic | BindingFlags.Instance, null,
				new Type[] { typeof(object) }, null);

			var map = ctx.TypeMap;

			// arg0: Serializer, arg1: Stream, arg2: object

			var idLocal = il.DeclareLocal(typeof(ushort));

			// get TypeID from object's Type
			il.Emit(OpCodes.Ldarg_0);
			il.Emit(OpCodes.Ldarg_2);
			il.Emit(OpCodes.Call, getTypeIDMethodInfo);
			il.Emit(OpCodes.Stloc_S, idLocal);

			// write typeID
			il.Emit(OpCodes.Ldarg_1);
			il.Emit(OpCodes.Ldloc_S, idLocal);
			il.Emit(OpCodes.Call, ctx.GetWriterMethodInfo(typeof(ushort)));

			// +1 for 0 (null)
			var jumpTable = new Label[map.Count + 1];
			jumpTable[0] = il.DefineLabel();
			foreach (var kvp in map)
				jumpTable[kvp.Value.TypeID] = il.DefineLabel();

			il.Emit(OpCodes.Ldloc_S, idLocal);
			il.Emit(OpCodes.Switch, jumpTable);

			il.Emit(OpCodes.Newobj, Helpers.ExceptionCtorInfo);
			il.Emit(OpCodes.Throw);

			/* null case */
			il.MarkLabel(jumpTable[0]);
			il.Emit(OpCodes.Ret);

			/* cases for types */
			foreach (var kvp in map)
			{
				var type = kvp.Key;
				var data = kvp.Value;

				il.MarkLabel(jumpTable[data.TypeID]);

				if (data.NeedsInstanceParameter)
					il.Emit(OpCodes.Ldarg_0);

				il.Emit(OpCodes.Ldarg_1);
				il.Emit(OpCodes.Ldarg_2);
				il.Emit(type.IsValueType ? OpCodes.Unbox_Any : OpCodes.Castclass, type);

				il.Emit(OpCodes.Tailcall);
				il.Emit(OpCodes.Call, data.WriterMethodInfo);

				il.Emit(OpCodes.Ret);
			}
		}
开发者ID:yashodhank,项目名称:QuasarRAT,代码行数:59,代码来源:ObjectSerializer.cs

示例10: Expand

        public override IEnumerable<NodeBase> Expand(Context ctx, NodeBase expression, Label nextStatement)
        {
            foreach (var rule in KeyRule.Expand(ctx, Expr.GetMember(expression, "Key"), nextStatement))
                yield return rule;

            foreach (var rule in ValueRule.Expand(ctx, Expr.GetMember(expression, "Value"), nextStatement))
                yield return rule;
        }
开发者ID:menozz,项目名称:lens,代码行数:8,代码来源:MatchKeyValueRule.cs

示例11: ExceptionalReturn

            public ExceptionalReturn(Label label, LocalBuilder local)
            {
                if (local == null)
                    throw new ArgumentNullException("local");

                Label = label;
                Local = local;
            }
开发者ID:pvginkel,项目名称:Jint2,代码行数:8,代码来源:CodeGenerator.Scope.cs

示例12: TestLabelEqualityOperators

        public void TestLabelEqualityOperators()
        {
            Label lb1 = new Label();
            Label lb2 = new Label();

            Assert.True(lb1 == lb2);
            Assert.False(lb1 != lb2);
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:8,代码来源:LabelEquals1.cs

示例13: GenerateForBranch

 public virtual void GenerateForBranch(ILGenerator gen, Label label, bool jumpCase)
 {
     Generate (gen);
     if (jumpCase)
         gen.Emit (OpCodes.Brtrue, label);
     else
         gen.Emit (OpCodes.Brfalse, label);
 }
开发者ID:yudhitech,项目名称:xamarin-android,代码行数:8,代码来源:CodeExpression.cs

示例14: EmitBranchFalse

 public override void EmitBranchFalse(CodeGen cg, Label label) {
     if (_valueIndex == _expressions.Count - 1) {
         Emit(cg, _valueIndex);
         _expressions[_valueIndex].EmitBranchFalse(cg, label);
     } else {
         base.EmitBranchFalse(cg, label);
     }
 }
开发者ID:JamesTryand,项目名称:IronScheme,代码行数:8,代码来源:CommaExpression.cs

示例15: Expand

 public override IEnumerable<NodeBase> Expand(Context ctx, NodeBase expression, Label nextStatement)
 {
     yield return Expr.If(
         Expr.NotEqual(Literal as NodeBase, expression),
         Expr.Block(
             Expr.JumpTo(nextStatement)
         )
     );
 }
开发者ID:menozz,项目名称:lens,代码行数:9,代码来源:MatchLiteralRule.cs


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