本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}