本文整理汇总了C#中IMethodSymbol.GetIntrinsic方法的典型用法代码示例。如果您正苦于以下问题:C# IMethodSymbol.GetIntrinsic方法的具体用法?C# IMethodSymbol.GetIntrinsic怎么用?C# IMethodSymbol.GetIntrinsic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMethodSymbol
的用法示例。
在下文中一共展示了IMethodSymbol.GetIntrinsic方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Resolve
public FlatOperand Resolve(SymbolInfo si, IMethodSymbol method, ExpressionSyntax expression, ArgumentListSyntax args, TypeInfo result_type, FlatOperand into_lvalue, List<FlatStatement> instructions)
{
// check for intrinsics
string intrinsic;
if (method.GetIntrinsic(out intrinsic))
{
var im = ls2csc.Intrinsics.ResolveMethod(intrinsic);
if (im == null)
{
throw new NotImplementedException("Unhandled intrinsic method " + intrinsic);
}
return im.Resolve(expression, args, result_type, si, into_lvalue, this, instructions);
}
int nArgs = args.Arguments.Count;
//int nFirstArg = 0;
if (!method.ReturnsVoid)
{
nArgs++;
//nFirstArg = 1;
}
if (method.IsStatic || method.MethodKind == MethodKind.DelegateInvoke)
{
FlatOperand fop_method;
if (method.MethodKind == MethodKind.DelegateInvoke)
{
fop_method = ResolveExpression(expression, null, instructions);
}
else
{
FlatOperand fop_type = Resolve(method.ContainingType, null, instructions);
fop_method = Resolve(method, fop_type, null, instructions);
}
// 1. RESOLVETYPE
switch (nArgs)
{
case 0:
{
instructions.Add(FlatStatement.FASTCALLSTATICMETHOD(fop_method));
return FlatOperand.LiteralNull();
}
break;
case 1:
{
if (!method.ReturnsVoid)
{
FlatOperand fop_return = AllocateRegister("");
FlatOperand lvalue_return = fop_return.GetLValue(this, instructions);
instructions.Add(FlatStatement.REREFERENCE(lvalue_return, FlatOperand.LiteralNull()));
instructions.Add(FlatStatement.FASTCALLSTATICMETHOD(fop_method, fop_return));
FlatOperand rvalue_return = lvalue_return.AsRValue(FlatValue.Null());
if (into_lvalue == null)
into_lvalue = AllocateRegister("").GetLValue(this, instructions);
instructions.Add(FlatStatement.DEREFERENCE(into_lvalue, rvalue_return));
return into_lvalue.AsRValue(rvalue_return.ImmediateValue);
}
FlatOperand input0_fop = ResolveExpression(args.Arguments[0].Expression, null, instructions);
FlatOperand input0_use = input0_fop;
FlatOperand input0_reference = null;
if (args.Arguments[0].RefOrOutKeyword.CSharpKind() != SyntaxKind.None)
{
input0_reference = AllocateRegister("");
instructions.Add(FlatStatement.REREFERENCE(input0_reference.GetLValue(this, instructions), input0_fop));
input0_use = input0_reference;
}
instructions.Add(FlatStatement.FASTCALLSTATICMETHOD(fop_method, input0_use));
if (input0_reference != null)
instructions.Add(FlatStatement.DEREFERENCE(input0_fop.GetLValue(this, instructions), input0_reference));
return FlatOperand.LiteralNull();
}
break;
case 2:
{
if (!method.ReturnsVoid)
{
FlatOperand fop_return = AllocateRegister("");
FlatOperand lvalue_return = fop_return.GetLValue(this, instructions);
instructions.Add(FlatStatement.REREFERENCE(lvalue_return, FlatOperand.LiteralNull()));
FlatOperand input0_fop = ResolveExpression(args.Arguments[0].Expression, null, instructions);
FlatOperand input0_use = input0_fop;
FlatOperand input0_reference = null;
if (args.Arguments[0].RefOrOutKeyword.CSharpKind() != SyntaxKind.None)
{
input0_reference = AllocateRegister("");
instructions.Add(FlatStatement.REREFERENCE(input0_reference.GetLValue(this, instructions), input0_fop));
input0_use = input0_reference;
}
instructions.Add(FlatStatement.FASTCALLSTATICMETHOD(fop_method, fop_return, input0_use));
FlatOperand rvalue_return = lvalue_return.AsRValue(FlatValue.Null());
//.........这里部分代码省略.........