71 references to ValueUsageInfo
Microsoft.CodeAnalysis.CodeStyle (71)
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (1)
246
var
valueUsageInfo = fieldReference.GetValueUsageInfo(owningSymbol);
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (21)
89
protected virtual void HandleNamedTypeSymbolStart(SymbolStartAnalysisContext context, Action<ISymbol,
ValueUsageInfo
> onSymbolUsageFound)
100
private readonly Dictionary<ISymbol,
ValueUsageInfo
> _symbolValueUsageStateMap = [];
206
Action<ISymbol,
ValueUsageInfo
> onSymbolUsageFound = OnSymbolUsage;
289
_symbolValueUsageStateMap.TryAdd(symbol,
ValueUsageInfo
.None);
299
OnSymbolUsage(method,
ValueUsageInfo
.Read);
315
OnSymbolUsage(field,
ValueUsageInfo
.Write);
320
private void OnSymbolUsage(ISymbol? memberSymbol,
ValueUsageInfo
usageInfo)
330
if (_symbolValueUsageStateMap.TryGetValue(memberSymbol, out
var
currentUsageInfo))
339
private bool TryRemove(ISymbol memberSymbol, out
ValueUsageInfo
valueUsageInfo)
360
var
valueUsageInfo = memberReference.GetValueUsageInfo(operationContext.ContainingSymbol);
362
if (valueUsageInfo ==
ValueUsageInfo
.ReadWrite)
391
valueUsageInfo =
ValueUsageInfo
.Write;
417
OnSymbolUsage(symbols.CurrentProperty,
ValueUsageInfo
.Read);
418
OnSymbolUsage(symbols.GetEnumeratorMethod,
ValueUsageInfo
.Read);
419
OnSymbolUsage(symbols.MoveNextMethod,
ValueUsageInfo
.Read);
428
OnSymbolUsage(targetMethod,
ValueUsageInfo
.Read);
433
OnSymbolUsage(targetMethod.ReducedFrom,
ValueUsageInfo
.Read);
447
OnSymbolUsage(memberReference.Member.OriginalDefinition,
ValueUsageInfo
.ReadWrite);
456
OnSymbolUsage(symbol.OriginalDefinition,
ValueUsageInfo
.ReadWrite);
465
OnSymbolUsage(constructor,
ValueUsageInfo
.Read);
502
if (TryRemove(member, out
var
valueUsageInfo) && !valueUsageInfo.IsReadFrom())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (31)
24
/// Returns the <see cref="
ValueUsageInfo
"/> for the given operation.
27
public static
ValueUsageInfo
GetValueUsageInfo(this IOperation operation, ISymbol containingSymbol)
56
return
ValueUsageInfo
.Write;
77
return
ValueUsageInfo
.Write;
88
return
ValueUsageInfo
.Write;
98
return
ValueUsageInfo
.Write;
106
return
ValueUsageInfo
.Write;
114
return
ValueUsageInfo
.Write;
120
return
ValueUsageInfo
.ReadWrite;
125
return
ValueUsageInfo
.Write;
132
?
ValueUsageInfo
.ReadWrite
133
:
ValueUsageInfo
.Write;
139
return
ValueUsageInfo
.ReadableWritableReference;
143
return
ValueUsageInfo
.ReadWrite;
151
~(
ValueUsageInfo
.Write |
ValueUsageInfo
.Reference);
157
return
ValueUsageInfo
.Name;
164
return
ValueUsageInfo
.ReadableReference;
167
return
ValueUsageInfo
.WritableReference;
170
return
ValueUsageInfo
.ReadableWritableReference;
173
return
ValueUsageInfo
.Read;
180
RefKind.RefReadOnly =>
ValueUsageInfo
.ReadableReference,
181
RefKind.Ref =>
ValueUsageInfo
.ReadableWritableReference,
182
_ =>
ValueUsageInfo
.Read,
194
return
ValueUsageInfo
.Read;
201
?
ValueUsageInfo
.ReadWrite
202
:
ValueUsageInfo
.Write;
210
return
ValueUsageInfo
.Write;
219
return
ValueUsageInfo
.ReadableWritableReference;
222
return
ValueUsageInfo
.ReadableReference;
227
return
ValueUsageInfo
.Read;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SymbolUsageInfo.cs (5)
15
/// For methods, fields, properties, events, locals and parameters, this corresponds to values from <see cref="
ValueUsageInfo
"/>.
20
public static readonly SymbolUsageInfo None = Create(
ValueUsageInfo
.None);
23
public
ValueUsageInfo
? ValueUsageInfoOpt { get; }
29
public SymbolUsageInfo(
ValueUsageInfo
? valueUsageInfoOpt, TypeOrNamespaceUsageInfo? typeOrNamespaceUsageInfoOpt)
37
public static SymbolUsageInfo Create(
ValueUsageInfo
valueUsageInfo)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ValueUsageInfo.cs (8)
69
public static bool IsReadFrom(this
ValueUsageInfo
valueUsageInfo)
70
=> (valueUsageInfo &
ValueUsageInfo
.Read) != 0;
72
public static bool IsWrittenTo(this
ValueUsageInfo
valueUsageInfo)
73
=> (valueUsageInfo &
ValueUsageInfo
.Write) != 0;
75
public static bool IsNameOnly(this
ValueUsageInfo
valueUsageInfo)
76
=> (valueUsageInfo &
ValueUsageInfo
.Name) != 0;
78
public static bool IsReference(this
ValueUsageInfo
valueUsageInfo)
79
=> (valueUsageInfo &
ValueUsageInfo
.Reference) != 0;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (5)
94
private void OnWriteReferenceFound(ISymbol symbol, IOperation operation,
ValueUsageInfo
valueUsageInfo)
97
var isRef = valueUsageInfo ==
ValueUsageInfo
.ReadableWritableReference;
112
var
valueUsageInfo = operation.GetValueUsageInfo(_currentContainingSymbol);
199
OnWriteReferenceFound(symbolOpt, write,
ValueUsageInfo
.Write);
275
OnWriteReferenceFound(operation.Symbol, operation,
ValueUsageInfo
.Write);