本文整理汇总了C#中Microsoft.CodeAnalysis.CSharp.SyntheticBoundNodeFactory.Parameter方法的典型用法代码示例。如果您正苦于以下问题:C# SyntheticBoundNodeFactory.Parameter方法的具体用法?C# SyntheticBoundNodeFactory.Parameter怎么用?C# SyntheticBoundNodeFactory.Parameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.CodeAnalysis.CSharp.SyntheticBoundNodeFactory
的用法示例。
在下文中一共展示了SyntheticBoundNodeFactory.Parameter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindMethodBody
// NOTE: can return null if the method has no body.
internal static BoundBlock BindMethodBody(MethodSymbol method, TypeCompilationState compilationState, DiagnosticBag diagnostics, bool generateDebugInfo, out ConsList<Imports> debugImports)
{
debugImports = null;
BoundStatement constructorInitializer = null;
BoundBlock body;
var compilation = method.DeclaringCompilation;
var sourceMethod = method as SourceMethodSymbol;
if ((object)sourceMethod != null)
{
if (sourceMethod.IsExtern)
{
if (sourceMethod.BlockSyntax == null)
{
// Generate warnings only if we are not generating ERR_ExternHasBody error
GenerateExternalMethodWarnings(sourceMethod, diagnostics);
}
return null;
}
else if (sourceMethod.IsParameterlessValueTypeConstructor(requireSynthesized: true))
{
// No body for default struct constructor.
return null;
}
var blockSyntax = sourceMethod.BlockSyntax;
if (blockSyntax != null)
{
var factory = compilation.GetBinderFactory(sourceMethod.SyntaxTree);
var inMethodBinder = factory.GetBinder(blockSyntax);
var binder = new ExecutableCodeBinder(blockSyntax, sourceMethod, inMethodBinder);
body = binder.BindBlock(blockSyntax, diagnostics);
if (generateDebugInfo)
{
debugImports = binder.ImportsList;
}
if (inMethodBinder.IsDirectlyInIterator)
{
foreach (var parameter in method.Parameters)
{
if (parameter.RefKind != RefKind.None)
{
diagnostics.Add(ErrorCode.ERR_BadIteratorArgType, parameter.Locations[0]);
}
else if (parameter.Type.IsUnsafe())
{
diagnostics.Add(ErrorCode.ERR_UnsafeIteratorArgType, parameter.Locations[0]);
}
}
if (sourceMethod.IsUnsafe && compilation.Options.AllowUnsafe) // Don't cascade
{
diagnostics.Add(ErrorCode.ERR_IllegalInnerUnsafe, sourceMethod.Locations[0]);
}
if (sourceMethod.IsVararg)
{
// error CS1636: __arglist is not allowed in the parameter list of iterators
diagnostics.Add(ErrorCode.ERR_VarargsIterator, sourceMethod.Locations[0]);
}
}
}
else // for [if (blockSyntax != null)]
{
var property = sourceMethod.AssociatedSymbol as SourcePropertySymbol;
if ((object)property != null && property.IsAutoProperty)
{
return MethodBodySynthesizer.ConstructAutoPropertyAccessorBody(sourceMethod);
}
if (sourceMethod.IsPrimaryCtor)
{
body = null;
}
else
{
return null;
}
}
}
else
{
// synthesized methods should return their bound bodies
body = null;
}
// delegates have constructors but not constructor initializers
if (method.MethodKind == MethodKind.Constructor && !method.ContainingType.IsDelegateType())
{
var initializerInvocation = BindConstructorInitializer(method, diagnostics, compilation);
if (initializerInvocation != null)
{
constructorInitializer = new BoundExpressionStatement(initializerInvocation.Syntax, initializerInvocation) { WasCompilerGenerated = true };
Debug.Assert(initializerInvocation.HasAnyErrors || constructorInitializer.IsConstructorInitializer(), "Please keep this bound node in sync with BoundNodeExtensions.IsConstructorInitializer.");
}
}
//.........这里部分代码省略.........