本文整理汇总了C#中Microsoft.CodeAnalysis.CodeGen.ILBuilder.EmitCall方法的典型用法代码示例。如果您正苦于以下问题:C# ILBuilder.EmitCall方法的具体用法?C# ILBuilder.EmitCall怎么用?C# ILBuilder.EmitCall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.CodeAnalysis.CodeGen.ILBuilder
的用法示例。
在下文中一共展示了ILBuilder.EmitCall方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmitConvertToPhpValue
public static TypeSymbol EmitConvertToPhpValue(TypeSymbol from, TypeRefMask fromHint, ILBuilder il, Emit.PEModuleBuilder module, DiagnosticBag diagnostic)
{
Contract.ThrowIfNull(from);
var compilation = module.Compilation;
switch (from.SpecialType)
{
case SpecialType.System_Boolean:
il.EmitCall(module, diagnostic, ILOpCode.Call, compilation.CoreMethods.PhpValue.Create_Boolean);
break;
case SpecialType.System_Int32:
il.EmitOpCode(ILOpCode.Conv_i8); // Int32 -> Int64
goto case SpecialType.System_Int64; // PhpValue.Create((long)<stack>)
case SpecialType.System_Int64:
il.EmitCall(module, diagnostic, ILOpCode.Call, compilation.CoreMethods.PhpValue.Create_Long);
break;
case SpecialType.System_Double:
il.EmitCall(module, diagnostic, ILOpCode.Call, compilation.CoreMethods.PhpValue.Create_Double);
break;
case SpecialType.System_Void:
Emit_PhpValue_Void(il, module, diagnostic);
break;
default:
if (from == compilation.CoreTypes.PhpAlias)
{
il.EmitCall(module, diagnostic, ILOpCode.Call, compilation.CoreMethods.PhpValue.Create_PhpAlias)
.Expect(compilation.CoreTypes.PhpValue);
break;
}
else if (from == compilation.CoreTypes.PhpValue)
{
// nop
break;
}
else if (from == compilation.CoreTypes.String)
{
il.EmitCall(module, diagnostic, ILOpCode.Call, compilation.CoreMethods.PhpValue.Create_String)
.Expect(compilation.CoreTypes.PhpValue);
break;
}
else if (from == compilation.CoreTypes.PhpString)
{
il.EmitCall(module, diagnostic, ILOpCode.Call, compilation.CoreMethods.PhpValue.Create_PhpString)
.Expect(compilation.CoreTypes.PhpValue);
break;
}
else if (from == compilation.CoreTypes.PhpNumber)
{
il.EmitCall(module, diagnostic, ILOpCode.Call, compilation.CoreMethods.PhpValue.Create_PhpNumber)
.Expect(compilation.CoreTypes.PhpValue);
break;
}
else if (from.IsOfType(compilation.CoreTypes.PhpArray))
{
il.EmitCall(module, diagnostic, ILOpCode.Call, compilation.CoreMethods.PhpValue.Create_PhpArray)
.Expect(compilation.CoreTypes.PhpValue);
break;
}
else if (from == compilation.CoreTypes.IntStringKey)
{
il.EmitCall(module, diagnostic, ILOpCode.Call, compilation.CoreMethods.PhpValue.Create_IntStringKey)
.Expect(compilation.CoreTypes.PhpValue);
break;
}
else if (from.IsReferenceType)
{
il.EmitCall(module, diagnostic, ILOpCode.Call, compilation.CoreMethods.PhpValue.FromClass_Object)
.Expect(compilation.CoreTypes.PhpValue);
break;
}
else
{
throw new NotImplementedException($"{from.Name}");
}
}
//
return compilation.CoreTypes.PhpValue;
}