31 lines
1.3 KiB
C#
31 lines
1.3 KiB
C#
namespace Microsoft.CodeAnalysis.CSharp.Symbols;
|
|
|
|
internal sealed class SynthesizedReadOnlyListMethod : SynthesizedImplementationMethod
|
|
{
|
|
private readonly GenerateMethodBodyDelegate _generateMethodBody;
|
|
|
|
internal override bool SynthesizesLoweredBoundBody => true;
|
|
|
|
internal SynthesizedReadOnlyListMethod(SynthesizedReadOnlyListTypeSymbol containingType, MethodSymbol interfaceMethod, GenerateMethodBodyDelegate generateMethodBody)
|
|
: base(interfaceMethod, containingType)
|
|
{
|
|
_generateMethodBody = generateMethodBody;
|
|
}
|
|
|
|
internal override void GenerateMethodBody(TypeCompilationState compilationState, BindingDiagnosticBag diagnostics)
|
|
{
|
|
SyntheticBoundNodeFactory syntheticBoundNodeFactory = new SyntheticBoundNodeFactory(this, (SyntaxNode)(object)this.GetNonNullSyntaxNode(), compilationState, diagnostics);
|
|
syntheticBoundNodeFactory.CurrentFunction = this;
|
|
try
|
|
{
|
|
BoundStatement body = _generateMethodBody(syntheticBoundNodeFactory, this, _interfaceMethod);
|
|
syntheticBoundNodeFactory.CloseMethod(body);
|
|
}
|
|
catch (SyntheticBoundNodeFactory.MissingPredefinedMember missingPredefinedMember)
|
|
{
|
|
((BindingDiagnosticBag)diagnostics).Add(missingPredefinedMember.Diagnostic);
|
|
syntheticBoundNodeFactory.CloseMethod(syntheticBoundNodeFactory.ThrowNull());
|
|
}
|
|
}
|
|
}
|