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


C# CodeGenerator.EmitReturnValueHandling方法代码示例

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


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

示例1: Emit

		/// <include file='Doc/Nodes.xml' path='doc/method[@name="Emit"]/*'/>
		internal override PhpTypeCode Emit(CodeGenerator/*!*/ codeGenerator)
		{
			PhpTypeCode result;

			// emits inclusion and Main() call:
			result = EmitDynamicInclusion(codeGenerator);

			// return value conversion:
			codeGenerator.EmitReturnValueHandling(this, false, ref result);
			return result;
		}
开发者ID:dw4dev,项目名称:Phalanger,代码行数:12,代码来源:BuiltInFunctions.CoreCLR.cs

示例2: Emit

		/// <include file='Doc/Nodes.xml' path='doc/method[@name="Emit"]/*'/>
		internal override PhpTypeCode Emit(CodeGenerator codeGenerator)
		{
			Debug.Assert(access == AccessType.Read || access == AccessType.ReadRef ||
				access == AccessType.ReadUnknown || access == AccessType.None);
			Statistics.AST.AddNode("FunctionCall.Indirect");

			PhpTypeCode result;
			result = codeGenerator.EmitRoutineOperatorCall(null, isMemberOf, null, null, nameExpr, callSignature, access);
            //EmitReturnValueCopy(codeGenerator.IL, result); // (J) already emitted by EmitRoutineOperatorCall
            
            codeGenerator.EmitReturnValueHandling(this, codeGenerator.ChainBuilder.LoadAddressOfFunctionReturnValue, ref result);

            return result;
		}
开发者ID:MpApQ,项目名称:Phalanger,代码行数:15,代码来源:FunctionCall.cs

示例3: Emit

		internal override PhpTypeCode Emit(CodeGenerator/*!*/ codeGenerator)
		{
			Statistics.AST.AddNode("NewEx");

			PhpTypeCode result;

			if (classNameRef.ResolvedType != null && typeArgsResolved)
			{
				// constructor is resolvable (doesn't mean that known) //

				result = classNameRef.ResolvedType.EmitNew(codeGenerator, null, constructor, callSignature, runtimeVisibilityCheck);
			}
			else
			{
				// constructor is unresolvable (a variable is used in type name => type is unresolvable as well) //

				codeGenerator.EmitNewOperator(null, classNameRef, null, callSignature);
				result = PhpTypeCode.Object;
			}

			codeGenerator.EmitReturnValueHandling(this, false, ref result);
			return result;
		}
开发者ID:proff,项目名称:Phalanger,代码行数:23,代码来源:NewAndInstanceof.cs

示例4: Emit

		/// <include file='Doc/Nodes.xml' path='doc/method[@name="Emit"]/*'/>
		internal override PhpTypeCode Emit(CodeGenerator/*!*/ codeGenerator)
		{
			// not emitted in release mode:
			Debug.Assert(kind != EvalKinds.LambdaFunction, "Invalid eval kind.");
			Debug.Assert(kind != EvalKinds.Assert || codeGenerator.Context.Config.Compiler.Debug, "Assert should be cut off in release mode.");
			Debug.Assert(access == AccessType.None || access == AccessType.Read || access == AccessType.ReadRef);
			Debug.Assert(inlinedCode != null || codeGenerator.RTVariablesTablePlace != null, "Function should have variables table.");
			Statistics.AST.AddNode("EvalEx");

			ILEmitter il = codeGenerator.IL;
            PhpTypeCode result;

			if (inlinedCode != null)
			{
				Debug.Assert(kind == EvalKinds.Assert, "Only assert can be inlined so far.");
				Label endif_label = il.DefineLabel();
				Label else_label = il.DefineLabel();

				// IF DynamicCode.PreAssert(context) THEN
				codeGenerator.EmitLoadScriptContext();
				il.Emit(OpCodes.Call, Methods.DynamicCode.PreAssert);
				il.Emit(OpCodes.Brfalse, else_label);
				if (true)
				{
					// LOAD <evaluated assertion>;
					codeGenerator.EmitBoxing(((Expression)code).Emit(codeGenerator));

					// CALL DynamicCode.PostAssert(context);
					codeGenerator.EmitLoadScriptContext();
					il.Emit(OpCodes.Call, Methods.DynamicCode.PostAssert);

					// LOAD bool CheckAssertion(STACK, <inlined code>, context, <source path>, line, column);
					il.Emit(OpCodes.Ldstr, inlinedCode);
					codeGenerator.EmitLoadScriptContext();
					il.Emit(OpCodes.Ldstr, codeGenerator.SourceUnit.SourceFile.RelativePath.ToString());
					il.LdcI4(this.position.FirstLine);
					il.LdcI4(this.position.FirstColumn);
					codeGenerator.EmitLoadNamingContext();
					il.Emit(OpCodes.Call, Methods.DynamicCode.CheckAssertion);

					// GOTO END IF;
					il.Emit(OpCodes.Br, endif_label);
				}
				// ELSE
				il.MarkLabel(else_label);
				if (true)
				{
					// LOAD true;
					il.Emit(OpCodes.Ldc_I4_1);
				}
				// END IF;
				il.MarkLabel(endif_label);

                result = PhpTypeCode.Object;
			}
			else
			{
                result = codeGenerator.EmitEval(kind, code, position, currentNamespace, aliases);
			}

			// handles return value according to the access type:
			codeGenerator.EmitReturnValueHandling(this, false, ref result);
			return result;
		}
开发者ID:Ashod,项目名称:Phalanger,代码行数:65,代码来源:BuiltInFunctions.cs


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