Files
2026-08-27 10:56:38 -06:00

961 lines
47 KiB
C#

using System.Collections.Immutable;
using System.Globalization;
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.RuntimeMembers;
using Microsoft.CodeAnalysis.Symbols;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.Symbols;
internal abstract class SourceOrdinaryMethodSymbol : SourceOrdinaryMethodSymbolBase
{
private sealed class SourceOrdinaryMethodSymbolSimple : SourceOrdinaryMethodSymbol
{
internal sealed override SourceOrdinaryMethodSymbol OtherPartOfPartial => null;
protected sealed override TypeSymbol ExplicitInterfaceType => null;
public sealed override ImmutableArray<TypeParameterSymbol> TypeParameters => ImmutableArray<TypeParameterSymbol>.Empty;
public SourceOrdinaryMethodSymbolSimple(NamedTypeSymbol containingType, string name, Location location, MethodDeclarationSyntax syntax, MethodKind methodKind, bool isNullableAnalysisEnabled, BindingDiagnosticBag diagnostics)
: base(containingType, name, location, syntax, methodKind, isNullableAnalysisEnabled, diagnostics)
{
}//IL_0006: Unknown result type (might be due to invalid IL or missing references)
protected sealed override MethodSymbol FindExplicitlyImplementedMethod(BindingDiagnosticBag diagnostics)
{
return null;
}
public sealed override ImmutableArray<ImmutableArray<TypeWithAnnotations>> GetTypeParameterConstraintTypes()
{
return ImmutableArray<ImmutableArray<TypeWithAnnotations>>.Empty;
}
public sealed override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds()
{
return ImmutableArray<TypeParameterConstraintKind>.Empty;
}
protected sealed override void CheckConstraintsForExplicitInterfaceType(ConversionsBase conversions, BindingDiagnosticBag diagnostics)
{
}
}
private sealed class SourceOrdinaryMethodSymbolComplex : SourceOrdinaryMethodSymbol
{
private readonly TypeSymbol _explicitInterfaceType;
private readonly TypeParameterInfo _typeParameterInfo;
private SourceOrdinaryMethodSymbol _otherPartOfPartial;
protected sealed override TypeSymbol ExplicitInterfaceType => _explicitInterfaceType;
internal sealed override SourceOrdinaryMethodSymbol OtherPartOfPartial => _otherPartOfPartial;
public sealed override ImmutableArray<TypeParameterSymbol> TypeParameters => _typeParameterInfo.LazyTypeParameters;
public SourceOrdinaryMethodSymbolComplex(NamedTypeSymbol containingType, TypeSymbol explicitInterfaceType, string name, Location location, MethodDeclarationSyntax syntax, MethodKind methodKind, bool isNullableAnalysisEnabled, BindingDiagnosticBag diagnostics)
: base(containingType, name, location, syntax, methodKind, isNullableAnalysisEnabled, diagnostics)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
_explicitInterfaceType = explicitInterfaceType;
ImmutableArray<TypeParameterSymbol> lazyTypeParameters = MakeTypeParameters(syntax, diagnostics);
_typeParameterInfo = (lazyTypeParameters.IsEmpty ? TypeParameterInfo.Empty : new TypeParameterInfo
{
LazyTypeParameters = lazyTypeParameters
});
}
internal static void InitializePartialMethodParts(SourceOrdinaryMethodSymbolComplex definition, SourceOrdinaryMethodSymbolComplex implementation)
{
definition._otherPartOfPartial = implementation;
implementation._otherPartOfPartial = definition;
}
protected sealed override MethodSymbol FindExplicitlyImplementedMethod(BindingDiagnosticBag diagnostics)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
MethodDeclarationSyntax syntax = GetSyntax();
TypeSymbol explicitInterfaceType = _explicitInterfaceType;
SyntaxToken identifier = syntax.Identifier;
return this.FindExplicitlyImplementedMethod(isOperator: false, explicitInterfaceType, ((SyntaxToken)(ref identifier)).ValueText, syntax.ExplicitInterfaceSpecifier, diagnostics);
}
public sealed override ImmutableArray<ImmutableArray<TypeWithAnnotations>> GetTypeParameterConstraintTypes()
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
if (_typeParameterInfo.LazyTypeParameterConstraintTypes.IsDefault)
{
GetTypeParameterConstraintKinds();
BindingDiagnosticBag instance = BindingDiagnosticBag.GetInstance();
MethodDeclarationSyntax syntax = GetSyntax();
Binder binder = DeclaringCompilation.GetBinderFactory(syntax.SyntaxTree).GetBinder((SyntaxNode)(object)syntax.ReturnType, syntax, this);
ImmutableArray<ImmutableArray<TypeWithAnnotations>> value = this.MakeTypeParameterConstraintTypes(binder, TypeParameters, syntax.TypeParameterList, syntax.ConstraintClauses, instance);
if (ImmutableInterlocked.InterlockedInitialize(ref _typeParameterInfo.LazyTypeParameterConstraintTypes, value))
{
AddDeclarationDiagnostics(instance);
}
((BindingDiagnosticBag<AssemblySymbol>)(object)instance).Free();
}
return _typeParameterInfo.LazyTypeParameterConstraintTypes;
}
public sealed override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds()
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
if (_typeParameterInfo.LazyTypeParameterConstraintKinds.IsDefault)
{
MethodDeclarationSyntax syntax = GetSyntax();
Binder binder = DeclaringCompilation.GetBinderFactory(syntax.SyntaxTree).GetBinder((SyntaxNode)(object)syntax.ReturnType, syntax, this);
ImmutableArray<TypeParameterConstraintKind> value = this.MakeTypeParameterConstraintKinds(binder, TypeParameters, syntax.TypeParameterList, syntax.ConstraintClauses);
ImmutableInterlocked.InterlockedInitialize(ref _typeParameterInfo.LazyTypeParameterConstraintKinds, value);
}
return _typeParameterInfo.LazyTypeParameterConstraintKinds;
}
protected sealed override void CheckConstraintsForExplicitInterfaceType(ConversionsBase conversions, BindingDiagnosticBag diagnostics)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Expected O, but got Unknown
if ((object)_explicitInterfaceType != null)
{
MethodDeclarationSyntax syntax = GetSyntax();
_explicitInterfaceType.CheckAllConstraints(DeclaringCompilation, conversions, (Location)new SourceLocation((SyntaxNode)(object)syntax.ExplicitInterfaceSpecifier.Name), diagnostics);
}
}
private ImmutableArray<TypeParameterSymbol> MakeTypeParameters(MethodDeclarationSyntax syntax, BindingDiagnosticBag diagnostics)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
if (syntax.Arity == 0)
{
return ImmutableArray<TypeParameterSymbol>.Empty;
}
MessageID.IDS_FeatureGenerics.CheckFeatureAvailability(diagnostics, syntax.TypeParameterList.LessThanToken);
OverriddenMethodTypeParameterMapBase overriddenMethodTypeParameterMapBase = null;
if (IsOverride)
{
overriddenMethodTypeParameterMapBase = new OverriddenMethodTypeParameterMap(this);
}
else if (IsExplicitInterfaceImplementation)
{
overriddenMethodTypeParameterMapBase = new ExplicitInterfaceMethodTypeParameterMap(this);
}
SeparatedSyntaxList<TypeParameterSyntax> parameters = syntax.TypeParameterList.Parameters;
ArrayBuilder<TypeParameterSymbol> instance = ArrayBuilder<TypeParameterSymbol>.GetInstance();
for (int i = 0; i < parameters.Count; i++)
{
TypeParameterSyntax typeParameterSyntax = parameters[i];
if (typeParameterSyntax.VarianceKeyword.Kind() != SyntaxKind.None)
{
SyntaxToken varianceKeyword = typeParameterSyntax.VarianceKeyword;
diagnostics.Add(ErrorCode.ERR_IllegalVarianceSyntax, ((SyntaxToken)(ref varianceKeyword)).GetLocation());
}
SyntaxToken identifier = typeParameterSyntax.Identifier;
Location location = ((SyntaxToken)(ref identifier)).GetLocation();
string valueText = ((SyntaxToken)(ref identifier)).ValueText;
for (int j = 0; j < instance.Count; j++)
{
if (valueText == instance[j].Name)
{
diagnostics.Add(ErrorCode.ERR_DuplicateTypeParameter, location, valueText);
break;
}
}
SourceMemberContainerTypeSymbol.ReportReservedTypeName(((SyntaxToken)(ref identifier)).Text, DeclaringCompilation, ((BindingDiagnosticBag)diagnostics).DiagnosticBag, location);
TypeParameterSymbol typeParameterSymbol = ContainingType.FindEnclosingTypeParameter(valueText);
if ((object)typeParameterSymbol != null)
{
diagnostics.Add(ErrorCode.WRN_TypeParameterSameAsOuterTypeParameter, location, valueText, typeParameterSymbol.ContainingType);
}
ImmutableArray<SyntaxReference> syntaxRefs = ImmutableArray.Create<SyntaxReference>(typeParameterSyntax.GetReference());
ImmutableArray<Location> locations = ImmutableArray.Create<Location>(location);
TypeParameterSymbol typeParameterSymbol2 = ((overriddenMethodTypeParameterMapBase != null) ? ((SourceTypeParameterSymbolBase)new SourceOverridingMethodTypeParameterSymbol(overriddenMethodTypeParameterMapBase, valueText, i, locations, syntaxRefs)) : ((SourceTypeParameterSymbolBase)new SourceMethodTypeParameterSymbol(this, valueText, i, locations, syntaxRefs)));
instance.Add(typeParameterSymbol2);
}
return instance.ToImmutableAndFree();
}
}
private const DeclarationModifiers PartialMethodExtendedModifierMask = DeclarationModifiers.Sealed | DeclarationModifiers.New | DeclarationModifiers.Extern | DeclarationModifiers.Virtual | DeclarationModifiers.Override;
private bool HasAnyBody => flags.HasAnyBody;
protected sealed override Location ReturnTypeLocation => ((SyntaxNode)GetSyntax().ReturnType).Location;
internal abstract SourceOrdinaryMethodSymbol OtherPartOfPartial { get; }
internal bool IsPartialDefinition
{
get
{
if (base.IsPartial && !HasAnyBody)
{
return !base.HasExternModifier;
}
return false;
}
}
internal bool IsPartialImplementation
{
get
{
if (base.IsPartial)
{
if (!HasAnyBody)
{
return base.HasExternModifier;
}
return true;
}
return false;
}
}
internal bool IsPartialWithoutImplementation
{
get
{
if (IsPartialDefinition)
{
return (object)OtherPartOfPartial == null;
}
return false;
}
}
internal SourceOrdinaryMethodSymbol SourcePartialDefinition
{
get
{
if (!IsPartialImplementation)
{
return null;
}
return OtherPartOfPartial;
}
}
internal SourceOrdinaryMethodSymbol SourcePartialImplementation
{
get
{
if (!IsPartialDefinition)
{
return null;
}
return OtherPartOfPartial;
}
}
public sealed override MethodSymbol PartialDefinitionPart => SourcePartialDefinition;
public sealed override MethodSymbol PartialImplementationPart => SourcePartialImplementation;
public sealed override bool IsExtern
{
get
{
if (!IsPartialDefinition)
{
return base.HasExternModifier;
}
return OtherPartOfPartial?.IsExtern ?? false;
}
}
protected sealed override SourceMemberMethodSymbol BoundAttributesSource => SourcePartialDefinition;
private SyntaxList<AttributeListSyntax> AttributeDeclarationSyntaxList
{
get
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
if (ContainingType is SourceMemberContainerTypeSymbol { AnyMemberHasAttributes: not false })
{
return GetSyntax().AttributeLists;
}
return default(SyntaxList<AttributeListSyntax>);
}
}
internal sealed override bool GenerateDebugInfo
{
get
{
if (!IsAsync)
{
return !IsIterator;
}
return false;
}
}
internal bool HasExplicitAccessModifier { get; }
private bool HasExtendedPartialModifier => (DeclarationModifiers & (DeclarationModifiers.Sealed | DeclarationModifiers.New | DeclarationModifiers.Extern | DeclarationModifiers.Virtual | DeclarationModifiers.Override)) != 0;
public static SourceOrdinaryMethodSymbol CreateMethodSymbol(NamedTypeSymbol containingType, Binder bodyBinder, MethodDeclarationSyntax syntax, bool isNullableAnalysisEnabled, BindingDiagnosticBag diagnostics)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier = syntax.ExplicitInterfaceSpecifier;
SyntaxToken identifier = syntax.Identifier;
TypeSymbol explicitInterfaceTypeOpt;
string aliasQualifierOpt;
string memberNameAndInterfaceSymbol = ExplicitInterfaceHelpers.GetMemberNameAndInterfaceSymbol(bodyBinder, explicitInterfaceSpecifier, ((SyntaxToken)(ref identifier)).ValueText, diagnostics, out explicitInterfaceTypeOpt, out aliasQualifierOpt);
SourceLocation location = new SourceLocation(ref identifier);
MethodKind methodKind = (MethodKind)((explicitInterfaceSpecifier == null) ? 10 : 8);
if ((object)explicitInterfaceTypeOpt != null || syntax.Modifiers.Any(SyntaxKind.PartialKeyword) || syntax.Arity != 0)
{
return new SourceOrdinaryMethodSymbolComplex(containingType, explicitInterfaceTypeOpt, memberNameAndInterfaceSymbol, (Location)(object)location, syntax, methodKind, isNullableAnalysisEnabled, diagnostics);
}
return new SourceOrdinaryMethodSymbolSimple(containingType, memberNameAndInterfaceSymbol, (Location)(object)location, syntax, methodKind, isNullableAnalysisEnabled, diagnostics);
}
private SourceOrdinaryMethodSymbol(NamedTypeSymbol containingType, string name, Location location, MethodDeclarationSyntax syntax, MethodKind methodKind, bool isNullableAnalysisEnabled, BindingDiagnosticBag diagnostics)
: base(containingType, name, location, syntax, SyntaxFacts.HasYieldOperations((SyntaxNode?)(object)syntax.Body), MakeModifiersAndFlags(containingType, location, syntax, methodKind, isNullableAnalysisEnabled, diagnostics, out var hasExplicitAccessMod))
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Invalid comparison between Unknown and I4
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
this.CheckUnsafeModifier(DeclarationModifiers, diagnostics);
HasExplicitAccessModifier = hasExplicitAccessMod;
bool flag = syntax.HasAnyBody();
CheckFeatureAvailabilityAndRuntimeSupport((SyntaxNode)(object)syntax, location, flag, diagnostics);
if (flag)
{
CheckModifiersForBody(location, diagnostics);
}
ModifierUtils.CheckAccessibility(DeclarationModifiers, this, (int)methodKind == 8, diagnostics, location);
if (syntax.Arity == 0)
{
Symbol.ReportErrorIfHasConstraints(syntax.ConstraintClauses, ((BindingDiagnosticBag)diagnostics).DiagnosticBag);
}
Symbol.CheckForBlockAndExpressionBody(syntax.Body, syntax.ExpressionBody, syntax, diagnostics);
}
private static (DeclarationModifiers, Flags) MakeModifiersAndFlags(NamedTypeSymbol containingType, Location location, MethodDeclarationSyntax syntax, MethodKind methodKind, bool isNullableAnalysisEnabled, BindingDiagnosticBag diagnostics, out bool hasExplicitAccessMod)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Invalid comparison between Unknown and I4
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
(DeclarationModifiers, bool) tuple = MakeModifiers(syntax, containingType, methodKind, syntax.HasAnyBody(), location, diagnostics);
DeclarationModifiers item = tuple.Item1;
hasExplicitAccessMod = tuple.Item2;
bool isScoped;
RefKind refKindInLocalOrReturn = syntax.ReturnType.SkipScoped(out isScoped).GetRefKindInLocalOrReturn(diagnostics);
bool hasAnyBody = syntax.HasAnyBody();
bool isExpressionBodied = syntax.IsExpressionBodied();
ParameterSyntax parameterSyntax = syntax.ParameterList.Parameters.FirstOrDefault();
Flags item2 = new Flags(methodKind, refKindInLocalOrReturn, item, returnsVoid: false, returnsVoidIsSet: false, hasAnyBody, isExpressionBodied, parameterSyntax != null && !parameterSyntax.IsArgList && parameterSyntax.Modifiers.Any(SyntaxKind.ThisKeyword), isNullableAnalysisEnabled, syntax.IsVarArg(), (int)methodKind == 8);
return (item, item2);
}
private (TypeWithAnnotations ReturnType, ImmutableArray<ParameterSymbol> Parameters, ImmutableArray<TypeParameterConstraintClause> DeclaredConstraintsForOverrideOrImplementation) MakeParametersAndBindReturnType(BindingDiagnosticBag diagnostics)
{
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Invalid comparison between Unknown and I4
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Invalid comparison between Unknown and I4
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Invalid comparison between Unknown and I4
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
MethodDeclarationSyntax syntax = GetSyntax();
Binder binder = DeclaringCompilation.GetBinderFactory(syntax.SyntaxTree).GetBinder((SyntaxNode)(object)syntax.ReturnType, syntax, this).WithAdditionalFlagsAndContainingMemberOrLambda(BinderFlags.SuppressConstraintChecks, this);
ParameterListSyntax parameterList = syntax.ParameterList;
bool isScoped = IsVirtual || IsAbstract;
SyntaxToken arglistToken;
ImmutableArray<ParameterSymbol> item = ImmutableArrayExtensions.Cast<SourceParameterSymbol, ParameterSymbol>(ParameterHelpers.MakeParameters(binder, this, parameterList, out arglistToken, diagnostics, allowRefOrOut: true, allowThis: true, isScoped));
TypeSyntax returnType = syntax.ReturnType;
returnType = returnType.SkipScoped(out isScoped).SkipRef();
TypeWithAnnotations typeWithAnnotations = binder.BindType(returnType, diagnostics);
if (typeWithAnnotations.IsRestrictedType(ignoreSpanLikeTypes: true) && ((int)typeWithAnnotations.SpecialType != 36 || ((int)ContainingType.SpecialType != 36 && (int)ContainingType.SpecialType != 37)))
{
diagnostics.Add(ErrorCode.ERR_MethodReturnCantBeRefAny, ((SyntaxNode)syntax.ReturnType).Location, typeWithAnnotations.Type);
}
ImmutableArray<TypeParameterConstraintClause> immutableArray = default(ImmutableArray<TypeParameterConstraintClause>);
if (Arity != 0 && (syntax.ExplicitInterfaceSpecifier != null || IsOverride))
{
if (syntax.ConstraintClauses.Count > 0)
{
Binder.CheckFeatureAvailability(syntax.ConstraintClauses[0].WhereKeyword, MessageID.IDS_OverrideWithConstraints, diagnostics);
immutableArray = binder.WithAdditionalFlags(BinderFlags.SuppressConstraintChecks | BinderFlags.GenericConstraintsClause).BindTypeParameterConstraintClauses(this, TypeParameters, syntax.TypeParameterList, syntax.ConstraintClauses, diagnostics, performOnlyCycleSafeValidation: false, isForOverride: true);
}
ImmutableArray<ParameterSymbol>.Enumerator enumerator = item.GetEnumerator();
while (enumerator.MoveNext())
{
forceMethodTypeParameters(enumerator.Current.TypeWithAnnotations, this, immutableArray);
}
forceMethodTypeParameters(typeWithAnnotations, this, immutableArray);
}
return (ReturnType: typeWithAnnotations, Parameters: item, DeclaredConstraintsForOverrideOrImplementation: immutableArray);
static void forceMethodTypeParameters(TypeWithAnnotations type, SourceOrdinaryMethodSymbol method, ImmutableArray<TypeParameterConstraintClause> declaredConstraints)
{
type.VisitType(null, delegate(TypeWithAnnotations typeWithAnnotations2, (SourceOrdinaryMethodSymbol method, ImmutableArray<TypeParameterConstraintClause> declaredConstraints) args, bool unused2)
{
if (typeWithAnnotations2.DefaultType is TypeParameterSymbol typeParameterSymbol && (object)typeParameterSymbol.DeclaringMethod == args.method)
{
bool asValueType = args.declaredConstraints.IsDefault || (args.declaredConstraints[typeParameterSymbol.Ordinal].Constraints & (TypeParameterConstraintKind.ReferenceType | TypeParameterConstraintKind.Default)) == 0;
typeWithAnnotations2.TryForceResolve(asValueType);
}
return false;
}, null, (method, declaredConstraints), canDigThroughNullable: false, useDefaultType: true);
}
}
protected sealed override void ExtensionMethodChecks(BindingDiagnosticBag diagnostics)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Invalid comparison between Unknown and I4
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Invalid comparison between Unknown and I4
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Invalid comparison between Unknown and I4
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
if (!IsExtensionMethod)
{
return;
}
MethodDeclarationSyntax syntax = GetSyntax();
TypeWithAnnotations typeWithAnnotations = Parameters[0].TypeWithAnnotations;
RefKind refKind = Parameters[0].RefKind;
if (!typeWithAnnotations.Type.IsValidExtensionParameterType())
{
Location location = ((SyntaxNode)syntax.ParameterList.Parameters[0].Type).Location;
diagnostics.Add(ErrorCode.ERR_BadTypeforThis, location, typeWithAnnotations.Type);
return;
}
if ((int)refKind == 1 && !typeWithAnnotations.Type.IsValueType)
{
diagnostics.Add(ErrorCode.ERR_RefExtensionMustBeValueTypeOrConstrainedToOne, _location, Name);
return;
}
bool flag = refKind - 3 <= 1;
if (flag && (int)typeWithAnnotations.TypeKind != 10)
{
diagnostics.Add(ErrorCode.ERR_InExtensionMustBeValueType, _location, Name);
return;
}
if ((object)ContainingType.ContainingType != null)
{
diagnostics.Add(ErrorCode.ERR_ExtensionMethodsDecl, _location, ContainingType.Name);
return;
}
if (!ContainingType.IsScriptClass && (!ContainingType.IsStatic || ContainingType.Arity != 0))
{
SyntaxToken val = ((syntax.Parent is TypeDeclarationSyntax typeDeclarationSyntax) ? typeDeclarationSyntax.Identifier : syntax.Identifier);
Location location2 = ((SyntaxToken)(ref val)).GetLocation();
diagnostics.Add(ErrorCode.ERR_BadExtensionAgg, location2);
return;
}
if (!IsStatic)
{
diagnostics.Add(ErrorCode.ERR_BadExtensionMeth, _location);
return;
}
UseSiteInfo<AssemblySymbol> useSiteInfo;
Symbol wellKnownTypeMember = Binder.GetWellKnownTypeMember(DeclaringCompilation, (WellKnownMember)111, out useSiteInfo);
SyntaxToken val2 = syntax.ParameterList.Parameters[0].Modifiers.FirstOrDefault(SyntaxKind.ThisKeyword);
if ((object)wellKnownTypeMember == null)
{
MemberDescriptor descriptor = WellKnownMembers.GetDescriptor((WellKnownMember)111);
diagnostics.Add(ErrorCode.ERR_ExtensionAttrNotFound, ((SyntaxToken)(ref val2)).GetLocation(), ((MemberDescriptor)(ref descriptor)).DeclaringTypeMetadataName);
}
else
{
((BindingDiagnosticBag<AssemblySymbol>)(object)diagnostics).Add(useSiteInfo, val2);
}
}
internal MethodDeclarationSyntax GetSyntax()
{
return (MethodDeclarationSyntax)(object)syntaxReferenceOpt.GetSyntax(default(CancellationToken));
}
internal sealed override ExecutableCodeBinder TryGetBodyBinder(BinderFactory binderFactoryOpt = null, bool ignoreAccessibility = false)
{
return TryGetBodyBinderFromSyntax(binderFactoryOpt, ignoreAccessibility);
}
protected sealed override void CompleteAsyncMethodChecksBetweenStartAndFinish()
{
if (IsPartialDefinition)
{
DeclaringCompilation.SymbolDeclaredEvent(this);
}
}
protected sealed override int GetParameterCountFromSyntax()
{
return GetSyntax().ParameterList.ParameterCount;
}
internal static void InitializePartialMethodParts(SourceOrdinaryMethodSymbol definition, SourceOrdinaryMethodSymbol implementation)
{
SourceOrdinaryMethodSymbolComplex.InitializePartialMethodParts((SourceOrdinaryMethodSymbolComplex)definition, (SourceOrdinaryMethodSymbolComplex)implementation);
}
public sealed override string GetDocumentationCommentXml(CultureInfo preferredCulture = null, bool expandIncludes = false, CancellationToken cancellationToken = default(CancellationToken))
{
return SourceDocumentationCommentUtils.GetAndCacheDocumentationComment(this, expandIncludes, ref expandIncludes ? ref lazyExpandedDocComment : ref lazyDocComment);
}
internal sealed override OneOrMany<SyntaxList<AttributeListSyntax>> GetAttributeDeclarations()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
if ((object)SourcePartialImplementation != null)
{
return OneOrMany.Create<SyntaxList<AttributeListSyntax>>(ImmutableArray.Create<SyntaxList<AttributeListSyntax>>(AttributeDeclarationSyntaxList, SourcePartialImplementation.AttributeDeclarationSyntaxList));
}
return OneOrMany.Create<SyntaxList<AttributeListSyntax>>(AttributeDeclarationSyntaxList);
}
private static DeclarationModifiers MakeDeclarationModifiers(MethodDeclarationSyntax syntax, NamedTypeSymbol containingType, Location location, DeclarationModifiers allowedModifiers, BindingDiagnosticBag diagnostics)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
bool modifierErrors;
return ModifierUtils.MakeAndCheckNonTypeMemberModifiers(isOrdinaryMethod: true, containingType.IsInterface, syntax.Modifiers, DeclarationModifiers.None, allowedModifiers, location, diagnostics, out modifierErrors);
}
internal sealed override void ForceComplete(SourceLocation locationOpt, CancellationToken cancellationToken)
{
SourcePartialImplementation?.ForceComplete(locationOpt, cancellationToken);
base.ForceComplete(locationOpt, cancellationToken);
}
public sealed override bool IsDefinedInSourceTree(SyntaxTree tree, TextSpan? definedWithinSpan, CancellationToken cancellationToken = default(CancellationToken))
{
if (!Symbol.IsDefinedInSourceTree(base.SyntaxRef, tree, definedWithinSpan))
{
return SourcePartialImplementation?.IsDefinedInSourceTree(tree, definedWithinSpan, cancellationToken) ?? false;
}
return true;
}
protected abstract override void CheckConstraintsForExplicitInterfaceType(ConversionsBase conversions, BindingDiagnosticBag diagnostics);
protected sealed override void PartialMethodChecks(BindingDiagnosticBag diagnostics)
{
SourceOrdinaryMethodSymbol sourcePartialImplementation = SourcePartialImplementation;
if ((object)sourcePartialImplementation != null)
{
PartialMethodChecks(this, sourcePartialImplementation, diagnostics);
}
}
private static void PartialMethodChecks(SourceOrdinaryMethodSymbol definition, SourceOrdinaryMethodSymbol implementation, BindingDiagnosticBag diagnostics)
{
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_0270: Expected O, but got Unknown
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_027e: Expected O, but got Unknown
MethodSymbol methodSymbol = definition.ConstructIfGeneric(TypeMap.TypeParametersAsTypeSymbolsWithIgnoredAnnotations(implementation.TypeParameters));
bool flag = !methodSymbol.ReturnTypeWithAnnotations.Equals(implementation.ReturnTypeWithAnnotations, (TypeCompareKind)63);
if (flag)
{
diagnostics.Add(ErrorCode.ERR_PartialMethodReturnTypeDifference, implementation.GetFirstLocation());
}
else if (MemberSignatureComparer.ConsideringTupleNamesCreatesDifference(definition, implementation))
{
flag = true;
diagnostics.Add(ErrorCode.ERR_PartialMethodInconsistentTupleNames, implementation.GetFirstLocation(), definition, implementation);
}
if (definition.RefKind != implementation.RefKind)
{
diagnostics.Add(ErrorCode.ERR_PartialMethodRefReturnDifference, implementation.GetFirstLocation());
}
if (definition.IsStatic != implementation.IsStatic)
{
diagnostics.Add(ErrorCode.ERR_PartialMethodStaticDifference, implementation.GetFirstLocation());
}
if (definition.IsDeclaredReadOnly != implementation.IsDeclaredReadOnly)
{
diagnostics.Add(ErrorCode.ERR_PartialMethodReadOnlyDifference, implementation.GetFirstLocation());
}
if (definition.IsExtensionMethod != implementation.IsExtensionMethod)
{
diagnostics.Add(ErrorCode.ERR_PartialMethodExtensionDifference, implementation.GetFirstLocation());
}
if (definition.IsUnsafe != implementation.IsUnsafe && definition.CompilationAllowsUnsafe())
{
diagnostics.Add(ErrorCode.ERR_PartialMethodUnsafeDifference, implementation.GetFirstLocation());
}
if (definition.IsParams() != implementation.IsParams())
{
diagnostics.Add(ErrorCode.ERR_PartialMethodParamsDifference, implementation.GetFirstLocation());
}
if (definition.HasExplicitAccessModifier != implementation.HasExplicitAccessModifier || definition.DeclaredAccessibility != implementation.DeclaredAccessibility)
{
diagnostics.Add(ErrorCode.ERR_PartialMethodAccessibilityDifference, implementation.GetFirstLocation());
}
if (definition.IsVirtual != implementation.IsVirtual || definition.IsOverride != implementation.IsOverride || definition.IsSealed != implementation.IsSealed || definition.IsNew != implementation.IsNew)
{
diagnostics.Add(ErrorCode.ERR_PartialMethodExtendedModDifference, implementation.GetFirstLocation());
}
PartialMethodConstraintsChecks(definition, implementation, diagnostics);
if (SourceMemberContainerTypeSymbol.CheckValidScopedOverride(methodSymbol, implementation, diagnostics, delegate(BindingDiagnosticBag bindingDiagnosticBag, MethodSymbol implementedMethod, MethodSymbol implementingMethod, ParameterSymbol implementingParameter, bool blameAttributes, object arg)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
bindingDiagnosticBag.Add(ErrorCode.ERR_ScopedMismatchInParameterOfPartial, implementingMethod.GetFirstLocation(), (object)new FormattedSymbol((ISymbolInternal)(object)implementingParameter, SymbolDisplayFormat.ShortFormat));
}, null, allowVariance: false, invokedAsExtensionMethod: false))
{
flag = true;
}
if (SourceMemberContainerTypeSymbol.CheckValidNullableMethodOverride(implementation.DeclaringCompilation, methodSymbol, implementation, diagnostics, delegate(BindingDiagnosticBag bindingDiagnosticBag, MethodSymbol implementedMethod, MethodSymbol implementingMethod, bool topLevel, object arg)
{
bindingDiagnosticBag.Add(ErrorCode.WRN_NullabilityMismatchInReturnTypeOnPartial, implementingMethod.GetFirstLocation());
}, delegate(BindingDiagnosticBag bindingDiagnosticBag, MethodSymbol implementedMethod, MethodSymbol implementingMethod, ParameterSymbol implementingParameter, bool blameAttributes, object arg)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
bindingDiagnosticBag.Add(ErrorCode.WRN_NullabilityMismatchInParameterTypeOnPartial, implementingMethod.GetFirstLocation(), (object)new FormattedSymbol((ISymbolInternal)(object)implementingParameter, SymbolDisplayFormat.ShortFormat));
}, null))
{
flag = true;
}
if ((!flag && !MemberSignatureComparer.PartialMethodsStrictComparer.Equals(definition, implementation)) || hasDifferencesInParameterOrTypeParameterName(definition, implementation))
{
diagnostics.Add(ErrorCode.WRN_PartialMethodTypeDifference, implementation.GetFirstLocation(), (object)new FormattedSymbol((ISymbolInternal)(object)definition, SymbolDisplayFormat.MinimallyQualifiedFormat), (object)new FormattedSymbol((ISymbolInternal)(object)implementation, SymbolDisplayFormat.MinimallyQualifiedFormat));
}
static bool hasDifferencesInParameterOrTypeParameterName(SourceOrdinaryMethodSymbol sourceOrdinaryMethodSymbol, SourceOrdinaryMethodSymbol sourceOrdinaryMethodSymbol2)
{
if (sourceOrdinaryMethodSymbol.Parameters.SequenceEqual(sourceOrdinaryMethodSymbol2.Parameters, (ParameterSymbol a, ParameterSymbol b) => a.Name == b.Name))
{
return !sourceOrdinaryMethodSymbol.TypeParameters.SequenceEqual(sourceOrdinaryMethodSymbol2.TypeParameters, (TypeParameterSymbol a, TypeParameterSymbol b) => a.Name == b.Name);
}
return true;
}
}
private static void PartialMethodConstraintsChecks(SourceOrdinaryMethodSymbol definition, SourceOrdinaryMethodSymbol implementation, BindingDiagnosticBag diagnostics)
{
ImmutableArray<TypeParameterSymbol> typeParameters = definition.TypeParameters;
int length = typeParameters.Length;
if (length == 0)
{
return;
}
ImmutableArray<TypeParameterSymbol> typeParameters2 = implementation.TypeParameters;
ImmutableArray<TypeWithAnnotations> to = IndexedTypeParameterSymbol.Take(length);
TypeMap typeMap = new TypeMap(typeParameters, to, allowAlpha: true);
TypeMap typeMap2 = new TypeMap(typeParameters2, to, allowAlpha: true);
for (int i = 0; i < length; i++)
{
TypeParameterSymbol typeParameter = typeParameters[i];
TypeParameterSymbol typeParameterSymbol = typeParameters2[i];
if (!MemberSignatureComparer.HaveSameConstraints(typeParameter, typeMap, typeParameterSymbol, typeMap2))
{
diagnostics.Add(ErrorCode.ERR_PartialMethodInconsistentConstraints, implementation.GetFirstLocation(), implementation, typeParameterSymbol.Name);
}
else if (!MemberSignatureComparer.HaveSameNullabilityInConstraints(typeParameter, typeMap, typeParameterSymbol, typeMap2))
{
diagnostics.Add(ErrorCode.WRN_NullabilityMismatchInConstraintsOnPartialImplementation, implementation.GetFirstLocation(), implementation, typeParameterSymbol.Name);
}
}
}
internal sealed override bool CallsAreOmitted(SyntaxTree syntaxTree)
{
if (IsPartialWithoutImplementation)
{
return true;
}
return base.CallsAreOmitted(syntaxTree);
}
protected override void MethodChecks(BindingDiagnosticBag diagnostics)
{
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Invalid comparison between Unknown and I4
(TypeWithAnnotations ReturnType, ImmutableArray<ParameterSymbol> Parameters, ImmutableArray<TypeParameterConstraintClause> DeclaredConstraintsForOverrideOrImplementation) tuple = MakeParametersAndBindReturnType(diagnostics);
TypeWithAnnotations item = tuple.ReturnType;
ImmutableArray<ParameterSymbol> item2 = tuple.Parameters;
ImmutableArray<TypeParameterConstraintClause> item3 = tuple.DeclaredConstraintsForOverrideOrImplementation;
MethodSymbol methodSymbol = MethodChecks(item, item2, diagnostics);
if (!item3.IsDefault && (object)methodSymbol != null)
{
for (int i = 0; i < item3.Length; i++)
{
TypeParameterSymbol typeParameterSymbol = TypeParameters[i];
TypeParameterConstraintKind typeParameterConstraintKind = item3[i].Constraints & (TypeParameterConstraintKind.ReferenceType | TypeParameterConstraintKind.ValueType | TypeParameterConstraintKind.Default);
ErrorCode code;
if (typeParameterConstraintKind != TypeParameterConstraintKind.ReferenceType)
{
if (typeParameterConstraintKind != TypeParameterConstraintKind.ValueType)
{
if (typeParameterConstraintKind != TypeParameterConstraintKind.Default || (!typeParameterSymbol.IsReferenceType && !typeParameterSymbol.IsValueType))
{
continue;
}
code = ErrorCode.ERR_OverrideDefaultConstraintNotSatisfied;
}
else
{
if (typeParameterSymbol.IsNonNullableValueType())
{
continue;
}
code = ErrorCode.ERR_OverrideValConstraintNotSatisfied;
}
}
else
{
if (typeParameterSymbol.IsReferenceType)
{
continue;
}
code = ErrorCode.ERR_OverrideRefConstraintNotSatisfied;
}
diagnostics.Add(code, typeParameterSymbol.GetFirstLocation(), this, typeParameterSymbol, methodSymbol.TypeParameters[i], methodSymbol);
}
}
CheckModifiers((int)MethodKind == 8, _location, diagnostics);
}
private static (DeclarationModifiers mods, bool hasExplicitAccessMod) MakeModifiers(MethodDeclarationSyntax syntax, NamedTypeSymbol containingType, MethodKind methodKind, bool hasBody, Location location, BindingDiagnosticBag diagnostics)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Invalid comparison between Unknown and I4
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
bool isInterface = containingType.IsInterface;
bool flag = (int)methodKind == 8;
DeclarationModifiers declarationModifiers = ((!isInterface || flag) ? DeclarationModifiers.Private : DeclarationModifiers.None);
DeclarationModifiers declarationModifiers2 = DeclarationModifiers.Partial | DeclarationModifiers.Unsafe;
DeclarationModifiers declarationModifiers3 = DeclarationModifiers.None;
if (!flag)
{
declarationModifiers2 |= DeclarationModifiers.AccessibilityMask | DeclarationModifiers.Abstract | DeclarationModifiers.Sealed | DeclarationModifiers.Static | DeclarationModifiers.New | DeclarationModifiers.Virtual;
if (!isInterface)
{
declarationModifiers2 |= DeclarationModifiers.Override;
}
else
{
declarationModifiers3 |= DeclarationModifiers.AccessibilityMask | DeclarationModifiers.Abstract | DeclarationModifiers.Sealed | DeclarationModifiers.Static | DeclarationModifiers.Extern | DeclarationModifiers.Partial | DeclarationModifiers.Virtual | DeclarationModifiers.Async;
}
}
else
{
if (isInterface)
{
declarationModifiers2 |= DeclarationModifiers.Abstract;
}
declarationModifiers2 |= DeclarationModifiers.Static;
}
declarationModifiers2 |= DeclarationModifiers.Extern | DeclarationModifiers.Async;
if (containingType.IsStructType())
{
declarationModifiers2 |= DeclarationModifiers.ReadOnly;
}
DeclarationModifiers declarationModifiers4 = MakeDeclarationModifiers(syntax, containingType, location, declarationModifiers2, diagnostics);
bool item;
if ((declarationModifiers4 & DeclarationModifiers.AccessibilityMask) == 0)
{
item = false;
declarationModifiers4 |= declarationModifiers;
}
else
{
item = true;
}
ModifierUtils.CheckFeatureAvailabilityForStaticAbstractMembersInInterfacesIfNeeded(declarationModifiers4, flag, location, diagnostics);
ModifierUtils.ReportDefaultInterfaceImplementationModifiers(hasBody, declarationModifiers4, declarationModifiers3, location, diagnostics);
declarationModifiers4 = AddImpliedModifiers(declarationModifiers4, isInterface, methodKind, hasBody);
return (mods: declarationModifiers4, hasExplicitAccessMod: item);
}
private static DeclarationModifiers AddImpliedModifiers(DeclarationModifiers mods, bool containingTypeIsInterface, MethodKind methodKind, bool hasBody)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Invalid comparison between Unknown and I4
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
if (containingTypeIsInterface)
{
mods = ModifierUtils.AdjustModifiersForAnInterfaceMember(mods, hasBody, (int)methodKind == 8);
}
else if ((int)methodKind == 8)
{
mods = (DeclarationModifiers)(((uint)mods & 0xFFFFFC0Fu) | 0x100);
}
return mods;
}
private void CheckModifiers(bool isExplicitInterfaceImplementation, Location location, BindingDiagnosticBag diagnostics)
{
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Invalid comparison between Unknown and I4
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Invalid comparison between Unknown and I4
//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
//IL_02b7: Invalid comparison between Unknown and I4
//IL_0287: Unknown result type (might be due to invalid IL or missing references)
//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
//IL_02ec: Invalid comparison between Unknown and I4
//IL_034f: Unknown result type (might be due to invalid IL or missing references)
//IL_0355: Invalid comparison between Unknown and I4
//IL_035d: Unknown result type (might be due to invalid IL or missing references)
//IL_0364: Invalid comparison between Unknown and I4
//IL_0429: Unknown result type (might be due to invalid IL or missing references)
bool isVararg = IsVararg;
bool flag = isExplicitInterfaceImplementation && ContainingType.IsInterface;
if (base.IsPartial && HasExplicitAccessModifier)
{
Binder.CheckFeatureAvailability((SyntaxNode)(object)SyntaxNode, MessageID.IDS_FeatureExtendedPartialMethods, diagnostics, location);
}
if (base.IsPartial && IsAbstract)
{
diagnostics.Add(ErrorCode.ERR_PartialMethodInvalidModifier, location);
}
else if (base.IsPartial && !HasExplicitAccessModifier && !ReturnsVoid)
{
diagnostics.Add(ErrorCode.ERR_PartialMethodWithNonVoidReturnMustHaveAccessMods, location, this);
}
else if (base.IsPartial && !HasExplicitAccessModifier && HasExtendedPartialModifier)
{
diagnostics.Add(ErrorCode.ERR_PartialMethodWithExtendedModMustHaveAccessMods, location, this);
}
else if (base.IsPartial && !HasExplicitAccessModifier && Parameters.Any((ParameterSymbol p) => (int)p.RefKind == 2))
{
diagnostics.Add(ErrorCode.ERR_PartialMethodWithOutParamMustHaveAccessMods, location, this);
}
else if ((int)DeclaredAccessibility == 1 && (IsVirtual || (IsAbstract && !flag) || IsOverride))
{
diagnostics.Add(ErrorCode.ERR_VirtualPrivate, location, this);
}
else if (IsOverride && (base.IsNew || IsVirtual))
{
diagnostics.Add(ErrorCode.ERR_OverrideNotNew, location, this);
}
else if (IsSealed && !IsOverride && (!flag || !IsAbstract))
{
diagnostics.Add(ErrorCode.ERR_SealedNonOverride, location, this);
}
else if (IsSealed && (int)ContainingType.TypeKind == 10)
{
diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.SealedKeyword));
}
else if (base.ReturnType.IsStatic)
{
diagnostics.Add(ErrorFacts.GetStaticClassReturnCode(ContainingType.IsInterfaceType()), location, base.ReturnType);
}
else if (IsAbstract && IsExtern)
{
diagnostics.Add(ErrorCode.ERR_AbstractAndExtern, location, this);
}
else if (IsAbstract && IsSealed && !flag)
{
diagnostics.Add(ErrorCode.ERR_AbstractAndSealed, location, this);
}
else if (IsAbstract && IsVirtual)
{
diagnostics.Add(ErrorCode.ERR_AbstractNotVirtual, location, Kind.Localize(), this);
}
else if (IsAbstract && (int)ContainingType.TypeKind == 10)
{
diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.AbstractKeyword));
}
else if (IsVirtual && (int)ContainingType.TypeKind == 10)
{
diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.VirtualKeyword));
}
else if (IsStatic && IsDeclaredReadOnly)
{
diagnostics.Add(ErrorCode.ERR_StaticMemberCantBeReadOnly, location, this);
}
else if (IsAbstract && !ContainingType.IsAbstract && ((int)ContainingType.TypeKind == 2 || (int)ContainingType.TypeKind == 12))
{
diagnostics.Add(ErrorCode.ERR_AbstractInConcreteClass, location, this, ContainingType);
}
else if (IsVirtual && ContainingType.IsSealed)
{
diagnostics.Add(ErrorCode.ERR_NewVirtualInSealed, location, this, ContainingType);
}
else if (!HasAnyBody && IsAsync)
{
diagnostics.Add(ErrorCode.ERR_BadAsyncLacksBody, location);
}
else if (!HasAnyBody && !IsExtern && !IsAbstract && !base.IsPartial && !base.IsExpressionBodied)
{
diagnostics.Add(ErrorCode.ERR_ConcreteMissingBody, location, this);
}
else if (ContainingType.IsSealed && DeclaredAccessibility.HasProtected() && !IsOverride)
{
diagnostics.Add(AccessCheck.GetProtectedMemberInSealedTypeError(ContainingType), location, this);
}
else if (ContainingType.IsStatic && !IsStatic)
{
diagnostics.Add(ErrorCode.ERR_InstanceMemberInStaticClass, location, Name);
}
else if (isVararg && (IsGenericMethod || ContainingType.IsGenericType || (Parameters.Length > 0 && Parameters[Parameters.Length - 1].IsParams)))
{
diagnostics.Add(ErrorCode.ERR_BadVarargs, location);
}
else if (isVararg && IsAsync)
{
diagnostics.Add(ErrorCode.ERR_VarargsAsync, location);
}
}
}