本文整理汇总了C#中Microsoft.CodeAnalysis.CSharp.BoundLambda.InferredReturnType方法的典型用法代码示例。如果您正苦于以下问题:C# BoundLambda.InferredReturnType方法的具体用法?C# BoundLambda.InferredReturnType怎么用?C# BoundLambda.InferredReturnType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.CodeAnalysis.CSharp.BoundLambda
的用法示例。
在下文中一共展示了BoundLambda.InferredReturnType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReallyInferReturnType
private BoundLambda ReallyInferReturnType(NamedTypeSymbol delegateType)
{
var diagnostics = DiagnosticBag.GetInstance();
var parameters = DelegateParameters(delegateType);
var lambdaSymbol = new LambdaSymbol(binder.Compilation, binder.ContainingMemberOrLambda, _unboundLambda, parameters, returnType: null);
Binder lambdaBodyBinder = new ExecutableCodeBinder(_unboundLambda.Syntax, lambdaSymbol, ParameterBinder(lambdaSymbol, binder));
var block = BindLambdaBody(lambdaSymbol, ref lambdaBodyBinder, diagnostics);
var result = new BoundLambda(_unboundLambda.Syntax, block, diagnostics.ToReadOnlyAndFree(), lambdaBodyBinder, delegateType, inferReturnType: true)
{ WasCompilerGenerated = _unboundLambda.WasCompilerGenerated };
HashSet<DiagnosticInfo> useSiteDiagnostics = null; // TODO: figure out if this should be somehow merged into BoundLambda.Diagnostics.
lambdaSymbol.SetInferredReturnType(result.InferredReturnType(ref useSiteDiagnostics) ??
new ExtendedErrorTypeSymbol(binder.Compilation, string.Empty, 0, null));
return result;
}