76 lines
2.5 KiB
C#
76 lines
2.5 KiB
C#
using System.Collections.Immutable;
|
|
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
|
using Roslyn.Utilities;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp.Symbols;
|
|
|
|
internal abstract class SourceMethodSymbol : MethodSymbol
|
|
{
|
|
protected bool AreContainingSymbolLocalsZeroed
|
|
{
|
|
get
|
|
{
|
|
if (ContainingSymbol is SourceMethodSymbol sourceMethodSymbol)
|
|
{
|
|
return sourceMethodSymbol.AreLocalsZeroed;
|
|
}
|
|
if (ContainingType is SourceMemberContainerTypeSymbol sourceMemberContainerTypeSymbol)
|
|
{
|
|
return sourceMemberContainerTypeSymbol.AreLocalsZeroed;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
protected override bool HasSetsRequiredMembersImpl
|
|
{
|
|
get
|
|
{
|
|
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Symbols/Source/SourceMethodSymbol.cs", 83);
|
|
}
|
|
}
|
|
|
|
internal sealed override bool UseUpdatedEscapeRules => ContainingModule.UseUpdatedEscapeRules;
|
|
|
|
public abstract ImmutableArray<ImmutableArray<TypeWithAnnotations>> GetTypeParameterConstraintTypes();
|
|
|
|
public abstract ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds();
|
|
|
|
protected unsafe static void ReportBadRefToken(TypeSyntax returnTypeSyntax, BindingDiagnosticBag diagnostics)
|
|
{
|
|
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
|
|
if (!((SyntaxNode)returnTypeSyntax).HasErrors)
|
|
{
|
|
SyntaxToken firstToken = returnTypeSyntax.GetFirstToken();
|
|
diagnostics.Add(ErrorCode.ERR_UnexpectedToken, ((SyntaxToken)(ref firstToken)).GetLocation(), ((object)(*(SyntaxToken*)(&firstToken))/*cast due to constrained. prefix*/).ToString());
|
|
}
|
|
}
|
|
|
|
internal void ReportAsyncParameterErrors(BindingDiagnosticBag diagnostics, Location location)
|
|
{
|
|
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
|
|
ImmutableArray<ParameterSymbol>.Enumerator enumerator = Parameters.GetEnumerator();
|
|
while (enumerator.MoveNext())
|
|
{
|
|
ParameterSymbol current = enumerator.Current;
|
|
if ((int)current.RefKind != 0)
|
|
{
|
|
diagnostics.Add(ErrorCode.ERR_BadAsyncArgType, getLocation(current, location));
|
|
}
|
|
else if (current.Type.IsPointerOrFunctionPointer())
|
|
{
|
|
diagnostics.Add(ErrorCode.ERR_UnsafeAsyncArgType, getLocation(current, location));
|
|
}
|
|
else if (current.Type.IsRestrictedType())
|
|
{
|
|
diagnostics.Add(ErrorCode.ERR_BadSpecialByRefLocal, getLocation(current, location), current.Type);
|
|
}
|
|
}
|
|
static Location getLocation(ParameterSymbol parameter, Location val)
|
|
{
|
|
return parameter.TryGetFirstLocation() ?? val;
|
|
}
|
|
}
|
|
}
|