-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Expand file tree
/
Copy pathSynthesizedMethodSymbol.cs
More file actions
115 lines (88 loc) · 3.51 KB
/
SynthesizedMethodSymbol.cs
File metadata and controls
115 lines (88 loc) · 3.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Collections.Immutable;
using System.Diagnostics;
using System.Threading;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.Symbols
{
/// <summary>
/// A base class for synthesized methods that might want a this parameter.
/// </summary>
internal abstract class SynthesizedMethodSymbol : MethodSymbol
{
private ParameterSymbol _lazyThisParameter;
public override ImmutableArray<SyntaxReference> DeclaringSyntaxReferences
{
get
{
return ImmutableArray<SyntaxReference>.Empty;
}
}
public sealed override bool IsImplicitlyDeclared
{
get
{
return true;
}
}
public sealed override bool AreLocalsZeroed
{
get
{
return ContainingType.AreLocalsZeroed;
}
}
public abstract override bool IsStatic { get; }
#nullable enable
internal override bool TryGetThisParameter(out ParameterSymbol? thisParameter)
{
Debug.Assert(!this.IsExtensionBlockMember());
if (IsStatic)
{
thisParameter = null;
return true;
}
if ((object)_lazyThisParameter == null)
{
Interlocked.CompareExchange(ref _lazyThisParameter, new ThisParameterSymbol(this), null);
}
thisParameter = _lazyThisParameter;
return true;
}
#nullable disable
/// <summary>
/// Returns data decoded from Obsolete attribute or null if there is no Obsolete attribute.
/// This property returns ObsoleteAttributeData.Uninitialized if attribute arguments haven't been decoded yet.
/// </summary>
internal sealed override ObsoleteAttributeData ObsoleteAttributeData
{
get { return null; }
}
internal sealed override UnmanagedCallersOnlyAttributeData GetUnmanagedCallersOnlyAttributeData(bool forceComplete) => null;
internal sealed override bool HasSpecialNameAttribute => throw ExceptionUtilities.Unreachable();
internal override int CalculateLocalSyntaxOffset(int localPosition, SyntaxTree localTree)
{
throw ExceptionUtilities.Unreachable();
}
internal override bool IsDeclaredReadOnly => false;
internal override bool IsInitOnly => false;
public sealed override FlowAnalysisAnnotations FlowAnalysisAnnotations => FlowAnalysisAnnotations.None;
internal override ThreeState RuntimeAsyncMethodGenerationAttributeSetting => ThreeState.Unknown;
internal override bool IsNullableAnalysisEnabled() => false;
internal sealed override bool HasUnscopedRefAttribute => false;
internal sealed override bool UseUpdatedEscapeRules => ContainingModule.UseUpdatedEscapeRules;
internal sealed override CallerUnsafeMode CallerUnsafeMode => CallerUnsafeMode.None;
internal sealed override bool HasAsyncMethodBuilderAttribute(out TypeSymbol builderArgument)
{
builderArgument = null;
return false;
}
internal sealed override int TryGetOverloadResolutionPriority()
{
return 0;
}
}
}