2768 references to RefKind
Microsoft.CodeAnalysis (49)
Compilation\Compilation.cs (5)
1093/// * <see cref="RefKind.Out"/> is passed as the returnRefKind. 1101RefKind returnRefKind, 1103ImmutableArray<RefKind> parameterRefKinds, 1112RefKind returnRefKind, 1114ImmutableArray<RefKind> parameterRefKinds,
DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (1)
796if ((symbol.RefKind == RefKind.None) == parameterInfo.IsRefOrOut)
DocumentationCommentId.cs (2)
458if (p.RefKind != RefKind.None) 1358if ((symbol.RefKind == RefKind.None) == parameterInfo.IsRefOrOut)
Operations\ControlFlowGraphBuilder.cs (2)
4566return new SimpleAssignmentOperation(isRef: local.RefKind != RefKind.None, 6587Debug.Assert(outParameterArgument is { Parameter: { RefKind: RefKind.Out, Type.SpecialType: SpecialType.System_Boolean } });
Operations\OperationExtensions.cs (14)
250/// Get an optional argument <see cref="RefKind"/> for an argument at the given <paramref name="index"/> to the given <paramref name="dynamicOperation"/>. 251/// Returns a non-null argument <see cref="RefKind"/> for C#. 252/// Always returns null for VB as <see cref="RefKind"/> cannot be specified for an argument in VB. 256public static RefKind? GetArgumentRefKind(this IDynamicInvocationOperation dynamicOperation, int index) 267/// Get an optional argument <see cref="RefKind"/> for an argument at the given <paramref name="index"/> to the given <paramref name="dynamicOperation"/>. 268/// Returns a non-null argument <see cref="RefKind"/> for C#. 269/// Always returns null for VB as <see cref="RefKind"/> cannot be specified for an argument in VB. 273public static RefKind? GetArgumentRefKind(this IDynamicIndexerAccessOperation dynamicOperation, int index) 284/// Get an optional argument <see cref="RefKind"/> for an argument at the given <paramref name="index"/> to the given <paramref name="dynamicOperation"/>. 285/// Returns a non-null argument <see cref="RefKind"/> for C#. 286/// Always returns null for VB as <see cref="RefKind"/> cannot be specified for an argument in VB. 290public static RefKind? GetArgumentRefKind(this IDynamicObjectCreationOperation dynamicOperation, int index) 300internal static RefKind? GetArgumentRefKind(this HasDynamicArgumentsExpression dynamicOperation, int index) 322return RefKind.None;
Operations\OperationNodes.cs (5)
235protected HasDynamicArgumentsExpression(ImmutableArray<IOperation> arguments, ImmutableArray<string> argumentNames, ImmutableArray<RefKind> argumentRefKinds, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) : 245public ImmutableArray<RefKind> ArgumentRefKinds { get; } 252public DynamicObjectCreationOperation(IObjectOrCollectionInitializerOperation? initializer, ImmutableArray<IOperation> arguments, ImmutableArray<string> argumentNames, ImmutableArray<RefKind> argumentRefKinds, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) : 334public DynamicInvocationOperation(IOperation operation, ImmutableArray<IOperation> arguments, ImmutableArray<string> argumentNames, ImmutableArray<RefKind> argumentRefKinds, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) : 416public DynamicIndexerAccessOperation(IOperation operation, ImmutableArray<IOperation> arguments, ImmutableArray<string> argumentNames, ImmutableArray<RefKind> argumentRefKinds, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) :
Symbols\IFieldSymbol.cs (1)
67RefKind RefKind { get; }
Symbols\ILocalSymbol.cs (1)
41RefKind RefKind { get; }
Symbols\IMethodSymbol.cs (1)
89RefKind RefKind { get; }
Symbols\IParameterSymbol.cs (1)
23RefKind RefKind { get; }
Symbols\IPropertySymbol.cs (1)
58RefKind RefKind { get; }
Symbols\RefKind.cs (15)
47internal static string ToParameterDisplayString(this RefKind kind) 51case RefKind.Out: return "out"; 52case RefKind.Ref: return "ref"; 53case RefKind.In: return "in"; 58internal static string ToArgumentDisplayString(this RefKind kind) 62case RefKind.Out: return "out"; 63case RefKind.Ref: return "ref"; 64case RefKind.In: return "in"; 69internal static string ToParameterPrefix(this RefKind kind) 73case RefKind.Out: return "out "; 74case RefKind.Ref: return "ref "; 75case RefKind.In: return "in "; 76case RefKind.None: return string.Empty; 86internal const RefKind StrictIn = RefKind.In + 1;
Microsoft.CodeAnalysis.CodeStyle (33)
AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (2)
507case RefKind.Out: 514case RefKind.Ref:
IParameterSymbolExtensions.cs (2)
15case RefKind.Ref: 16case RefKind.Out:
ISymbolExtensions.cs (1)
434if (symbol is IMethodSymbol method && method.Parameters.All(p => p.RefKind == RefKind.None))
ISyntaxFacts.cs (1)
312RefKind GetRefKindOfArgument(SyntaxNode node);
OperationExtensions.cs (9)
157case RefKind.RefReadOnly: 160case RefKind.Out: 163case RefKind.Ref: 174RefKind.RefReadOnly => ValueUsageInfo.ReadableReference, 175RefKind.Ref => ValueUsageInfo.ReadableWritableReference, 212case RefKind.Ref: 215case RefKind.RefReadOnly: 224public static RefKind GetRefKind(this IReturnOperation? operation, ISymbol containingSymbol) 227return containingMethod?.RefKind ?? RefKind.None;
SuppressMessageAttributeState.TargetSymbolResolver.cs (1)
796if ((symbol.RefKind == RefKind.None) == parameterInfo.IsRefOrOut)
SymbolEquivalenceComparer.ParameterSymbolEqualityComparer.cs (4)
81public static bool AreRefKindsEquivalent(RefKind rk1, RefKind rk2, bool distinguishRefFromOut) 85: (rk1 == RefKind.None) == (rk2 == RefKind.None);
SymbolKey.cs (1)
280PooledArrayBuilder<RefKind> refKinds)
SymbolKey.FunctionPointerTypeSymbolKey.cs (1)
55var returnRefKind = reader.ReadRefKind();
SymbolKey.SymbolKeyReader.cs (5)
31private readonly ReadFunction<RefKind> _readRefKind; 190public PooledArrayBuilder<RefKind> ReadRefKindArray() 229public RefKind ReadRefKind() 232public RefKind ReadRefKind(out string? failureReason) 235return (RefKind)ReadInteger();
SymbolKey.SymbolKeyWriter.cs (1)
318internal void WriteRefKind(RefKind refKind) => WriteInteger((int)refKind);
SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (2)
441if (parameter.RefKind is RefKind.Ref or RefKind.Out)
UseCompoundAssignmentUtilities.cs (1)
133if (property.RefKind == RefKind.None)
UseConditionalExpressionForReturnHelpers.cs (2)
81syntaxFacts, anyReturn.GetRefKind(containingSymbol) != RefKind.None, 122isRef = anyReturn.GetRefKind(containingSymbol) != RefKind.None;
Microsoft.CodeAnalysis.CodeStyle.Fixes (33)
AbstractAddParameterCodeFixProvider.cs (2)
391private async Task<(ITypeSymbol, RefKind)> GetArgumentTypeAndRefKindAsync(Document invocationDocument, TArgumentSyntax argument, CancellationToken cancellationToken) 396var refKind = syntaxFacts.GetRefKindOfArgument(argument);
AddParameterService.cs (2)
77RefKind refKind, 162RefKind refKind,
CodeGenerationAbstractMethodSymbol.cs (1)
45public abstract RefKind RefKind { get; }
CodeGenerationConstructedMethodSymbol.cs (1)
37public override RefKind RefKind => _constructedFrom.RefKind;
CodeGenerationConstructorSymbol.cs (1)
30refKind: RefKind.None,
CodeGenerationConversionSymbol.cs (1)
34refKind: RefKind.None,
CodeGenerationDestructorSymbol.cs (1)
21refKind: RefKind.None,
CodeGenerationFieldSymbol.cs (2)
92public RefKind RefKind => RefKind.None;
CodeGenerationMethodSymbol.cs (4)
33RefKind refKind, 86return RefKind == RefKind.Ref; 94return RefKind == RefKind.RefReadOnly; 98public override RefKind RefKind { get; }
CodeGenerationOperatorSymbol.cs (1)
35refKind: RefKind.None,
CodeGenerationParameterSymbol.cs (2)
19public RefKind RefKind { get; } 32RefKind refKind,
CodeGenerationPropertySymbol.cs (5)
19private readonly RefKind _refKind; 36RefKind refKind, 88public RefKind RefKind => _refKind; 90public bool ReturnsByRef => _refKind == RefKind.Ref; 92public bool ReturnsByRefReadonly => _refKind == RefKind.RefReadOnly;
CodeGenerationSymbolFactory.cs (10)
53RefKind refKind, 84ITypeSymbol type, RefKind refKind, ImmutableArray<IPropertySymbol> explicitInterfaceImplementations, string name, 157RefKind refKind, 179RefKind refKind, 269=> CreateParameterSymbol(RefKind.None, type, name); 271public static IParameterSymbol CreateParameterSymbol(RefKind refKind, ITypeSymbol type, string name) 281ImmutableArray<AttributeData> attributes, RefKind refKind, bool isParams, ITypeSymbol type, string name, bool isOptional = false, bool hasDefaultValue = false, object? defaultValue = null) 292RefKind? refKind = null, 394refKind: RefKind.None, 466RefKind refKind,
Microsoft.CodeAnalysis.CSharp (1540)
Binder\Binder.IdentifierUsedAsValueFinder.cs (2)
180unboundLambda.HasExplicitReturnType(out RefKind refKind, out TypeWithAnnotations returnType); 187ImmutableArray<RefKind>.Empty,
Binder\Binder.QueryUnboundLambdaState.cs (3)
38public override bool HasExplicitReturnType(out RefKind refKind, out TypeWithAnnotations returnType) 50public override RefKind RefKind(int index) { return Microsoft.CodeAnalysis.RefKind.None; }
Binder\Binder.ValueChecks.cs (88)
91internal RefKind RefKind { get; } 93internal EscapeArgument(ParameterSymbol? parameter, BoundExpression argument, RefKind refKind, bool isArgList = false) 101public void Deconstruct(out ParameterSymbol? parameter, out BoundExpression argument, out RefKind refKind) 327ArrayBuilder<RefKind>? refKindsBuilderOpt; 330refKindsBuilderOpt = ArrayBuilder<RefKind>.GetInstance(accessorForDefaultArguments.ParameterCount); 839if (localSymbol.RefKind == RefKind.RefReadOnly || 840(localSymbol.RefKind == RefKind.None && !localSymbol.IsWritableVariable)) 848if (localSymbol.RefKind == RefKind.None) 880if (localSymbol.RefKind == RefKind.None) 923if (parameterSymbol.RefKind == RefKind.In && RequiresAssignableVariable(valueKind)) 928else if (parameterSymbol.RefKind == RefKind.None && RequiresRefAssignableVariable(valueKind)) 934Debug.Assert(parameterSymbol.RefKind != RefKind.None || !RequiresRefAssignableVariable(valueKind)); 938if (parameterSymbol.RefKind == RefKind.None && 942Debug.Assert(backingField.RefKind == RefKind.None); 947Debug.Assert(backingField.RefKind == RefKind.None); 1037{ RefKind: RefKind.Out, UseUpdatedEscapeRules: true } => ReturnOnlyScope, 1049{ RefKind: RefKind.None } => CurrentMethodScope, 1051{ HasUnscopedRefAttribute: true, RefKind: RefKind.Out } => ReturnOnlyScope, 1085Debug.Assert(parameterSymbol.RefKind == RefKind.None || isRefScoped || refSafeToEscape == ReturnOnlyScope); 1135if ((fieldSymbol.RefKind == RefKind.None ? RequiresAssignableVariable(valueKind) : RequiresRefAssignableVariable(valueKind)) && 1147case RefKind.None: 1149case RefKind.Ref: 1151case RefKind.RefReadOnly: 1172case RefKind.None: 1175case RefKind.Ref: 1176case RefKind.RefReadOnly: 1275if (fieldSymbol.RefKind != RefKind.None) 1299if (fieldSymbol.RefKind != RefKind.None) 1435if (RequiresVariable(valueKind) && methodSymbol.RefKind == RefKind.None) 1450if (RequiresAssignableVariable(valueKind) && methodSymbol.RefKind == RefKind.RefReadOnly) 1481propertySymbol.RefKind == RefKind.None) 1505if (RequiresAssignableVariable(valueKind) && propertySymbol.RefKind == RefKind.RefReadOnly) 1511var requiresSet = RequiresAssignableVariable(valueKind) && propertySymbol.RefKind == RefKind.None; 1580var requiresGet = !RequiresAssignmentOnly(valueKind) || propertySymbol.RefKind != RefKind.None; 1742ImmutableArray<RefKind> argRefKindsOpt, 1803var argEscape = effectiveRefKind != RefKind.None && isRefEscape ? 1835ImmutableArray<RefKind> argRefKindsOpt, 1863|| (param is null or { RefKind: not RefKind.None, Type.IsRefLikeType: true } && isArgumentRefEscape == isRefEscape)) 1892return method is { RefKind: not RefKind.None, ReturnType.IsRefLikeType: true }; 1909ImmutableArray<RefKind> argRefKindsOpt, 1964var valid = effectiveRefKind != RefKind.None && isRefEscape ? 1995ImmutableArray<RefKind> argRefKindsOpt, 2025|| (param is null or { RefKind: not RefKind.None, Type.IsRefLikeType: true } && isArgumentRefEscape == isRefEscape)) 2062ImmutableArray<RefKind> argRefKindsOpt, 2133var refKind = parameter?.RefKind ?? RefKind.None; 2138if (refKind == RefKind.None && 2139parameter?.RefKind == RefKind.In) 2141refKind = RefKind.In; 2170return new EscapeArgument(parameter: null, receiver, RefKind.None); 2173var refKind = RefKind.None; 2187ImmutableArray<RefKind> argRefKindsOpt, 2194var refKind = argRefKindsOpt.IsDefault ? RefKind.None : argRefKindsOpt[argIndex]; 2197if (refKind == RefKind.Ref && mixableArguments is not null) 2216ImmutableArray<RefKind> argRefKindsOpt, 2292ImmutableArray<RefKind> argRefKindsOpt, 2321if (refKind != RefKind.None) 2334if (parameter.Type.IsRefLikeType && parameter.RefKind != RefKind.Out && GetParameterValEscapeLevel(parameter) is { } valEscapeLevel) 2341if (parameter.RefKind != RefKind.None && GetParameterRefEscapeLevel(parameter) is { } refEscapeLevel) 2422ImmutableArray<RefKind> argRefKindsOpt, 2524ImmutableArray<RefKind> argRefKindsOpt, 2821Debug.Assert(field.RefKind == RefKind.None ? RequiresAssignableVariable(kind) : RequiresRefAssignableVariable(kind)); 3014if (methodSymbol.RefKind == RefKind.None) 3035if (methodSymbol.RefKind == RefKind.None) 3093if (methodSymbol.RefKind == RefKind.None) 3259if (methodSymbol.RefKind == RefKind.None) 3284if (indexerSymbol.RefKind == RefKind.None) 3314if (indexerSymbol.RefKind == RefKind.None) 3339if (methodSymbol.RefKind == RefKind.None) 3367if (signature.RefKind == RefKind.None) 3390if (propertySymbol.RefKind == RefKind.None) 4630((BoundParameter)expression).ParameterSymbol.RefKind != RefKind.In; 4636return !((CodeGenerator.IsStackLocal(local, stackLocalsOpt) && local.RefKind == RefKind.None) || 4637(!IsAnyReadOnly(addressKind) && local.RefKind == RefKind.RefReadOnly)); 4640var methodRefKind = ((BoundCall)expression).Method.RefKind; 4641return methodRefKind == RefKind.Ref || 4642(IsAnyReadOnly(addressKind) && methodRefKind == RefKind.RefReadOnly); 4646var dupRefKind = ((BoundDup)expression).RefKind; 4647return dupRefKind == RefKind.Ref || 4648(IsAnyReadOnly(addressKind) && dupRefKind == RefKind.RefReadOnly); 4662var lhsRefKind = assignment.Left.GetRefKind(); 4663return lhsRefKind == RefKind.Ref || 4664(IsAnyReadOnly(addressKind) && lhsRefKind == RefKind.RefReadOnly); 4730if (field.RefKind is RefKind.Ref) 4753if (field.RefKind == RefKind.RefReadOnly) 4758Debug.Assert(field.RefKind == RefKind.None);
Binder\Binder_AnonymousTypes.cs (1)
96RefKind.None,
Binder\Binder_Attributes.cs (3)
239if (attributeConstructor.Parameters.Any(static p => p.RefKind == RefKind.In)) 471BindArgumentExpression(diagnostics, argument.Expression, RefKind.None, allowArglist: false), 473refKind: RefKind.None);
Binder\Binder_Conversions.cs (4)
1348{ RefKind: RefKind.None, ReturnsVoid: true } => method.ReturnsVoid, 1384RefKind sourceRefKind, RefKind destinationRefKind, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 1391if (sourceRefKind != RefKind.None)
Binder\Binder_Crefs.cs (3)
794refKind: RefKind.None, 811refKind: RefKind.None, 935RefKind refKind = parameter.RefKindKeyword.Kind().GetRefKind();
Binder\Binder_Deconstruct.cs (2)
647analyzedArguments.RefKinds.Add(RefKind.Out); 687if (parameters[i].RefKind != RefKind.Out)
Binder\Binder_Expressions.cs (47)
447RefKind refKind, 1777private bool IsBadLocalOrParameterCapture(Symbol symbol, TypeSymbol type, RefKind refKind) 1779if (refKind != RefKind.None || type.IsRefLikeType) 1942(parameter.RefKind != RefKind.None || parameter.Type.IsRefLikeType) && 1947else if (primaryCtor is { ThisParameter.RefKind: not RefKind.None } && 2284if ((object)thisSymbol != null && thisSymbol.ContainingSymbol != ContainingMemberOrLambda && thisSymbol.RefKind != RefKind.None) 2832RefKind origRefKind = argumentSyntax.RefOrOutKeyword.Kind().GetRefKind(); 2836RefKind refKind = origRefKind == RefKind.None || RefMustBeObeyed(isDelegateCreation, argumentSyntax) ? origRefKind : RefKind.None; 2849if (!hadError && isDelegateCreation && origRefKind != RefKind.None && result.Arguments.Count == 1) 2856var requiredValueKind = origRefKind == RefKind.In ? BindValueKind.ReadonlyRef : BindValueKind.RefOrOut; 2868private BoundExpression BindArgumentValue(BindingDiagnosticBag diagnostics, ArgumentSyntax argumentSyntax, bool allowArglist, RefKind refKind) 3067RefKind refKind) 3075if (refKind != RefKind.None) 3085result.RefKinds.Add(RefKind.None); 3133private BoundExpression BindArgumentExpression(BindingDiagnosticBag diagnostics, ExpressionSyntax argumentExpression, RefKind refKind, bool allowArglist) 3136refKind == RefKind.None ? 3138refKind == RefKind.In ? 4282if (analyzedArguments.RefKind(i) is (RefKind.Ref or RefKind.Out)) 4696ArrayBuilder<RefKind> refKinds, 4887var rhsExpr = initializer.Right.CheckAndUnwrapRefExpression(diagnostics, out RefKind refKind); 4888bool isRef = refKind == RefKind.Ref; 5006ImmutableArray<RefKind> argumentRefKindsOpt = default; 7142extensionMethodArguments.RefKinds.Add(RefKind.None); 7276RefKind returnRefKind, 7523fieldSymbol.RefKind != RefKind.None) 8229RefKind refKind = analyzedArguments.RefKind(i); 8230if (refKind != RefKind.None) 8329default(ImmutableArray<RefKind>), 8424ImmutableArray<RefKind> argumentRefKinds = analyzedArguments.RefKinds.ToImmutableOrNull(); 8675original.Parameters[0] is { Type.SpecialType: SpecialType.System_Int32, RefKind: RefKind.None }) 8732original.Parameters[0] is { Type.SpecialType: SpecialType.System_Int32, RefKind: RefKind.None } && 8733original.Parameters[1] is { Type.SpecialType: SpecialType.System_Int32, RefKind: RefKind.None }) 8832getMethod.RefKind == RefKind.None && 8877RefKind returnRefKind = default, 8897RefKind returnRefKind = default, 8925RefKind returnRefKind, 8951RefKind returnRefKind = default, 9023RefKind returnRefKind = default, 9187RefKind? returnRefKindOverride = null, 9194var returnRefKind = returnRefKindOverride ?? methodSymbol.RefKind; 9213if (returnsVoid && returnRefKind != RefKind.None) 9227returnRefKind == RefKind.None && 9229(parameterRefKinds.IsDefault || parameterRefKinds.All(refKind => refKind == RefKind.None)) && 9263parameterRefKinds.IsDefault ? RefKind.None : parameterRefKinds[i],
Binder\Binder_InterpolatedString.cs (11)
414ImmutableArray<RefKind> additionalConstructorRefKinds = default) 434ImmutableArray<RefKind> additionalConstructorRefKinds = default) 460ImmutableArray<RefKind> additionalConstructorRefKinds) 493ImmutableArray<RefKind> additionalConstructorRefKinds) 569var refKindsBuilder = ArrayBuilder<RefKind>.GetInstance(constructorArgumentLength); 570refKindsBuilder.Add(RefKind.None); 571refKindsBuilder.Add(RefKind.None); 581refKindsBuilder.Add(RefKind.Out); 945var argumentRefKindsBuilder = ArrayBuilder<RefKind>.GetInstance(handlerArgumentIndexes.Length); 955RefKind refKind; 961refKind = RefKind.None;
Binder\Binder_Invocation.cs (12)
221else if (analyzedArguments.RefKind(i) == RefKind.None) 228case RefKind.None: 229case RefKind.Ref: 240ImmutableArray<RefKind> refKinds = analyzedArguments.RefKinds.ToImmutableOrNull(); 446ImmutableArray<RefKind> refKinds, 457if (refKinds[argIndex] == RefKind.In) 1054if (receiverParameter.RefKind == RefKind.Ref) 1067analyzedArguments.RefKinds[0] = RefKind.Ref; 1070else if (receiverParameter.RefKind == RefKind.In) 1073Debug.Assert(analyzedArguments.RefKind(0) == RefKind.None); 1268ArrayBuilder<RefKind>? argumentRefKindsBuilder, 1331argumentRefKindsBuilder.Add(RefKind.None);
Binder\Binder_Lambda.cs (9)
44ImmutableArray<RefKind> refKinds = default; 48RefKind returnRefKind = RefKind.None; 123var refKindsBuilder = ArrayBuilder<RefKind>.GetInstance(); 170var refKind = RefKind.None; 212if (refKindsBuilder.Any(r => r != RefKind.None)) 282private (RefKind, TypeWithAnnotations) BindExplicitLambdaReturnType(TypeSyntax syntax, BindingDiagnosticBag diagnostics) 287syntax = syntax.SkipScoped(out _).SkipRefInLocalOrReturn(diagnostics, out RefKind refKind);
Binder\Binder_Operators.cs (8)
2601if (parameterSymbol.RefKind != RefKind.None) 2632return localSymbol.RefKind != RefKind.None; 4195var whenTrue = node.WhenTrue.CheckAndUnwrapRefExpression(diagnostics, out var whenTrueRefKind); 4196var whenFalse = node.WhenFalse.CheckAndUnwrapRefExpression(diagnostics, out var whenFalseRefKind); 4198var isRef = whenTrueRefKind == RefKind.Ref && whenFalseRefKind == RefKind.Ref; 4201if (whenFalseRefKind == RefKind.Ref) 4206if (whenTrueRefKind == RefKind.Ref)
Binder\Binder_Query.cs (3)
695return lambdaBodyBinder.CreateBlockFromExpression(node, ImmutableArray<LocalSymbol>.Empty, RefKind.None, construction, null, d); 775return this.CreateBlockFromExpression(expression, locals, RefKind.None, result, expression, diagnostics); 817new AnonymousTypeField(fieldName, fieldValue.Syntax.Location, TypeWithAnnotations.Create(TypeOrError(fieldValue)), RefKind.None, ScopedKind.None);
Binder\Binder_Statements.cs (48)
864internal BoundExpression BindInferredVariableInitializer(BindingDiagnosticBag diagnostics, RefKind refKind, EqualsValueClauseSyntax initializer, 913RefKind variableRefKind, 918RefKind expressionRefKind = RefKind.None; 920if (variableRefKind == RefKind.None) 923if (expressionRefKind == RefKind.Ref) 931valueKind = variableRefKind == RefKind.RefReadOnly 940else if (expressionRefKind != RefKind.Ref) 1001if (localSymbol.RefKind != RefKind.None) 1067localSymbol.RefKind != RefKind.None ? ConversionForAssignmentFlags.RefAssignment : ConversionForAssignmentFlags.None); 1424var rhsExpr = node.Right.CheckAndUnwrapRefExpression(diagnostics, out var refKind); 1425var isRef = refKind == RefKind.Ref; 1454var lhsRefKind = boundLeft.GetRefKind(); 1455if (lhsRefKind is RefKind.Ref or RefKind.Out) 2110var delegateRefKind = delegateParameters[i].RefKind; 2111if (delegateRefKind != RefKind.None) 2151var lambdaRefKind = anonymousFunction.RefKind(i); 2153var delegateRefKind = delegateParameters[i].RefKind; 2165if (delegateRefKind == RefKind.None) 2865protected virtual TypeSymbol GetCurrentReturnType(out RefKind refKind) 2882refKind = RefKind.None; 2888var refKind = RefKind.None; 2906RefKind sigRefKind; 2917if (refKind != RefKind.None) 2929else if ((object)retType != null && (refKind != RefKind.None) != (sigRefKind != RefKind.None)) 2931var errorCode = refKind != RefKind.None 3029RefKind returnRefKind, 3039Debug.Assert(returnRefKind == RefKind.None); 3061if (returnRefKind != RefKind.None) 3077RefKind unusedRefKind; 3345internal BoundBlock CreateBlockFromExpression(CSharpSyntaxNode node, ImmutableArray<LocalSymbol> locals, RefKind refKind, BoundExpression expression, ExpressionSyntax expressionSyntax, BindingDiagnosticBag diagnostics) 3347RefKind returnRefKind; 3352if (IsInAsyncMethod() && refKind != RefKind.None) 3361if ((refKind != RefKind.None) != (returnRefKind != RefKind.None) && expression.Kind != BoundKind.ThrowExpression) 3363var errorCode = refKind != RefKind.None 3368statement = new BoundReturnStatement(syntax, RefKind.None, expression, @checked: CheckOverflowAtRuntime) { WasCompilerGenerated = true }; 3472RefKind refKind; 3488RefKind refKind; 3501return bodyBinder.CreateBlockFromExpression(body, bodyBinder.GetDeclaredLocalsForScope(body), RefKind.None, expression, body, diagnostics); 3504private BindValueKind GetRequiredReturnValueKind(RefKind refKind) 3507if (refKind != RefKind.None) 3509GetCurrentReturnType(out var sigRefKind); 3510requiredValueKind = sigRefKind == RefKind.Ref ? 3865argumentRefKindsOpt: ImmutableArray<RefKind>.Empty,
Binder\ExecutableCodeBinder.cs (3)
112if (parameter.RefKind != RefKind.None) 136RefKind refKind = iterator.RefKind; 141if (refKind != RefKind.None)
Binder\ForEachLoopBinder.cs (7)
229if (getEnumeratorMethod.ParameterRefKinds is { IsDefault: false } refKinds && refKinds[0] == RefKind.Ref) 308if (local.RefKind != RefKind.None) 321case RefKind.None: 324case RefKind.Ref: 327case RefKind.RefReadOnly: 449if (elementConversionClassification.Kind != ConversionKind.Identity && IterationVariable.RefKind is RefKind.Ref or RefKind.RefReadOnly)
Binder\InMethodBinder.cs (5)
127RefKind refKind = _methodSymbol.RefKind; 146RefKind refKind, TypeSymbol returnType, Location errorLocation, BindingDiagnosticBag diagnostics) 148if (refKind == RefKind.None && returnType.Kind == SymbolKind.NamedType) 177internal static bool IsAsyncStreamInterface(CSharpCompilation compilation, RefKind refKind, TypeSymbol returnType) 179if (refKind == RefKind.None && returnType.Kind == SymbolKind.NamedType)
Binder\RefSafetyAnalysis.cs (5)
258ValidateEscape(value, CallingMethodScope, isByRef: field.RefKind != RefKind.None, _diagnostics); 436Debug.Assert(localSymbol.RefKind == RefKind.None || 450if (localSymbol.RefKind != RefKind.None) 467ValidateEscape(expr, ReturnOnlyScope, node.RefKind != RefKind.None, _diagnostics); 861AddLocalScopes(local, refEscapeScope: local.RefKind == RefKind.None ? _localScopeDepth : collectionEscape, valEscapeScope: collectionEscape);
Binder\Semantics\Conversions\ConversionsBase.cs (5)
1410if (anonymousFunction.HasExplicitReturnType(out var refKind, out var returnType)) 1451if (delegateParameters[p].RefKind != RefKind.None) 1493if (delegateParameters[p].RefKind == RefKind.Out) 3186bool hasConversion(RefKind refKind, TypeWithAnnotations sourceType, TypeWithAnnotations destinationType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 3190case RefKind.None:
Binder\Semantics\Operators\BinaryOperatorOverloadResolution.cs (8)
1251if (op1.LeftRefKind == RefKind.None && op2.LeftRefKind == RefKind.In) 1255else if (op2.LeftRefKind == RefKind.None && op1.LeftRefKind == RefKind.In) 1264if (op1.RightRefKind == RefKind.None && op2.RightRefKind == RefKind.In) 1275else if (op2.RightRefKind == RefKind.None && op1.RightRefKind == RefKind.In)
Binder\Semantics\Operators\BinaryOperatorSignature.cs (4)
92public RefKind LeftRefKind 108return RefKind.None; 112public RefKind RightRefKind 128return RefKind.None;
Binder\Semantics\Operators\UnaryOperatorOverloadResolution.cs (4)
227if (op1.RefKind == RefKind.None && op2.RefKind == RefKind.In) 231else if (op2.RefKind == RefKind.None && op1.RefKind == RefKind.In)
Binder\Semantics\Operators\UnaryOperatorSignature.cs (2)
46public RefKind RefKind 62return RefKind.None;
Binder\Semantics\OverloadResolution\AnalyzedArguments.cs (6)
17public readonly ArrayBuilder<RefKind> RefKinds; 25this.RefKinds = new ArrayBuilder<RefKind>(32); 76public RefKind RefKind(int i) 78return RefKinds.Count > 0 ? RefKinds[i] : Microsoft.CodeAnalysis.RefKind.None; 101if ((object?)argument.Type != null && argument.Type.IsDynamic() && (!hasRefKinds || RefKinds[i] == Microsoft.CodeAnalysis.RefKind.None)) 149ImmutableArray<RefKind> argumentRefKindsOpt,
Binder\Semantics\OverloadResolution\MethodTypeInference.cs (10)
136private readonly ImmutableArray<RefKind> _formalParameterRefKinds; 270ImmutableArray<RefKind> formalParameterRefKinds, // Optional; assume all value if missing. 319ImmutableArray<RefKind> formalParameterRefKinds, 422private RefKind GetRefKind(int index) 425return _formalParameterRefKinds.IsDefault ? RefKind.None : _formalParameterRefKinds[index]; 1388RefKind delegateRefKind, 2227if ((sourceParam.Type.IsReferenceType || sourceParam.Type.IsFunctionPointer()) && sourceParam.RefKind == RefKind.None) 2237if ((sourceSignature.ReturnType.IsReferenceType || sourceSignature.ReturnType.IsFunctionPointer()) && sourceSignature.RefKind == RefKind.None) 2577if ((sourceParam.Type.IsReferenceType || sourceParam.Type.IsFunctionPointer()) && sourceParam.RefKind == RefKind.None) 2587if ((sourceSignature.ReturnType.IsReferenceType || sourceSignature.ReturnType.IsFunctionPointer()) && sourceSignature.RefKind == RefKind.None)
Binder\Semantics\OverloadResolution\OverloadResolution.cs (61)
128RefKind returnRefKind = default, 168RefKind returnRefKind = default, 236RefKind returnRefKind, 619RefKind? returnRefKind, 644else if (returnRefKind == RefKind.None) 2165if (p1.RefKind == RefKind.None && isAcceptableRefMismatch(p2.RefKind, isInterpolatedStringHandlerConversion)) 2176else if (p2.RefKind == RefKind.None && isAcceptableRefMismatch(p1.RefKind, isInterpolatedStringHandlerConversion)) 2192static bool isAcceptableRefMismatch(RefKind refKind, bool isInterpolatedStringHandlerConversion) 2195RefKind.In => true, 2196RefKind.Ref when isInterpolatedStringHandlerConversion => true, 2372RefKind refKind1, 2375RefKind refKind2, 2400Debug.Assert(refKind1 == RefKind.None || refKind1 == RefKind.Ref); 2401Debug.Assert(refKind2 == RefKind.None || refKind2 == RefKind.Ref); 2405if (refKind1 == RefKind.None) 2414else if (refKind1 == RefKind.Ref) 3077ArrayBuilder<RefKind> argumentRefKinds, 3083out ImmutableArray<RefKind> parameterRefKinds) 3096internal readonly ImmutableArray<RefKind> ParameterRefKinds; 3098internal EffectiveParameters(ImmutableArray<TypeWithAnnotations> types, ImmutableArray<RefKind> refKinds) 3109ArrayBuilder<RefKind> argumentRefKinds, 3122ArrayBuilder<RefKind> argumentRefKinds, 3138ImmutableArray<RefKind> parameterRefKinds = member.GetParameterRefKinds(); 3146ArrayBuilder<RefKind> refs = null; 3160RefKind argRefKind = hasAnyRefArg ? argumentRefKinds[arg] : RefKind.None; 3161RefKind paramRefKind = GetEffectiveParameterRefKind(parameter, argRefKind, isMethodGroupConversion, allowRefOmittedArguments, binder, ref hasAnyRefOmittedArgument); 3165if (paramRefKind != RefKind.None) 3167refs = ArrayBuilder<RefKind>.GetInstance(arg, RefKind.None); 3177var refKinds = refs != null ? refs.ToImmutableAndFree() : default(ImmutableArray<RefKind>); 3181private static RefKind GetEffectiveParameterRefKind( 3183RefKind argRefKind, 3189var paramRefKind = parameter.RefKind; 3193if (!isMethodGroupConversion && argRefKind == RefKind.None && paramRefKind == RefKind.In) 3195return RefKind.None; 3201if (allowRefOmittedArguments && paramRefKind == RefKind.Ref && argRefKind == RefKind.None && !binder.InAttributeArgument) 3204return RefKind.None; 3214ArrayBuilder<RefKind> argumentRefKinds, 3226ArrayBuilder<RefKind> argumentRefKinds, 3235var refs = ArrayBuilder<RefKind>.GetInstance(); 3249var argRefKind = hasAnyRefArg ? argumentRefKinds[arg] : RefKind.None; 3250var paramRefKind = GetEffectiveParameterRefKind(parameter, argRefKind, isMethodGroupConversion, allowRefOmittedArguments, binder, ref hasAnyRefOmittedArgument); 3253if (paramRefKind != RefKind.None) 3259var refKinds = anyRef ? refs.ToImmutable() : default(ImmutableArray<RefKind>); 3661RefKind argumentRefKind = arguments.RefKind(argumentPosition); 3662RefKind parameterRefKind = parameters.ParameterRefKinds.IsDefault ? RefKind.None : parameters.ParameterRefKinds[argumentPosition]; 3667Debug.Assert(argumentRefKind == RefKind.None); 3668if (parameterRefKind == RefKind.Ref) 3679&& parameterRefKind == RefKind.Ref 3754RefKind argRefKind, 3756RefKind parRefKind, 3773(argRefKind == RefKind.None && argument.HasDynamicType()))) 3795Debug.Assert(argRefKind != RefKind.None); 3801if (argRefKind == RefKind.None || hasInterpolatedStringRefMismatch)
Binder\Semantics\OverloadResolution\OverloadResolutionResult.cs (11)
202RefKind? returnRefKind = null, 1094if (parameter.RefKind != RefKind.None) 1154RefKind refArg = arguments.RefKind(arg); 1155RefKind refParameter = parameter.RefKind; 1159Debug.Assert(refArg == RefKind.None); 1160if (refParameter == RefKind.Ref || refParameter == RefKind.In) 1213else if (refArg != refParameter && !(refArg == RefKind.None && refParameter == RefKind.In)) 1215if (refParameter == RefKind.None || refParameter == RefKind.In)
Binder\WithLambdaParametersBinder.cs (1)
47protected override TypeSymbol GetCurrentReturnType(out RefKind refKind)
BoundTree\BoundExpression.cs (1)
477ImmutableArray<RefKind> newRefKinds,
BoundTree\BoundExpressionExtensions.cs (4)
20public static RefKind GetRefKind(this BoundExpression node) 48return RefKind.None; 54EventSymbol => RefKind.None, 59return RefKind.None;
BoundTree\BoundNewT.cs (1)
15public override ImmutableArray<RefKind> ArgumentRefKindsOpt => default;
BoundTree\BoundNoPiaObjectCreationExpression.cs (1)
15public override ImmutableArray<RefKind> ArgumentRefKindsOpt => default;
BoundTree\BoundObjectCreationExpression.cs (3)
13ImmutableArray<RefKind> argumentRefKindsOpt, bool expanded, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, ConstantValue? constantValueOpt, 18public BoundObjectCreationExpression Update(MethodSymbol constructor, ImmutableArray<BoundExpression> arguments, ImmutableArray<string> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool expanded, 25ImmutableArray<string> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool expanded, ImmutableArray<int> argsToParamsOpt,
BoundTree\BoundObjectCreationExpressionBase.cs (1)
15public abstract ImmutableArray<RefKind> ArgumentRefKindsOpt { get; }
BoundTree\Constructors.cs (9)
90ImmutableArray<RefKind> argumentRefKindsOpt, 107ImmutableArray<RefKind> argumentRefKindsOpt, 123ImmutableArray<RefKind> refKinds, 203: this(syntax, constructor, ImmutableArray.Create<BoundExpression>(arguments), default(ImmutableArray<string>), default(ImmutableArray<RefKind>), false, default(ImmutableArray<int>), default(BitVector), null, null, constructor.ContainingType) 207: this(syntax, constructor, arguments, default(ImmutableArray<string>), default(ImmutableArray<RefKind>), false, default(ImmutableArray<int>), default(BitVector), null, null, constructor.ContainingType) 220ImmutableArray<RefKind> refKinds, 243ImmutableArray<RefKind> argumentRefKindsOpt, 256ImmutableArray<RefKind> argumentRefKindsOpt, 574public static BoundReturnStatement Synthesized(SyntaxNode syntax, RefKind refKind, BoundExpression expression, bool hasErrors = false)
BoundTree\UnboundLambda.cs (49)
43internal readonly RefKind RefKind; 53RefKind refKind, 171ImmutableArray<RefKind> parameterRefKinds, 172RefKind refKind) 177parameterRefKinds.IsDefault ? Enumerable.Repeat(RefKind.None, parameterTypes.Length).ToImmutableArray() : parameterRefKinds, 207RefKind refKind = RefKind.None; 210RefKind rk = returnStatement.RefKind; 211if (rk != RefKind.None) 394RefKind returnRefKind, 397ImmutableArray<RefKind> refKinds, 463public bool HasExplicitReturnType(out RefKind refKind, out TypeWithAnnotations returnType) 472public RefKind RefKind(int index) { return Data.RefKind(index); } 547public abstract bool HasExplicitReturnType(out RefKind refKind, out TypeWithAnnotations returnType); 555public abstract RefKind RefKind(int index); 618private static TypeWithAnnotations DelegateReturnTypeWithAnnotations(MethodSymbol? invokeMethod, out RefKind refKind) 622refKind = CodeAnalysis.RefKind.None; 629internal (ImmutableArray<RefKind>, ArrayBuilder<ScopedKind>, ImmutableArray<TypeWithAnnotations>, bool) CollectParameterProperties() 631var parameterRefKindsBuilder = ArrayBuilder<RefKind>.GetInstance(ParameterCount); 638var refKind = RefKind(i); 679if (!HasExplicitReturnType(out var returnRefKind, out var returnType)) 740var returnType = DelegateReturnTypeWithAnnotations(invokeMethod, out RefKind refKind); 759refKind == CodeAnalysis.RefKind.None && 779if (lambdaSymbol.RefKind == CodeAnalysis.RefKind.RefReadOnly) 845ImmutableArray<RefKind> parameterRefKinds, 846RefKind refKind) 860var returnType = DelegateReturnTypeWithAnnotations(invokeMethod, out RefKind refKind); 893ImmutableArray<RefKind> parameterRefKinds) 895bool hasExplicitReturnType = HasExplicitReturnType(out var refKind, out var returnType); 950ImmutableArray<RefKind> parameterRefKinds, 952RefKind refKind) 986public readonly ImmutableArray<RefKind> ParameterRefKinds; 989public static readonly ReturnInferenceCacheKey Empty = new ReturnInferenceCacheKey(ImmutableArray<TypeWithAnnotations>.Empty, ImmutableArray<RefKind>.Empty, null); 991private ReturnInferenceCacheKey(ImmutableArray<TypeWithAnnotations> parameterTypes, ImmutableArray<RefKind> parameterRefKinds, NamedTypeSymbol? taskLikeReturnTypeOpt) 1052out ImmutableArray<RefKind> parameterRefKinds, 1058parameterRefKinds = ImmutableArray<RefKind>.Empty; 1067var refKindsBuilder = ArrayBuilder<RefKind>.GetInstance(parameterCount); 1143?? rebind(ReallyInferReturnType(delegateType: null, ImmutableArray<TypeWithAnnotations>.Empty, ImmutableArray<RefKind>.Empty)); 1160ImmutableArray<RefKind> parameterRefKinds) 1163var refKind = inferredReturnType.RefKind; 1175refKind = CodeAnalysis.RefKind.None; 1388private readonly RefKind _returnRefKind; 1394private readonly ImmutableArray<RefKind> _parameterRefKinds; 1404RefKind returnRefKind, 1410ImmutableArray<RefKind> parameterRefKinds, 1437public override bool HasExplicitReturnType(out RefKind refKind, out TypeWithAnnotations returnType) 1498public override RefKind RefKind(int index) 1501return _parameterRefKinds.IsDefault ? Microsoft.CodeAnalysis.RefKind.None : _parameterRefKinds[index]; 1536statements[0] is BoundReturnStatement { RefKind: Microsoft.CodeAnalysis.RefKind.None, ExpressionOpt: BoundExpression expr })
CodeGen\CodeGenerator.cs (1)
169var slotConstraints = _method.RefKind == RefKind.None
CodeGen\EmitAddress.cs (11)
38Debug.Assert(((BoundDup)expression).RefKind != RefKind.None, "taking address of a stack value?"); 114var methodRefKind = call.Method.RefKind; 116if (methodRefKind == RefKind.Ref || 117(IsAnyReadOnly(addressKind) && methodRefKind == RefKind.RefReadOnly)) 127var funcPtrRefKind = funcPtrInvocation.FunctionPointer.Signature.RefKind; 128if (funcPtrRefKind == RefKind.Ref || 129(IsAnyReadOnly(addressKind) && funcPtrRefKind == RefKind.RefReadOnly)) 271if (local.RefKind != RefKind.None) 477if (parameterSymbol.RefKind == RefKind.None) 551field.RefKind == RefKind.None ? 555_builder.EmitOpCode(field.RefKind == RefKind.None ? ILOpCode.Ldflda : ILOpCode.Ldfld);
CodeGen\EmitExpression.cs (43)
698RefKind refKind = expression.ArgumentRefKindsOpt.IsDefaultOrEmpty ? RefKind.None : expression.ArgumentRefKindsOpt[i]; 703private void EmitArgument(BoundExpression argument, RefKind refKind) 707case RefKind.None: 711case RefKind.In: 765if (expression.RefKind == RefKind.None) 932private void EmitArguments(ImmutableArray<BoundExpression> arguments, ImmutableArray<ParameterSymbol> parameters, ImmutableArray<RefKind> argRefKindsOpt) 936Debug.Assert(parameters.All(p => p.RefKind == RefKind.None) || !argRefKindsOpt.IsDefault, "there are nontrivial parameters, so we must have argRefKinds"); 941RefKind argRefKind = GetArgumentRefKind(arguments, parameters, argRefKindsOpt, i); 950internal static RefKind GetArgumentRefKind(ImmutableArray<BoundExpression> arguments, ImmutableArray<ParameterSymbol> parameters, ImmutableArray<RefKind> argRefKindsOpt, int i) 952RefKind argRefKind; 961argRefKind == RefKindExtensions.StrictIn && parameters[i].RefKind == RefKind.In, 974argRefKind = RefKind.None; 1092if (!field.IsVolatile && !field.IsStatic && fieldAccess.ReceiverOpt.Type.IsVerifierValue() && field.RefKind == RefKind.None) 1104if (field.RefKind != RefKind.None) 1248return ((BoundParameter)receiver).ParameterSymbol.RefKind != RefKind.None; 1252return ((BoundLocal)receiver).LocalSymbol.RefKind != RefKind.None; 1261if (field.IsStatic || field.RefKind != RefKind.None) 1352bool isRefLocal = local.LocalSymbol.RefKind != RefKind.None; 1384if (parameter.ParameterSymbol.RefKind != RefKind.None) 1994return ((BoundLocal)receiver).LocalSymbol.RefKind != RefKind.None; 1997return ((BoundParameter)receiver).ParameterSymbol.RefKind != RefKind.None; 2000return ((BoundCall)receiver).Method.RefKind != RefKind.None; 2003return ((BoundFunctionPointerInvocation)receiver).FunctionPointer.Signature.RefKind != RefKind.None; 2006return ((BoundDup)receiver).RefKind != RefKind.None; 2416if (System.Linq.ImmutableArrayExtensions.All(ctor.Parameters, p => p.RefKind == RefKind.None) && 2540return ((BoundParameter)left).ParameterSymbol.RefKind == RefKind.None; 2545return ((BoundLocal)left).LocalSymbol.RefKind == RefKind.None; 2565if (left.FieldSymbol.RefKind != RefKind.None && 2582if (left.ParameterSymbol.RefKind != RefKind.None && 2614if (left.LocalSymbol.RefKind != RefKind.None && !assignmentOperator.IsRef) 2713Debug.Assert(left.Method.RefKind != RefKind.None); 2724Debug.Assert(left.FunctionPointer.Signature.RefKind != RefKind.None); 2776LocalDefinition temp = EmitAddress(assignmentOperator.Right, lhs.GetRefKind() == RefKind.RefReadOnly ? AddressKind.ReadOnlyStrict : AddressKind.Writeable); 2859if (local.LocalSymbol.RefKind != RefKind.None && !assignment.IsRef) 2892Debug.Assert(((BoundDup)expression).RefKind != RefKind.None); 2915Debug.Assert(((BoundCall)expression).Method.RefKind != RefKind.None); 2920Debug.Assert(((BoundFunctionPointerInvocation)expression).FunctionPointer.Signature.RefKind != RefKind.None); 3064if (field.RefKind != RefKind.None && !refAssign) 3079if (parameter.ParameterSymbol.RefKind != RefKind.None && !refAssign) 3814if (useKind == UseKind.UsedAsValue && method.RefKind != RefKind.None) 3820Debug.Assert(method.RefKind != RefKind.None);
CodeGen\EmitStatement.cs (10)
724Debug.Assert(local.RefKind == RefKind.None || local.SynthesizedKind.IsLongLived(), 840if (boundReturnStatement.RefKind == RefKind.None) 848var unexpectedTemp = this.EmitAddress(expressionOpt, this._method.RefKind == RefKind.RefReadOnly ? AddressKind.ReadOnlyStrict : AddressKind.Writeable); 1122Debug.Assert(exceptionSourceLocal.LocalSymbol.RefKind == RefKind.None); 1134Debug.Assert(left.FieldSymbol.RefKind == RefKind.None); 1258if (local.RefKind == RefKind.None && !IsStackLocal(local)) 1267if (parameter.ParameterSymbol.RefKind == RefKind.None) 1736CSharpCompilation.DynamicTransformsEncoder.Encode(local.Type, RefKind.None, 0) : 1766Debug.Assert(local.RefKind == RefKind.None); 1782(local.RefKind != RefKind.None ? LocalSlotConstraints.ByRef : LocalSlotConstraints.None);
CodeGen\Optimizer.cs (22)
857if (node.LocalSymbol.RefKind != RefKind.None) 877if (node.LocalSymbol.RefKind != RefKind.None) 985if (localSymbol.RefKind == RefKind.RefReadOnly && 1030(lhs.Kind is BoundKind.Local or BoundKind.Parameter or BoundKind.FieldAccess && lhs.GetRefKind() != RefKind.None), 1040if (((BoundParameter)lhs).ParameterSymbol.RefKind != RefKind.None) 1048if (((BoundLocal)lhs).LocalSymbol.RefKind != RefKind.None) 1056Debug.Assert(((BoundCall)lhs).Method.RefKind == RefKind.Ref, "only ref returning methods are assignable"); 1060Debug.Assert(((BoundFunctionPointerInvocation)lhs).FunctionPointer.Signature.RefKind == RefKind.Ref, "only ref returning function pointers are assignable"); 1157if (unwrappedSequence is BoundLocal { LocalSymbol: { RefKind: not RefKind.None } localSymbol }) 1188private ImmutableArray<BoundExpression> VisitArguments(ImmutableArray<BoundExpression> arguments, ImmutableArray<ParameterSymbol> parameters, ImmutableArray<RefKind> argRefKindsOpt) 1198RefKind argRefKind = CodeGenerator.GetArgumentRefKind(arguments, parameters, argRefKindsOpt, i); 1205private void VisitArgument(ImmutableArray<BoundExpression> arguments, ref ArrayBuilder<BoundExpression> rewrittenArguments, int i, RefKind argRefKind) 1207ExprContext context = (argRefKind == RefKind.None) ? ExprContext.Value : ExprContext.Address; 1229ImmutableArray<RefKind> argRefKindsOpt = node.ArgumentRefKindsOpt; 1233RefKind refKind = argRefKindsOpt.IsDefaultOrEmpty ? RefKind.None : argRefKindsOpt[i]; 1361if (localSym.RefKind == RefKind.None) 1807Debug.Assert(local.RefKind == RefKind.None, "cannot take a ref of a ref"); 1868return top.Item2 == (local.RefKind == RefKind.None ? ExprContext.Value : ExprContext.Address) && 2095var isIndirectLocalStore = left.LocalSymbol.RefKind != RefKind.None && !node.IsRef; 2303public override RefKind RefKind 2305get { return RefKind.None; }
Compilation\CSharpCompilation.cs (5)
2048if (method.RefKind != RefKind.None) 3727RefKind returnRefKind, 3729ImmutableArray<RefKind> parameterRefKinds, 3762if (returnRefKind == RefKind.Out) 3902fields.Add(new AnonymousTypeField(name, location, TypeWithAnnotations.Create(type, nullableAnnotation), RefKind.None, ScopedKind.None));
Compiler\ClsComplianceChecker.cs (2)
1320ImmutableArray<RefKind> xRefKinds; 1321ImmutableArray<RefKind> yRefKinds;
Compiler\MethodBodySynthesizer.cs (5)
49argumentRefKindsOpt: ImmutableArray<RefKind>.Empty, 192statement = new BoundReturnStatement(accessor.SyntaxNode, RefKind.None, fieldAccess, @checked: false); 308BoundStatement returnStatement = BoundReturnStatement.Synthesized(syntax, RefKind.None, processHandlerCall); 318BoundStatement returnStatement = new BoundReturnStatement(syntax, RefKind.None, expressionOpt: null, @checked: false); 355refKind: RefKind.None,
DocumentationComments\DocumentationCommentIDVisitor.PartVisitor.cs (1)
248if (symbol.RefKind != RefKind.None)
Emitter\EditAndContinue\CSharpSymbolMatcher.cs (6)
898private static void ValidateFunctionPointerParamOrReturn(TypeWithAnnotations type, RefKind refKind, ImmutableArray<CustomModifier> refCustomModifiers, bool allowOut) 903static bool verifyRefModifiers(ImmutableArray<CustomModifier> modifiers, RefKind refKind, bool allowOut) 905Debug.Assert(RefKind.RefReadOnly == RefKind.In); 908case RefKind.RefReadOnly: 909case RefKind.Out when allowOut:
Emitter\Model\FieldSymbolAdapter.cs (1)
53bool Cci.IFieldReference.IsByReference => AdaptedFieldSymbol.RefKind != RefKind.None;
Emitter\Model\ParameterSymbolAdapter.cs (1)
38return AdaptedParameterSymbol.RefKind != RefKind.None;
Emitter\Model\ParameterTypeInformation.cs (1)
39return _underlyingParameter.RefKind != RefKind.None;
Emitter\Model\PEModuleBuilder.cs (1)
1285!optArgList.ArgumentRefKindsOpt.IsDefaultOrEmpty && optArgList.ArgumentRefKindsOpt[i] != RefKind.None,
Emitter\Model\SpecializedFieldReference.cs (1)
80bool Cci.IFieldReference.IsByReference => _underlyingField.RefKind != RefKind.None;
FlowAnalysis\AbstractFlowPass.cs (32)
1076VisitArguments(node.Arguments, default(ImmutableArray<RefKind>), null); 1237VisitRvalue(node.InitializerOpt, isKnownToBeAnLvalue: node.LocalSymbol.RefKind != RefKind.None); 1240if (node.LocalSymbol.RefKind != RefKind.None) 1349WriteArgument(receiverOpt, RefKind.Ref, method: null); 1355var thisRefKind = thisParameter.RefKind; 1429protected virtual void VisitArguments(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt, MethodSymbol method) 1436private void VisitArgumentsBeforeCall(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt) 1441RefKind refKind = GetRefKind(refKindsOpt, i); 1442if (refKind != RefKind.Out) 1444VisitRvalue(arguments[i], isKnownToBeAnLvalue: refKind != RefKind.None); 1456private void VisitArgumentsAfterCall(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt, MethodSymbol method) 1460RefKind refKind = GetRefKind(refKindsOpt, i); 1462if (refKind != RefKind.None) 1469protected static RefKind GetRefKind(ImmutableArray<RefKind> refKindsOpt, int index) 1471return refKindsOpt.IsDefault || refKindsOpt.Length <= index ? RefKind.None : refKindsOpt[index]; 1474protected virtual void WriteArgument(BoundExpression arg, RefKind refKind, MethodSymbol method) 1885VisitRvalue(node.ExpressionOpt, isKnownToBeAnLvalue: node.RefKind != RefKind.None); 1888if (node.RefKind != RefKind.None) 1966if (property.RefKind == RefKind.None) 1984var refKind = node.Left.Kind == BoundKind.BadExpression 1985? RefKind.Ref 2021if (property.RefKind == RefKind.None) 2040if (property.RefKind == RefKind.None) 2613if (property.RefKind == RefKind.None) 3110WriteArgument(operand, RefKind.Ref, method: null); 3296this.WriteArgument(operand, RefKind.Out, null); //Out because we know it will definitely be assigned. 3337VisitArguments(node.Arguments, default(ImmutableArray<RefKind>), node.Constructor); 3421VisitArguments(node.Arguments, default(ImmutableArray<RefKind>), node.AddMethod); 3427VisitArguments(node.Arguments, default(ImmutableArray<RefKind>), node.AddMethod); 3435VisitArguments(node.Arguments, default(ImmutableArray<RefKind>), method: null); 3517property.RefKind == RefKind.None)
FlowAnalysis\AlwaysAssignedWalker.cs (2)
72protected override void WriteArgument(BoundExpression arg, RefKind refKind, MethodSymbol method) 75if (refKind == RefKind.Out)
FlowAnalysis\DataFlowsOutWalker.cs (1)
233((param.RefKind != RefKind.None && !param.IsImplicitlyDeclared && !RegionContains(param.Locations[0].SourceSpan)) ||
FlowAnalysis\DefiniteAssignment.cs (10)
1190((ParameterSymbol)symbol).RefKind == RefKind.Out) 1500if (local.LocalSymbol.RefKind != RefKind.None && !isRef) 1521if (isRef && param.RefKind == RefKind.Out) 1723if (current is not MethodSymbol && parameter.RefKind == RefKind.Out) 1753if (parameter.RefKind == RefKind.Out && !(this.CurrentSymbol is MethodSymbol currentMethod && currentMethod.IsAsync)) // out parameters not allowed in async 1819if (!parameter.IsThis && parameter.RefKind != RefKind.Out && parameter.ContainingSymbol is SynthesizedPrimaryConstructor primaryCtor) 1831if (parameter.RefKind != RefKind.None) 2403protected override void WriteArgument(BoundExpression arg, RefKind refKind, MethodSymbol method) 2405if (refKind == RefKind.Ref) 2419if (refKind != RefKind.None && ((object)method == null || method.IsExtern) && arg.Type is TypeSymbol type)
FlowAnalysis\FlowAnalysisPass.cs (3)
85var newStatements = block.Statements.Add(new BoundReturnStatement(trailingExpression.Syntax, RefKind.None, trailingExpression, @checked: false)); 120if (field.RefKind == RefKind.None) 182: BoundReturnStatement.Synthesized(syntax, RefKind.None, null);
FlowAnalysis\NullableWalker.cs (48)
1207var refKind = parameter.RefKind; 1208if (refKind != RefKind.Out && refKind != RefKind.Ref) 2303RefKind refKind, 2313if (refKind == RefKind.Ref) 2316return AreParameterAnnotationsCompatible(RefKind.None, overriddenType, overriddenAnnotations, overridingType, overridingAnnotations, forRef: true) && 2317AreParameterAnnotationsCompatible(RefKind.Out, overriddenType, overriddenAnnotations, overridingType, overridingAnnotations); 2320if (refKind == RefKind.None || refKind == RefKind.In) 2350if (refKind == RefKind.Out) 2744if (parameter.RefKind != RefKind.Out) 2817if (node.RefKind == RefKind.None && 2826if (node.RefKind == RefKind.None) 5689ImmutableArray<RefKind> refKindsOpt = node.ArgumentRefKindsOpt; 6103protected override void VisitArguments(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt, MethodSymbol method) 6112ImmutableArray<RefKind> refKindsOpt, 6125ImmutableArray<RefKind> refKindsOpt, 6140ImmutableArray<RefKind> refKindsOpt, 6160ImmutableArray<RefKind> refKindsOpt, 6187ImmutableArray<RefKind> refKindsOpt, 6342ImmutableArray<RefKind> refKindsOpt, 6455ImmutableArray<RefKind> refKindsOpt, 6494private VisitArgumentResult VisitArgumentEvaluate(BoundExpression argument, RefKind refKind, FlowAnalysisAnnotations annotations) 6502case RefKind.Ref: 6506case RefKind.None: 6507case RefKind.In: 6531case RefKind.Out: 6552RefKind refKind, 6567case RefKind.None: 6568case RefKind.In: 6606case RefKind.Ref: 6626case RefKind.Out: 6689RefKind refKind, 6702case RefKind.None: 6703case RefKind.In: 6709case RefKind.Ref: 6736case RefKind.Out: 6942ImmutableArray<RefKind> refKindsOpt) 6953RefKind refKind = GetRefKind(refKindsOpt, i); 6956if (refKind == RefKind.None) 7017ImmutableArray<RefKind> argumentRefKindsOpt, 7026var refKinds = ArrayBuilder<RefKind>.GetInstance(); 7047parameterRefKinds: out ImmutableArray<RefKind> parameterRefKinds); 9203return expr.GetRefKind() == RefKind.None; 9205RefKind kind = ((BoundParameter)expr).ParameterSymbol.RefKind; 9206return kind == RefKind.None; 11079TypeWithAnnotations elementType = InMethodBinder.GetIteratorElementTypeFromReturnType(compilation, RefKind.None, 11119VisitArguments(node, node.ConstructorArguments, ImmutableArray<RefKind>.Empty, node.Constructor, argsToParamsOpt: node.ConstructorArgumentsToParamsOpt, defaultArguments: default,
FlowAnalysis\NullableWalker.PlaceholderLocal.cs (2)
59public override RefKind RefKind => RefKind.None;
FlowAnalysis\ReadWriteWalker.cs (2)
87if (p.RefKind != RefKind.None) _readOutside.Add(p); 95if ((object)thisParameter != null && thisParameter.RefKind != RefKind.None)
Generated\BoundNodes.xml.Generated.cs (37)
908public BoundDup(SyntaxNode syntax, RefKind refKind, TypeSymbol? type, bool hasErrors) 914public BoundDup(SyntaxNode syntax, RefKind refKind, TypeSymbol? type) 920public RefKind RefKind { get; } 925public BoundDup Update(RefKind refKind, TypeSymbol? type) 1433public BoundFunctionPointerInvocation(SyntaxNode syntax, BoundExpression invokedExpression, ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> argumentRefKindsOpt, LookupResultKind resultKind, TypeSymbol type, bool hasErrors = false) 1450public ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 1456public BoundFunctionPointerInvocation Update(BoundExpression invokedExpression, ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> argumentRefKindsOpt, LookupResultKind resultKind, TypeSymbol type) 2952public BoundArgListOperator(SyntaxNode syntax, ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> argumentRefKindsOpt, TypeSymbol? type, bool hasErrors = false) 2964public ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 2969public BoundArgListOperator Update(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> argumentRefKindsOpt, TypeSymbol? type) 3458public BoundReturnStatement(SyntaxNode syntax, RefKind refKind, BoundExpression? expressionOpt, bool @checked, bool hasErrors = false) 3466public RefKind RefKind { get; } 3473public BoundReturnStatement Update(RefKind refKind, BoundExpression? expressionOpt, bool @checked) 5782public BoundDynamicInvocation(SyntaxNode syntax, ImmutableArray<string> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type, bool hasErrors = false) 5798public ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 5804public BoundDynamicInvocation Update(ImmutableArray<string> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type) 6032public BoundCall(SyntaxNode syntax, BoundExpression? receiverOpt, MethodSymbol method, ImmutableArray<BoundExpression> arguments, ImmutableArray<string> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool isDelegateCall, bool expanded, bool invokedAsExtensionMethod, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalMethodsOpt, TypeSymbol type, bool hasErrors = false) 6059public ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 6071public BoundCall Update(BoundExpression? receiverOpt, MethodSymbol method, ImmutableArray<BoundExpression> arguments, ImmutableArray<string> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool isDelegateCall, bool expanded, bool invokedAsExtensionMethod, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalMethodsOpt, TypeSymbol type) 6169public BoundUnconvertedObjectCreationExpression(SyntaxNode syntax, ImmutableArray<BoundExpression> arguments, ImmutableArray<(string Name, Location Location)?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, InitializerExpressionSyntax? initializerOpt, Binder binder, bool hasErrors = false) 6186public ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 6193public BoundUnconvertedObjectCreationExpression Update(ImmutableArray<BoundExpression> arguments, ImmutableArray<(string Name, Location Location)?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, InitializerExpressionSyntax? initializerOpt, Binder binder) 6228public BoundObjectCreationExpression(SyntaxNode syntax, MethodSymbol constructor, ImmutableArray<MethodSymbol> constructorsGroup, ImmutableArray<BoundExpression> arguments, ImmutableArray<string> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool expanded, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, ConstantValue? constantValueOpt, BoundObjectInitializerExpressionBase? initializerExpressionOpt, bool wasTargetTyped, TypeSymbol type, bool hasErrors = false) 6254public override ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 6265public BoundObjectCreationExpression Update(MethodSymbol constructor, ImmutableArray<MethodSymbol> constructorsGroup, ImmutableArray<BoundExpression> arguments, ImmutableArray<string> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool expanded, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, ConstantValue? constantValueOpt, BoundObjectInitializerExpressionBase? initializerExpressionOpt, bool wasTargetTyped, TypeSymbol type) 6354public BoundDynamicObjectCreationExpression(SyntaxNode syntax, string name, ImmutableArray<BoundExpression> arguments, ImmutableArray<string> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, BoundObjectInitializerExpressionBase? initializerExpressionOpt, ImmutableArray<MethodSymbol> applicableMethods, bool wasTargetTyped, TypeSymbol type, bool hasErrors = false) 6375public override ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 6383public BoundDynamicObjectCreationExpression Update(string name, ImmutableArray<BoundExpression> arguments, ImmutableArray<string> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, BoundObjectInitializerExpressionBase? initializerExpressionOpt, ImmutableArray<MethodSymbol> applicableMethods, bool wasTargetTyped, TypeSymbol type) 6476public BoundObjectInitializerMember(SyntaxNode syntax, Symbol? memberSymbol, ImmutableArray<BoundExpression> arguments, ImmutableArray<string> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool expanded, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, LookupResultKind resultKind, TypeSymbol receiverType, TypeSymbol type, bool hasErrors = false) 6499public ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 6509public BoundObjectInitializerMember Update(Symbol? memberSymbol, ImmutableArray<BoundExpression> arguments, ImmutableArray<string> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool expanded, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, LookupResultKind resultKind, TypeSymbol receiverType, TypeSymbol type) 7138public BoundIndexerAccess(SyntaxNode syntax, BoundExpression? receiverOpt, PropertySymbol indexer, ImmutableArray<BoundExpression> arguments, ImmutableArray<string> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool expanded, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, ImmutableArray<PropertySymbol> originalIndexersOpt, TypeSymbol type, bool hasErrors = false) 7162public ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 7171public BoundIndexerAccess Update(BoundExpression? receiverOpt, PropertySymbol indexer, ImmutableArray<BoundExpression> arguments, ImmutableArray<string> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool expanded, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, ImmutableArray<PropertySymbol> originalIndexersOpt, TypeSymbol type) 7234public BoundDynamicIndexerAccess(SyntaxNode syntax, BoundExpression receiver, ImmutableArray<BoundExpression> arguments, ImmutableArray<string> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<PropertySymbol> applicableIndexers, TypeSymbol type, bool hasErrors = false) 7254public ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 7260public BoundDynamicIndexerAccess Update(BoundExpression receiver, ImmutableArray<BoundExpression> arguments, ImmutableArray<string> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<PropertySymbol> applicableIndexers, TypeSymbol type)
Lowering\AsyncRewriter\AsyncExceptionHandlerRewriter.cs (1)
322unpendReturn = new BoundReturnStatement(_F.Syntax, RefKind.None, pendingValue, @checked: false);
Lowering\AsyncRewriter\AsyncMethodBuilderMemberCollection.cs (1)
488method.RefKind == RefKind.None &&
Lowering\AsyncRewriter\AsyncMethodToStateMachineRewriter.cs (1)
430refKinds: ImmutableArray<RefKind>.Empty,
Lowering\ClosureConversion\ClosureConversion.cs (7)
554new BoundReturnStatement(syntax, RefKind.None, null, @checked: false)); 859ref ImmutableArray<RefKind> argRefKinds) 900var refkindsBuilder = ArrayBuilder<RefKind>.GetInstance(argumentsBuilder.Count); 907refkindsBuilder.AddMany(RefKind.None, arguments.Length); 910refkindsBuilder.AddMany(RefKind.Ref, frameCount); 1325var argRefKinds = default(ImmutableArray<RefKind>); 1352ImmutableArray<RefKind> argRefKinds = default;
Lowering\ClosureConversion\LambdaCapturedVariable.cs (2)
119public override RefKind RefKind => RefKind.None;
Lowering\ClosureConversion\SynthesizedClosureMethod.cs (1)
121if (RefKind == RefKind.RefReadOnly)
Lowering\DiagnosticsPass_ExpressionTrees.cs (5)
297ImmutableArray<RefKind> argumentRefKindsOpt, 336else if (method.RefKind != RefKind.None) 473VisitCall(node.AddMethod, null, node.Arguments, default(ImmutableArray<RefKind>), default(ImmutableArray<string>), node.DefaultArguments, node); 497if (_inExpressionLambda && property.RefKind != RefKind.None) 532if (p.RefKind != RefKind.None && p.Locations.Length != 0)
Lowering\DiagnosticsPass_Warnings.cs (5)
21private void CheckArguments(ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<BoundExpression> arguments, Symbol method) 28if (argumentRefKindsOpt[i] != RefKind.None) 235private static bool IsComCallWithRefOmitted(MethodSymbol method, ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> argumentRefKindsOpt) 244if (method.Parameters[i].RefKind != RefKind.None && (argumentRefKindsOpt.IsDefault || argumentRefKindsOpt[i] == RefKind.None)) return true;
Lowering\Extensions.cs (3)
17public static RefKind RefKinds(this ImmutableArray<RefKind> ArgumentRefKinds, int index) 25return RefKind.None;
Lowering\InitializerRewriter.cs (2)
68boundStatements.Add(new BoundReturnStatement(lastStatement.Syntax, RefKind.None, trailingExpression, @checked: false)); 106isRef: field.RefKind != RefKind.None)
Lowering\Instrumentation\LocalStateTracingInstrumenter.cs (5)
302if (parameter.RefKind == RefKind.Out || parameter.IsDiscard) 450Debug.Assert(parameter.RefKind == RefKind.None); 554private BoundExpression InstrumentCall(BoundExpression invocation, ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKinds) 579if (refKinds[i] is not (RefKind.Ref or RefKind.Out))
Lowering\IteratorRewriter\IteratorConstructor.cs (1)
28SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(intType), 0, RefKind.None, GeneratedNames.MakeStateMachineStateFieldName()));
Lowering\IteratorRewriter\IteratorFinallyMethodSymbol.cs (2)
140public override RefKind RefKind 142get { return RefKind.None; }
Lowering\LocalRewriter\LocalRewriter.cs (4)
960return ((BoundCall)expr).Method.RefKind != RefKind.None; 963return ((BoundPropertyAccess)expr).PropertySymbol.RefKind != RefKind.None; 966return ((BoundIndexerAccess)expr).Indexer.RefKind != RefKind.None; 998symbol.Parameters.Any(static p => p.RefKind == RefKind.In))
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (5)
161var refKindBuilder = ArrayBuilder<RefKind>.GetInstance(); 164void addArg(RefKind refKind, BoundExpression expression) 188Debug.Assert(parameter.RefKind == RefKind.Out); 190addArg(RefKind.Out, _tempAllocator.GetTemp(outputTemp)); 520&& loweredInput.GetRefKind() == RefKind.None &&
Lowering\LocalRewriter\LocalRewriter_AnonymousObjectCreation.cs (1)
28argumentRefKindsOpt: default(ImmutableArray<RefKind>),
Lowering\LocalRewriter\LocalRewriter_AssignmentOperator.cs (4)
144ImmutableArray<RefKind> refKinds, 192default(ImmutableArray<RefKind>), 225Debug.Assert(!isRef || rewrittenLeft.GetRefKind() != RefKind.None); 280ImmutableArray<RefKind> argumentRefKindsOpt,
Lowering\LocalRewriter\LocalRewriter_Call.cs (64)
182ImmutableArray<RefKind> argumentRefKindsOpt, 210ImmutableArray<RefKind> argumentRefKinds, 295argumentRefKinds: default(ImmutableArray<RefKind>), 302private static bool IsSafeForReordering(BoundExpression expression, RefKind kind) 328return kind != RefKind.None; 426ImmutableArray<RefKind> argumentRefKindsOpt, 445RefKind refKind; 457refKind = rewrittenReceiver.Type.IsValueType || rewrittenReceiver.Type.Kind == SymbolKind.TypeParameter ? RefKind.Ref : RefKind.None; 463if (refKind == RefKind.None && 471refKind = RefKind.Ref; 637RefKind argRefKind = argumentRefKindsOpt.RefKinds(argIndex); 638RefKind paramRefKind = parameters[paramIndex].RefKind; 640local = _factory.StoreToTemp(visitedArgument, out var store, refKind: paramRefKind == RefKind.In ? RefKind.In : argRefKind); 709var intermediateRef = _factory.Local(_factory.SynthesizedLocal(receiverType, refKind: RefKind.Ref)); 761ref ImmutableArray<RefKind> argumentRefKindsOpt, 836ArrayBuilder<RefKind> refKinds = ArrayBuilder<RefKind>.GetInstance(parameters.Length, RefKind.None); 893private static ImmutableArray<RefKind> GetEffectiveArgumentRefKinds(ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<ParameterSymbol> parameters) 895ArrayBuilder<RefKind>? refKindsBuilder = null; 898var paramRefKind = parameters[i].RefKind; 899if (paramRefKind == RefKind.In) 901var argRefKind = argumentRefKindsOpt.IsDefault ? RefKind.None : argumentRefKindsOpt[i]; 903refKindsBuilder[i] = argRefKind == RefKind.None ? paramRefKind : RefKindExtensions.StrictIn; 905else if (paramRefKind == RefKind.Ref) 907var argRefKind = argumentRefKindsOpt.IsDefault ? RefKind.None : argumentRefKindsOpt[i]; 908if (argRefKind == RefKind.None) 914refKindsBuilder[i] = RefKind.Ref; 928static void fillRefKindsBuilder(ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<ParameterSymbol> parameters, [NotNull] ref ArrayBuilder<RefKind>? refKindsBuilder) 935refKindsBuilder = ArrayBuilder<RefKind>.GetInstance(parameters.Length); 940refKindsBuilder = ArrayBuilder<RefKind>.GetInstance(parameters.Length, fillWithValue: RefKind.None); 1041private static ImmutableArray<RefKind> GetRefKindsOrNull(ArrayBuilder<RefKind> refKinds) 1043foreach (var refKind in refKinds) 1045if (refKind != RefKind.None) 1050return default(ImmutableArray<RefKind>); 1058ImmutableArray<RefKind> argumentRefKinds, 1062/* out */ ArrayBuilder<RefKind> refKinds, 1072RefKind argRefKind = argumentRefKinds.RefKinds(a); 1073RefKind paramRefKind = parameters[p].RefKind; 1114refKind: paramRefKind == RefKind.In ? RefKind.In : argRefKind); 1125if (paramRefKind == RefKind.In) 1127Debug.Assert(argRefKind == RefKind.None || argRefKind == RefKind.In); 1128argRefKind = argRefKind == RefKind.None ? RefKind.In : RefKindExtensions.StrictIn; 1299default(ImmutableArray<RefKind>), 1475ArrayBuilder<RefKind> argsRefKindsBuilder, 1488RefKind paramRefKind = parameters[argIndex].RefKind; 1489RefKind argRefKind = argsRefKindsBuilder[argIndex]; 1493if (argRefKind != RefKind.None || paramRefKind != RefKind.Ref) 1501var localRefKind = ((BoundLocal)argument).LocalSymbol.RefKind; 1502if (localRefKind == RefKind.Ref) 1508Debug.Assert(localRefKind == RefKind.None); 1520argsRefKindsBuilder[argIndex] = RefKind.Ref;
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (19)
204var receiverTemp = _factory.StoreToTemp(rewrittenReceiver, out assignmentToTemp, refKind: variableRepresentsLocation ? RefKind.Ref : RefKind.None); 323ImmutableArray<RefKind> argumentRefKinds = indexerAccess.ArgumentRefKindsOpt; 331ArrayBuilder<RefKind> refKinds = ArrayBuilder<RefKind>.GetInstance(parameters.Length, RefKind.None); 418Debug.Assert(implicitIndexerAccess.IndexerOrSliceAccess.GetRefKind() == RefKind.None); 440var variableTemp = _factory.StoreToTemp(arrayAccess, out assignmentToTemp, refKind: RefKind.Ref); 518var temp = _factory.StoreToTemp(VisitExpression(arguments[i]), out assignmentToTemp, indexerAccess.ArgumentRefKindsOpt.RefKinds(i) != RefKind.None ? RefKind.Ref : RefKind.None); 589if (propertyAccess.PropertySymbol.RefKind == RefKind.None) 604if (indexerAccess.GetRefKind() == RefKind.None) 617if (implicitIndexerAccess.GetRefKind() == RefKind.None) 687Debug.Assert(((BoundCall)originalLHS).Method.RefKind != RefKind.None); 691Debug.Assert(((BoundFunctionPointerInvocation)originalLHS).FunctionPointer.Signature.RefKind != RefKind.None); 742var variableTemp = _factory.StoreToTemp(rewrittenVariable, out assignmentToTemp2, refKind: RefKind.Ref); 839return localsMayBeAssignedOrCaptured || ((BoundParameter)expression).ParameterSymbol.RefKind != RefKind.None; 842return localsMayBeAssignedOrCaptured || ((BoundLocal)expression).LocalSymbol.RefKind != RefKind.None;
Lowering\LocalRewriter\LocalRewriter_DeconstructionAssignmentOperator.cs (2)
168case BoundLocal { LocalSymbol: { RefKind: RefKind.None } localSymbol }: 171case BoundParameter { ParameterSymbol: { RefKind: RefKind.None } parameterSymbol }:
Lowering\LocalRewriter\LocalRewriter_FixedStatement.cs (3)
36if (pinnedTemp.RefKind == RefKind.None) 264refKind: RefKind.RefReadOnly, 326refKind: RefKind.RefReadOnly,
Lowering\LocalRewriter\LocalRewriter_IndexerAccess.cs (9)
58ImmutableArray<RefKind> refKinds) 109ImmutableArray<RefKind> argumentRefKindsOpt, 117if (isLeftOfAssignment && indexer.RefKind == RefKind.None) 220Debug.Assert(!isLeftOfAssignment || node.IndexerOrSliceAccess.GetRefKind() == RefKind.Ref); 272receiver.Type.IsReferenceType ? RefKind.None : RefKind.Ref); 336if (isLeftOfAssignment && indexerAccess.GetRefKind() == RefKind.None) 580receiver.Type.IsReferenceType ? RefKind.None : RefKind.Ref);
Lowering\LocalRewriter\LocalRewriter_Literal.cs (2)
137argumentNamesOpt: default(ImmutableArray<string>), argumentRefKindsOpt: default(ImmutableArray<RefKind>), expanded: false, 157argumentNamesOpt: default(ImmutableArray<string>), argumentRefKindsOpt: default(ImmutableArray<RefKind>), expanded: false,
Lowering\LocalRewriter\LocalRewriter_ObjectCreationExpression.cs (2)
41ImmutableArray<RefKind> argumentRefKindsOpt = node.ArgumentRefKindsOpt; 342default(ImmutableArray<RefKind>),
Lowering\LocalRewriter\LocalRewriter_ObjectOrCollectionInitializerExpression.cs (11)
133default(ImmutableArray<RefKind>), 148.All(p => p.RefKind == RefKind.None || p.RefKind == RefKind.In)); 164var argumentRefKindsOpt = default(ImmutableArray<RefKind>); 165if (addMethod.Parameters[0].RefKind == RefKind.Ref) 170var builder = ArrayBuilder<RefKind>.GetInstance(addMethod.Parameters.Length, RefKind.None); 171builder[0] = RefKind.Ref; 300memberInit.MemberSymbol?.GetParameterRefKinds() ?? default(ImmutableArray<RefKind>), 455ImmutableArray<RefKind> paramRefKindsOpt, 473RefKind refKind = paramRefKindsOpt.RefKinds(i);
Lowering\LocalRewriter\LocalRewriter_PropertyAccess.cs (1)
52if (isLeftOfAssignment && propertySymbol.RefKind == RefKind.None)
Lowering\LocalRewriter\LocalRewriter_StringInterpolation.cs (2)
90if (construction.ArgumentRefKindsOpt[i] == RefKind.Out) 95Debug.Assert(construction.ArgumentRefKindsOpt[i] == RefKind.None);
Lowering\LocalRewriter\LocalRewriter_UnaryOperator.cs (2)
485return ((BoundLocal)expression).LocalSymbol.RefKind != RefKind.None; 489return ((BoundParameter)expression).ParameterSymbol.RefKind != RefKind.None;
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (3)
500Debug.Assert(method.Parameters.AsSpan()[1..].All(assertParametersAreOptional, (p, assertOptional) => (p.IsOptional || p.IsParams || !assertOptional) && p.RefKind == RefKind.None)); 501Debug.Assert(method.ParameterRefKinds.IsDefaultOrEmpty || method.ParameterRefKinds[0] is RefKind.In or RefKind.None);
Lowering\LocalRewriter\LoweredDynamicOperationFactory.cs (53)
111return MakeDynamicOperation(binderConstruction, null, RefKind.None, loweredArguments, default(ImmutableArray<RefKind>), null, resultType); 147return MakeDynamicOperation(binderConstruction, null, RefKind.None, loweredArguments, default(ImmutableArray<RefKind>), null, resultType); 190return MakeDynamicOperation(binderConstruction, null, RefKind.None, loweredArguments, default(ImmutableArray<RefKind>), null, resultType); 199ImmutableArray<RefKind> refKinds, 223RefKind receiverRefKind; 228receiverRefKind = RefKind.None; 292return MakeDynamicOperation(binderConstruction, loweredReceiver, RefKind.None, loweredArguments, default(ImmutableArray<RefKind>), loweredHandler, resultType); 299ImmutableArray<RefKind> refKinds, 329return MakeDynamicOperation(binderConstruction, loweredReceiver, RefKind.None, loweredArguments, refKinds, null, resultType); 337ImmutableArray<RefKind> refKinds) 356return MakeDynamicOperation(binderConstruction, loweredReceiver, RefKind.None, loweredArguments, refKinds, null, type); 391return MakeDynamicOperation(binderConstruction, loweredReceiver, RefKind.None, loweredArguments, default(ImmutableArray<RefKind>), null, resultType); 432return MakeDynamicOperation(binderConstruction, loweredReceiver, RefKind.None, loweredArguments, default(ImmutableArray<RefKind>), loweredRight, AssemblySymbol.DynamicType); 439ImmutableArray<RefKind> refKinds) 458return MakeDynamicOperation(binderConstruction, loweredReceiver, RefKind.None, loweredArguments, refKinds, null, resultType); 465ImmutableArray<RefKind> refKinds, 481var loweredReceiverRefKind = GetReceiverRefKind(loweredReceiver); 516return MakeDynamicOperation(binderConstruction, loweredReceiver, RefKind.None, ImmutableArray<BoundExpression>.Empty, default(ImmutableArray<RefKind>), null, resultType); 542internal static RefKind GetReceiverRefKind(BoundExpression loweredReceiver) 547return RefKind.None; 562return RefKind.Ref; 570return RefKind.None; 577ImmutableArray<RefKind> refKinds = default(ImmutableArray<RefKind>), 579RefKind receiverRefKind = RefKind.None, 586Debug.Assert(!receiverIsStaticType || receiverRefKind == RefKind.None); 601refKinds.IsDefault ? RefKind.None : refKinds[i], 607infos[j++] = GetArgumentInfo(argumentInfoFactory, loweredRight, NoName, RefKind.None, isStaticType: false); 616RefKind receiverRefKind, 618ImmutableArray<RefKind> refKinds, 735RefKind receiverRefKind, 737ImmutableArray<RefKind> refKinds, 751bool hasByRefs = receiverRefKind != RefKind.None || !refKinds.IsDefaultOrEmpty; 791byRefs[j++] = RefKind.None; 806static RefKind getRefKind(RefKind refKind) => refKind == RefKind.None ? RefKind.None : RefKind.Ref; 813RefKind refKind, 828Debug.Assert(refKind == RefKind.None || refKind == RefKind.Ref || refKind == RefKind.Out, "unexpected refKind in dynamic"); 831if (refKind == RefKind.Out) 835else if (refKind == RefKind.Ref)
Lowering\MethodToClassRewriter.cs (1)
484if (leftLocal.LocalSymbol.RefKind != RefKind.None &&
Lowering\SpillSequenceSpiller.cs (39)
306RefKind refKind = RefKind.None, 318Debug.Assert(refKind == RefKind.None); 325Debug.Assert(refKind == RefKind.None); 338if (refKind != RefKind.None) 371var left = Spill(builder, assignment.Left, RefKind.Ref); 372var right = Spill(builder, assignment.Right, RefKind.Ref); 381if (refKind != RefKind.None || expression.Type.IsReferenceType) 389if (refKind != RefKind.None) 398if (local.LocalSymbol.SynthesizedKind == SynthesizedLocalKind.Spill || refKind != RefKind.None) 411if (refKind != RefKind.None || fieldSymbol.IsReadOnly) 418if (refKind == RefKind.None) goto default; 420var receiver = Spill(builder, field.ReceiverOpt, fieldSymbol.ContainingType.IsValueType ? refKind : RefKind.None); 467Left: BoundLocal { LocalSymbol: { SynthesizedKind: SynthesizedLocalKind.LoweringTemp, RefKind: RefKind.Ref } receiverRefLocal }, 470ValueTypeReceiver: BoundLocal { LocalSymbol: { SynthesizedKind: SynthesizedLocalKind.LoweringTemp, RefKind: RefKind.Ref } } valueTypeReceiver, 479Left: BoundLocal { LocalSymbol: { SynthesizedKind: SynthesizedLocalKind.LoweringTemp, RefKind: RefKind.None } referenceTypeClone }, 480Right: BoundLocal { LocalSymbol: { SynthesizedKind: SynthesizedLocalKind.LoweringTemp, RefKind: RefKind.Ref } originalReceiverReference } 483Value: BoundLocal { LocalSymbol: { SynthesizedKind: SynthesizedLocalKind.LoweringTemp, RefKind: RefKind.None } } referenceTypeReceiver 515ImmutableArray<RefKind> refKinds = default(ImmutableArray<RefKind>), 563var refKind = refKinds.IsDefault ? RefKind.None : refKinds[i]; 821expression = Spill(leftBuilder, expression, RefKind.None); 836left = Spill(leftBuilder, VisitExpression(ref leftBuilder, left), RefKind.Ref); 868expression = Spill(leftBuilder, expression, RefKind.None); 883receiver = Spill(leftBuilder, VisitExpression(ref leftBuilder, field.ReceiverOpt), RefKind.Ref); 961RefKind refKind = ReceiverSpillRefKind(receiver); 963Debug.Assert(refKind == RefKind.None || !receiver.Type.IsReferenceType); 967if (refKind != RefKind.None && 1000private static RefKind ReceiverSpillRefKind(BoundExpression receiver) 1002var result = RefKind.None; 1005result = receiver.Type.IsReadOnly ? RefKind.In : RefKind.Ref; 1167var receiverRefKind = ReceiverSpillRefKind(node.Receiver); 1188if (receiver.Type.IsReferenceType || receiver.Type.IsValueType || receiverRefKind == RefKind.None) 1191receiver = Spill(receiverBuilder, receiver, RefKind.None); 1208receiver = Spill(receiverBuilder, receiver, RefKind.Ref); 1210var clone = _F.SynthesizedLocal(receiver.Type, _F.Syntax, refKind: RefKind.None, kind: SynthesizedLocalKind.Spill);
Lowering\StateMachineRewriter\IteratorAndAsyncCaptureWalker.cs (1)
225Debug.Assert(parameter.IsThis || parameter.RefKind == RefKind.None);
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (16)
308if (local.RefKind != RefKind.None) 525var sacrificialTemp = F.SynthesizedLocal(type, refKind: RefKind.Ref); 545RefKind refKind, 555BoundExpression expression = HoistExpression(array.Expression, awaitSyntaxOpt, syntaxOffset, RefKind.None, sideEffects, hoistedFields, ref needsSacrificialEvaluation); 559indices.Add(HoistExpression(index, awaitSyntaxOpt, syntaxOffset, RefKind.None, sideEffects, hoistedFields, ref needsSacrificialEvaluation)); 572if (refKind != RefKind.None || field.FieldSymbol.IsReadOnly) return expr; 576if (refKind == RefKind.None) 584isFieldOfStruct ? refKind : RefKind.None, sideEffects, hoistedFields, ref needsSacrificialEvaluation); 606if (refKind != RefKind.None && refKind != RefKind.In) 608Debug.Assert(call.Method.RefKind != RefKind.None); 612refKind = RefKind.None; 623if (refKind != RefKind.None && refKind != RefKind.RefReadOnly) 629refKind = RefKind.None; 638if (refKind != RefKind.None)
Lowering\StateMachineRewriter\StateMachineFieldSymbol.cs (2)
62public override RefKind RefKind => RefKind.None;
Lowering\StateMachineRewriter\StateMachineRewriter.cs (2)
169if (local.RefKind != RefKind.None) 176Debug.Assert(local.RefKind == RefKind.None);
Lowering\StateMachineRewriter\SynthesizedStateMachineProperty.cs (2)
41public override RefKind RefKind 43get { return RefKind.None; }
Lowering\SynthesizedMethodBaseSymbol.cs (2)
150builder.Add(SynthesizedParameterSymbol.Create(this, this.TypeMap.SubstituteType(extra), ordinal++, RefKind.Ref)); 199public sealed override RefKind RefKind
Lowering\SyntheticBoundNodeFactory.cs (15)
529Debug.Assert(CurrentFunction.RefKind == RefKind.None); 554RefKind refKind = RefKind.None, 594return SynthesizedParameterSymbol.Create(container, TypeWithAnnotations.Create(type), ordinal, RefKind.None, name); 821public BoundCall Call(BoundExpression? receiver, MethodSymbol method, ImmutableArray<RefKind> refKinds, ImmutableArray<BoundExpression> args) 1509RefKind refKind = RefKind.None, 1526case RefKind.Out: 1527refKind = RefKind.Ref; 1530case RefKind.In: 1539Debug.Assert(argument.GetRefKind() != RefKind.In); 1540refKind = RefKind.None; 1544case RefKind.None: 1545case RefKind.Ref: 1576isRef: refKind != RefKind.None);
Operations\CSharpOperationFactory.cs (5)
749ImmutableArray<RefKind> argumentRefKinds = boundDynamicObjectCreationExpression.ArgumentRefKindsOpt.NullToEmpty(); 778ImmutableArray<RefKind> argumentRefKinds = boundDynamicInvocation.ArgumentRefKindsOpt.NullToEmpty(); 820ImmutableArray<RefKind> argumentRefKinds = boundDynamicIndexerAccess.ArgumentRefKindsOpt.NullToEmpty(); 859ImmutableArray<RefKind> argumentRefKinds = boundObjectInitializerMember.ArgumentRefKindsOpt.NullToEmpty(); 975return new DynamicInvocationOperation(operation, arguments, argumentNames: ImmutableArray<string>.Empty, argumentRefKinds: ImmutableArray<RefKind>.Empty, _semanticModel, syntax, type, isImplicit);
SymbolDisplay\SymbolDisplayVisitor.cs (1)
203if (symbol.RefKind == RefKind.RefReadOnly)
SymbolDisplay\SymbolDisplayVisitor.Members.cs (8)
40case RefKind.Ref: 43case RefKind.RefReadOnly: 820symbol.RefKind != RefKind.Out && 834if (symbol.ScopedKind == ScopedKind.ScopedValue && symbol.RefKind == RefKind.None) 1130private void AddParameterRefKind(RefKind refKind) 1134case RefKind.Out: 1138case RefKind.Ref: 1142case RefKind.In:
Symbols\AnonymousTypes\AnonymousTypeField.cs (2)
23public readonly RefKind RefKind; 40RefKind refKind,
Symbols\AnonymousTypes\AnonymousTypeManager.Templates.cs (2)
254if (fields.Any(static f => f.RefKind != RefKind.None)) 457var fields = key.Fields.SelectAsArray(f => new AnonymousTypeField(f.Name, Location.None, typeWithAnnotations: default, refKind: RefKind.None, ScopedKind.None));
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.ConstructorSymbol.cs (3)
33paramsArr.Add(SynthesizedParameterSymbol.Create(this, property.TypeWithAnnotations, index, RefKind.None, property.Name)); 53public override RefKind RefKind 55get { return RefKind.None; }
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.DelegateTemplateSymbol.cs (5)
60new SynthesizedDelegateInvokeMethod.ParameterDescription(TypeWithAnnotations.Create(typeParams[i]), refKinds.IsNull ? RefKind.None : refKinds[i], ScopedKind.None, defaultValue: null, isParams: false, hasUnscopedRefAttribute: false)); 65var returnRefKind = (refKinds.IsNull || voidReturnTypeOpt is { }) ? RefKind.None : refKinds[parameterCount]; 140var returnRefKind = returnParameter.RefKind; 200var returnRefKind = returnParameter.RefKind;
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.EqualsMethodSymbol.cs (3)
25SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(this.Manager.System_Object), 0, RefKind.None, "value")); 38public override RefKind RefKind 40get { return RefKind.None; }
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.FieldSymbol.cs (2)
35public override RefKind RefKind => RefKind.None;
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.GetHashCodeMethodSymbol.cs (2)
42public override RefKind RefKind 44get { return RefKind.None; }
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.PropertyAccessorSymbol.cs (2)
39public override RefKind RefKind 41get { return RefKind.None; }
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.PropertySymbol.cs (2)
64public override RefKind RefKind 66get { return RefKind.None; }
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.ToStringMethodSymbol.cs (2)
42public override RefKind RefKind 44get { return RefKind.None; }
Symbols\BaseTypeAnalysis.cs (1)
180if (field.RefKind != RefKind.None)
Symbols\Compilation_WellKnownMembers.cs (13)
747internal SynthesizedAttributeData? SynthesizeDynamicAttribute(TypeSymbol type, int customModifiersCount, RefKind refKindOpt = RefKind.None) 752if (type.IsDynamic() && refKindOpt == RefKind.None && customModifiersCount == 0) 861internal static ImmutableArray<TypedConstant> Encode(TypeSymbol type, RefKind refKind, int customModifiersCount, TypeSymbol booleanType) 873internal static ImmutableArray<bool> Encode(TypeSymbol type, RefKind refKind, int customModifiersCount) 880internal static ImmutableArray<bool> EncodeWithoutCustomModifierFlags(TypeSymbol type, RefKind refKind) 887internal static void Encode(TypeSymbol type, int customModifiersCount, RefKind refKind, ArrayBuilder<bool> transformFlagsBuilder, bool addCustomModifierFlags) 891if (refKind != RefKind.None) 982void handle(RefKind refKind, ImmutableArray<CustomModifier> customModifiers, TypeWithAnnotations twa) 989if (refKind != RefKind.None) 1144return parameter.RefKind != RefKind.None; 1149return method.RefKind != RefKind.None; 1154return property.RefKind != RefKind.None;
Symbols\ErrorMethodSymbol.cs (2)
158public override RefKind RefKind 160get { return RefKind.None; }
Symbols\ErrorPropertySymbol.cs (2)
44public override RefKind RefKind { get { return RefKind.None; } }
Symbols\FieldSymbol.cs (2)
66public abstract RefKind RefKind { get; } 356if (DeriveUseSiteInfoFromType(ref result, this.TypeWithAnnotations, RefKind == RefKind.None ? AllowedRequiredModifierType.System_Runtime_CompilerServices_Volatile : AllowedRequiredModifierType.None) ||
Symbols\FunctionPointers\FunctionPointerMethodSymbol.cs (43)
28RefKind refKind = RefKind.None; 44case SyntaxKind.RefKeyword when refKind == RefKind.None: 48refKind = RefKind.RefReadOnly; 53refKind = RefKind.Ref; 59Debug.Assert(refKind != RefKind.None); 73if (returnType.IsVoidType() && refKind != RefKind.None) 88if (refKind != RefKind.None) 247RefKind returnRefKind, 250ImmutableArray<RefKind> parameterRefKinds, 271RefKind returnRefKind, 273ImmutableArray<RefKind> parameterRefKinds, 285if (returnRefKind == RefKind.None) 310private static CustomModifier? GetCustomModifierForRefKind(RefKind refKind, CSharpCompilation compilation) 314RefKind.In => compilation.GetWellKnownType(WellKnownType.System_Runtime_InteropServices_InAttribute), 315RefKind.Out => compilation.GetWellKnownType(WellKnownType.System_Runtime_InteropServices_OutAttribute), 321Debug.Assert(refKind != RefKind.Out && refKind != RefKind.In); 349var returnVariance = RefKind == RefKind.None ? variance : VarianceKind.None; 364(VarianceKind.In, RefKind.None) => VarianceKind.Out, 365(VarianceKind.Out, RefKind.None) => VarianceKind.In, 441RefKind refKind, 486RefKind refKind, 491ImmutableArray<RefKind> parameterRefKinds, 494Debug.Assert(refKind != RefKind.Out); 495Debug.Assert(refCustomModifiers.IsDefaultOrEmpty || refKind != RefKind.None); 507Debug.Assert(refCustomModifiers.IsEmpty || refKind != RefKind.None); 511static ImmutableArray<CustomModifier> getCustomModifierArrayForRefKind(RefKind refKind, CSharpCompilation compilation) 517RefKind refKind, 551RefKind = getRefKind(retInfo, RefCustomModifiers, RefKind.RefReadOnly, RefKind.Ref); 552Debug.Assert(RefKind != RefKind.Out); 567RefKind paramRefKind = getRefKind(param, paramRefCustomMods, RefKind.In, RefKind.Out); 579static RefKind getRefKind(ParamInfo<TypeSymbol> param, ImmutableArray<CustomModifier> paramRefCustomMods, RefKind hasInRefKind, RefKind hasOutRefKind) 583false => RefKind.None, 586true => RefKind.Ref, 645var modifiersToSearch = RefKind != RefKind.None ? RefCustomModifiers : ReturnTypeWithAnnotations.CustomModifiers; 668var modifiersToSearch = RefKind != RefKind.None ? RefCustomModifiers : ReturnTypeWithAnnotations.CustomModifiers; 764public override RefKind RefKind { get; }
Symbols\FunctionPointers\FunctionPointerParameterSymbol.cs (4)
16public FunctionPointerParameterSymbol(TypeWithAnnotations typeWithAnnotations, RefKind refKind, int ordinal, FunctionPointerMethodSymbol containingSymbol, ImmutableArray<CustomModifier> refCustomModifiers) 27public override RefKind RefKind { get; } 77internal override bool IsMetadataIn => RefKind == RefKind.In; 78internal override bool IsMetadataOut => RefKind == RefKind.Out;
Symbols\FunctionPointers\FunctionPointerTypeSymbol.cs (13)
35RefKind returnRefKind, 38ImmutableArray<RefKind> parameterRefKinds, 49RefKind returnRefKind, 51ImmutableArray<RefKind> parameterRefKinds, 189internal static bool RefKindEquals(TypeCompareKind compareKind, RefKind refKind1, RefKind refKind2) 191? (refKind1 == RefKind.None) == (refKind2 == RefKind.None) 200internal static RefKind GetRefKindForHashCode(RefKind refKind) 201=> refKind == RefKind.None ? RefKind.None : RefKind.Ref;
Symbols\LocalSymbol.cs (2)
358public bool IsRef => RefKind != RefKind.None; 360public abstract RefKind RefKind
Symbols\MemberSignatureComparer.cs (8)
226/// the difference between <see cref="RefKind.Out"/> and <see cref="RefKind.Ref"/>. 520RefKind refKind1; 525RefKind refKind2; 738var refKind1 = param1.RefKind; 739var refKind2 = param2.RefKind; 751if ((refKind1 == RefKind.None) != (refKind2 == RefKind.None))
Symbols\MemberSymbolExtensions.cs (2)
83internal static ImmutableArray<RefKind> GetParameterRefKinds(this Symbol member) 92return default(ImmutableArray<RefKind>);
Symbols\Metadata\PE\DynamicTypeDecoder.cs (7)
69RefKind targetSymbolRefKind = RefKind.None) 89RefKind targetSymbolRefKind, 107RefKind targetSymbolRefKind, 209private bool HandleRefKind(RefKind refKind) 212return refKind == RefKind.None || !ConsumeFlag(); 398static (TypeWithAnnotations, bool madeChanges) handle(ref DynamicTypeDecoder decoder, RefKind refKind, ImmutableArray<CustomModifier> refCustomModifiers, TypeWithAnnotations typeWithAnnotations)
Symbols\Metadata\PE\MemberRefMetadataDecoder.cs (2)
183(field.RefKind != RefKind.None) == fieldInfo.IsByRef && 254if ((candidateParam.RefKind != RefKind.None) != targetParam.IsByRef)
Symbols\Metadata\PE\PEFieldSymbol.cs (9)
88public void SetRefKind(RefKind refKind) 95public RefKind RefKind => (RefKind)((_bits >> RefKindOffset) & RefKindMask); 323RefKind refKind = fieldInfo.IsByRef ? 324moduleSymbol.Module.HasIsReadOnlyAttribute(_handle) ? RefKind.RefReadOnly : RefKind.Ref : 325RefKind.None; 375public override RefKind RefKind 634if (RefKind != RefKind.None &&
Symbols\Metadata\PE\PEMethodSymbol.cs (9)
634public override RefKind RefKind => Signature.ReturnParam.RefKind; 1084case RefKind.None: 1085case RefKind.Ref: 1086case RefKind.In: 1105foreach (var kind in this.ParameterRefKinds) 1109case RefKind.None: 1110case RefKind.In: 1112case RefKind.Out: 1113case RefKind.Ref:
Symbols\Metadata\PE\PEParameterSymbol.cs (16)
73public RefKind RefKind 75get { return (RefKind)((_bits >> RefKindOffset) & RefKindMask); } 98Debug.Assert(EnumUtilities.ContainsAllValues<RefKind>(RefKindMask)); 104public PackedFlags(RefKind refKind, bool attributesAreComplete, bool hasNameInMetadata, ScopedKind scope, bool hasUnscopedRefAttribute) 247RefKind refKind = RefKind.None; 253refKind = isByRef ? RefKind.Ref : RefKind.None; 281refKind = RefKind.Out; 285refKind = RefKind.In; 289refKind = RefKind.Ref; 318Debug.Assert(refKind != RefKind.None); 386isBad |= (parameter.RefKind == RefKind.RefReadOnly) != hasInAttributeModifier; 388else if (parameter.RefKind == RefKind.In) 434public override RefKind RefKind 1038bool filterIsReadOnlyAttribute = this.RefKind == RefKind.In;
Symbols\Metadata\PE\PEPropertySymbol.cs (8)
34private readonly RefKind _refKind; 145var isBad = (result.RefKind == RefKind.In) != result.RefCustomModifiers.HasInAttributeModifier(); 214_refKind = RefKind.RefReadOnly; 218_refKind = RefKind.Ref; 223_refKind = RefKind.None; 282if (this.RefKind != RefKind.None && _setMethod != null) 586public override RefKind RefKind 645this.RefKind == RefKind.RefReadOnly ? AttributeDescription.IsReadOnlyAttribute : default,
Symbols\MethodSymbol.cs (5)
214return this.RefKind == RefKind.Ref; 225Debug.Assert(this.RefKind != RefKind.Out); 226return this.RefKind == RefKind.RefReadOnly; 233public abstract RefKind RefKind { get; } 901internal ImmutableArray<RefKind> ParameterRefKinds
Symbols\NamedTypeSymbol.cs (2)
366if ((thisParam.RefKind == RefKind.Ref && !thisParam.Type.IsValueType) || 367(thisParam.RefKind == RefKind.In && thisParam.Type.TypeKind != TypeKind.Struct))
Symbols\ParameterSignature.cs (10)
19internal readonly ImmutableArray<RefKind> parameterRefKinds; 22new ParameterSignature(ImmutableArray<TypeWithAnnotations>.Empty, default(ImmutableArray<RefKind>)); 25ImmutableArray<RefKind> parameterRefKinds) 39ArrayBuilder<RefKind> refs = null; 46var refKind = parameter.RefKind; 49if (refKind != RefKind.None) 51refs = ArrayBuilder<RefKind>.GetInstance(parm, RefKind.None); 61ImmutableArray<RefKind> refKinds = refs != null ? refs.ToImmutableAndFree() : default(ImmutableArray<RefKind>);
Symbols\ParameterSymbol.cs (5)
59public abstract RefKind RefKind { get; } 151RefKind refKind; 153((refKind = RefKind) == RefKind.None || 154(refKind == RefKind.In) || 155(refKind == RefKind.Ref && ContainingSymbol.ContainingType.IsComImport));
Symbols\PropertySymbol.cs (4)
70public bool ReturnsByRef { get { return this.RefKind == RefKind.Ref; } } 75public bool ReturnsByRefReadonly { get { return this.RefKind == RefKind.RefReadOnly; } } 80public abstract RefKind RefKind { get; } 125internal ImmutableArray<RefKind> ParameterRefKinds
Symbols\PropertySymbolExtensions.cs (2)
68if (param.RefKind == RefKind.Ref || param.RefKind == RefKind.Out)
Symbols\PublicModel\FieldSymbol.cs (1)
34RefKind IFieldSymbol.RefKind => _underlying.RefKind;
Symbols\PublicModel\LocalSymbol.cs (1)
52RefKind ILocalSymbol.RefKind => _underlying.RefKind;
Symbols\PublicModel\MethodSymbol.cs (1)
326RefKind IMethodSymbol.RefKind => _underlying.RefKind;
Symbols\PublicModel\ParameterSymbol.cs (1)
59RefKind IParameterSymbol.RefKind => _underlying.RefKind;
Symbols\PublicModel\PropertySymbol.cs (1)
110RefKind IPropertySymbol.RefKind => _underlying.RefKind;
Symbols\ReducedExtensionMethodSymbol.cs (2)
479public override RefKind RefKind 531internal override bool IsEffectivelyReadOnly => _reducedFrom.Parameters[0].RefKind == RefKind.In;
Symbols\RefKindExtensions.cs (13)
14public static bool IsManagedReference(this RefKind refKind) 16Debug.Assert(refKind <= RefKind.RefReadOnly); 18return refKind != RefKind.None; 21public static RefKind GetRefKind(this SyntaxKind syntaxKind) 26return RefKind.Ref; 28return RefKind.Out; 30return RefKind.In; 32return RefKind.None; 38public static bool IsWritableReference(this RefKind refKind) 42case RefKind.Ref: 43case RefKind.Out: 45case RefKind.None: 46case RefKind.In:
Symbols\Retargeting\RetargetingFieldSymbol.cs (1)
73public override RefKind RefKind => _underlyingField.RefKind;
Symbols\SignatureOnlyMethodSymbol.cs (3)
27private readonly RefKind _refKind; 41RefKind refKind, 75public override RefKind RefKind { get { return _refKind; } }
Symbols\SignatureOnlyParameterSymbol.cs (3)
20private readonly RefKind _refKind; 26RefKind refKind) 43public override RefKind RefKind { get { return _refKind; } }
Symbols\SignatureOnlyPropertySymbol.cs (3)
24private readonly RefKind _refKind; 34RefKind refKind, 50public override RefKind RefKind { get { return _refKind; } }
Symbols\Source\CustomModifierUtils.cs (4)
43destinationMethod.RefKind != RefKind.None ? constructedSourceMethod.RefCustomModifiers : ImmutableArray<CustomModifier>.Empty; 73const RefKind refKind = RefKind.None; 146destinationParameter.RefKind != RefKind.None ? sourceParameter.RefCustomModifiers : ImmutableArray<CustomModifier>.Empty,
Symbols\Source\FieldSymbolWithAttributesAndModifiers.cs (1)
392if (this.RefKind == RefKind.RefReadOnly)
Symbols\Source\GlobalExpressionVariable.cs (2)
67public sealed override RefKind RefKind => RefKind.None;
Symbols\Source\LambdaParameterSymbol.cs (1)
21RefKind refKind,
Symbols\Source\LambdaSymbol.cs (9)
21private RefKind _refKind; 45ImmutableArray<RefKind> parameterRefKinds, 46RefKind refKind, 142public override RefKind RefKind 156internal void SetInferredReturnType(RefKind refKind, TypeWithAnnotations inferredReturnType) 303ImmutableArray<RefKind> parameterRefKinds) 333RefKind refKind; 346refKind = RefKind.None; 352refKind = RefKind.None;
Symbols\Source\LocalFunctionSymbol.cs (4)
21private readonly RefKind _refKind; 210public override RefKind RefKind => _refKind; 231if (_refKind == RefKind.RefReadOnly) 256Debug.Assert(_refKind == RefKind.None
Symbols\Source\ParameterHelpers.cs (29)
41ParameterSyntax syntax, RefKind refKind, int ordinal, 81FunctionPointerParameterSyntax syntax, RefKind refKind, int ordinal, 91RefKind.In => CreateInModifiers(binder, diagnostics, syntax), 92RefKind.Out => CreateOutModifiers(binder, diagnostics, syntax), 122Func<Binder, TOwningSymbol, TypeWithAnnotations, TParameterSyntax, RefKind, int, SyntaxToken, SyntaxToken, bool, ScopedKind, BindingDiagnosticBag, TParameterSymbol> parameterCreationFunc, 142var refKind = GetModifiers(parameterSyntax.Modifiers, out SyntaxToken refnessKeyword, out SyntaxToken paramsKeyword, out SyntaxToken thisKeyword, out ScopedKind scope); 181if (!allowRefOrOut && (refKind == RefKind.Ref || refKind == RefKind.Out)) 240if (parameter.RefKind == RefKind.In) 317internal static bool IsRefScopedByDefault(bool useUpdatedEscapeRules, RefKind refKind) 319return useUpdatedEscapeRules && refKind == RefKind.Out; 615RefKind refKind, 659else if (refKind != RefKind.None && 713var refKind = GetModifiers(parameterSyntax.Modifiers, out SyntaxToken refnessKeyword, out SyntaxToken paramsKeyword, out SyntaxToken thisKeyword, out _); 719if (refKind == RefKind.Ref || refKind == RefKind.Out) 888internal static RefKind GetModifiers(SyntaxTokenList modifiers, out SyntaxToken refnessKeyword, out SyntaxToken paramsKeyword, out SyntaxToken thisKeyword, out ScopedKind scope) 890var refKind = RefKind.None; 902if (refKind == RefKind.None) 905refKind = RefKind.Out; 909if (refKind == RefKind.None) 912refKind = RefKind.Ref; 916if (refKind == RefKind.None) 919refKind = RefKind.In; 929Debug.Assert(refKind == RefKind.None); 937scope = (refKind == RefKind.None) ? ScopedKind.ScopedValue : ScopedKind.ScopedRef; 947internal static ImmutableArray<CustomModifier> ConditionallyCreateInModifiers(RefKind refKind, bool addRefReadOnlyModifier, Binder binder, BindingDiagnosticBag diagnostics, SyntaxNode syntax) 949if (addRefReadOnlyModifier && refKind == RefKind.In)
Symbols\Source\SourceClonedParameterSymbol.cs (1)
88public override RefKind RefKind
Symbols\Source\SourceComplexParameterSymbol.cs (8)
43RefKind refKind, 869return UseUpdatedEscapeRules && RefKind != RefKind.None; 1393case RefKind.Ref: 1400case RefKind.Out: 1407case RefKind.In: 1511RefKind refKind, 1533RefKind refKind, 1547Debug.Assert(refKind != RefKind.None || _refCustomModifiers.IsEmpty);
Symbols\Source\SourceConstructorSymbolBase.cs (2)
153public override RefKind RefKind 155get { return RefKind.None; }
Symbols\Source\SourceDelegateMethodSymbol.cs (17)
52returnTypeSyntax = returnTypeSyntax.SkipScoped(out _).SkipRefInLocalOrReturn(diagnostics, out RefKind refKind); 225SynthesizedParameterSymbol.Create(this, objectType, 0, RefKind.None, "object"), 226SynthesizedParameterSymbol.Create(this, intPtrType, 1, RefKind.None, "method"))); 234public override RefKind RefKind 236get { return RefKind.None; } 261private readonly RefKind _refKind; 266RefKind refKind, 291if (_refKind == RefKind.RefReadOnly) 309public override RefKind RefKind 335if (_refKind == RefKind.RefReadOnly) 380parameters.Add(SynthesizedParameterSymbol.Create(this, asyncCallbackType, paramCount, RefKind.None, GetUniqueParameterName(parameters, "callback"))); 381parameters.Add(SynthesizedParameterSymbol.Create(this, objectType, paramCount + 1, RefKind.None, GetUniqueParameterName(parameters, "object"))); 391public override RefKind RefKind 393get { return RefKind.None; } 422if (p.RefKind != RefKind.None) 429parameters.Add(SynthesizedParameterSymbol.Create(this, iAsyncResultType, ordinal++, RefKind.None, GetUniqueParameterName(parameters, "result"))); 437public override RefKind RefKind => _invoke.RefKind;
Symbols\Source\SourceDestructorSymbol.cs (2)
113public override RefKind RefKind 115get { return RefKind.None; }
Symbols\Source\SourceEnumConstantSymbol.cs (2)
59public sealed override RefKind RefKind => RefKind.None;
Symbols\Source\SourceEventAccessorSymbol.cs (2)
166public override RefKind RefKind 168get { return RefKind.None; }
Symbols\Source\SourceFieldSymbol.cs (1)
138if (RefKind == RefKind.RefReadOnly)
Symbols\Source\SourceLocalSymbol.cs (3)
33private readonly RefKind _refKind; 67_scope = _refKind != RefKind.None 481public override RefKind RefKind
Symbols\Source\SourceMemberContainerSymbol.cs (18)
2055var refKind1 = method1.Parameters[i].RefKind; 2056var refKind2 = method2.Parameters[i].RefKind; 3683if (methodParam.RefKind != RefKind.None) 3706methodParams[0].RefKind == RefKind.None && 4030RefKind.Out 4032RefKind.None, 4077RefKind.None 4079RefKind.None, 4125RefKind.None)), 4126RefKind.None, 4181RefKind.None, 4262RefKind.None, 4355RefKind.None, 4386RefKind.None, 4451RefKind.None 4453RefKind.None, 4650_ = fieldSyntax.Declaration.Type.SkipScoped(out _).SkipRefInField(out var refKind); 4659var modifiers = SourceMemberFieldSymbol.MakeModifiers(this, fieldSyntax.Declaration.Variables[0].Identifier, fieldSyntax.Modifiers, isRefField: refKind != RefKind.None, diagnostics, out modifierErrors);
Symbols\Source\SourceMemberContainerSymbol_ImplementationChecks.cs (14)
1279overrideMethod.RefKind == RefKind.Ref ? RefKind.Ref : RefKind.Out, 1345RefKind refKind, 1351case RefKind.Ref: 1357case RefKind.Out: 1392(method.RefKind is RefKind.Ref or RefKind.RefReadOnly)) 1396else if (parameters.Any(p => (p.RefKind is RefKind.Ref or RefKind.Out) && p.Type.IsRefLikeType)) 1407int nRefParameters = parameters.Count(p => p.RefKind is RefKind.Ref or RefKind.In or RefKind.Out); 1412else if (parameters.Any(p => p.RefKind == RefKind.None && p.Type.IsRefLikeType))
Symbols\Source\SourceMemberFieldSymbol.cs (13)
319internal readonly RefKind RefKind; 322internal TypeAndRefKind(RefKind refKind, TypeWithAnnotations type) 417public sealed override RefKind RefKind => GetTypeAndRefKind(ConsList<FieldSymbol>.Empty).RefKind; 447RefKind refKind = RefKind.None; 485Debug.Assert(refKind is RefKind.None or RefKind.Ref or RefKind.RefReadOnly); 487if (refKind != RefKind.None) 503type = binder.BindTypeOrVarKeyword(typeSyntax.SkipScoped(out _).SkipRefInField(out RefKind refKindToAssert), diagnostics, out isVar); 504Debug.Assert(refKindToAssert == RefKind.None); // Otherwise we might need to report an error 535var initializerOpt = executableBinder.BindInferredVariableInitializer(diagnostics, RefKind.None, syntaxNode, declarator); 564if (refKind != RefKind.None)
Symbols\Source\SourceMethodSymbol.cs (1)
65if (parameter.RefKind != RefKind.None)
Symbols\Source\SourceMethodSymbolWithAttributes.cs (4)
710if (param.RefKind == RefKind.Out) 960static void checkAndReportManagedTypes(TypeSymbol type, RefKind refKind, SyntaxNode syntax, bool isParam, BindingDiagnosticBag diagnostics) 962if (refKind != RefKind.None) 1085if (this.RefKind != RefKind.None)
Symbols\Source\SourceOrdinaryMethodOrUserDefinedOperatorSymbol.cs (2)
125else if (RefKind == RefKind.RefReadOnly) 250if (RefKind == RefKind.RefReadOnly)
Symbols\Source\SourceOrdinaryMethodSymbol.cs (6)
25private readonly RefKind _refKind; 165Debug.Assert(this.RefKind == RefKind.None || !returnType.IsVoidType() || returnTypeSyntax.HasErrors); 222var parameter0RefKind = this.Parameters[0].RefKind; 231else if (parameter0RefKind == RefKind.Ref && !parameter0Type.Type.IsValueType) 235else if (parameter0RefKind == RefKind.In && parameter0Type.TypeKind != TypeKind.Struct) 369public override RefKind RefKind
Symbols\Source\SourceOrdinaryMethodSymbolBase.cs (1)
343else if (IsPartial && !HasExplicitAccessModifier && Parameters.Any(static p => p.RefKind == RefKind.Out))
Symbols\Source\SourceParameterSymbol.cs (6)
27private readonly RefKind _refKind; 35RefKind refKind, 103RefKind refKind, 217public sealed override RefKind RefKind 287internal override bool IsMetadataIn => RefKind == RefKind.In; 289internal override bool IsMetadataOut => RefKind == RefKind.Out;
Symbols\Source\SourceParameterSymbolBase.cs (1)
112if (this.RefKind == RefKind.RefReadOnly)
Symbols\Source\SourcePropertyAccessorSymbol.cs (1)
341public sealed override RefKind RefKind
Symbols\Source\SourcePropertySymbolBase.cs (10)
52private readonly RefKind _refKind; 84RefKind refKind, 216_lazyRefCustomModifiers = _refKind != RefKind.None ? overriddenOrImplementedProperty.RefCustomModifiers : ImmutableArray<CustomModifier>.Empty; 235else if (_refKind == RefKind.RefReadOnly) 282public sealed override RefKind RefKind 670if (RefKind != RefKind.None && IsRequired) 696if (this.RefKind != RefKind.None) 718if (_refKind != RefKind.None) 745else if (RefKind != RefKind.None) 814if (_refKind == RefKind.RefReadOnly)
Symbols\Source\SourceSimpleParameterSymbol.cs (1)
20RefKind refKind,
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (4)
331if (p.RefKind != RefKind.None && p.RefKind != RefKind.In) 801public sealed override RefKind RefKind 803get { return RefKind.None; }
Symbols\Source\ThisParameterSymbol.cs (5)
35public override RefKind RefKind 41return RefKind.None; 46return RefKind.Out; 51return RefKind.In; 54return RefKind.Ref;
Symbols\SubstitutedFieldSymbol.cs (1)
106public override RefKind RefKind => _underlyingField.RefKind;
Symbols\SymbolExtensions.cs (4)
481internal static void GetTypeOrReturnType(this Symbol symbol, out RefKind refKind, out TypeWithAnnotations returnType, 488refKind = RefKind.None; 506refKind = RefKind.None; 523refKind = RefKind.None;
Symbols\Synthesized\Records\SynthesizedPrimaryConstructorParameterBackingFieldSymbol.cs (2)
45public override RefKind RefKind => RefKind.None;
Symbols\Synthesized\Records\SynthesizedRecordBaseEquals.cs (1)
40ordinal: 0, RefKind.None, ScopedKind.None, "other", Locations)),
Symbols\Synthesized\Records\SynthesizedRecordClone.cs (1)
129if (ctor.ParameterCount == 1 && ctor.Parameters[0].RefKind == RefKind.None &&
Symbols\Synthesized\Records\SynthesizedRecordCopyCtor.cs (2)
30RefKind.None, 133method.Parameters[0].RefKind == RefKind.None;
Symbols\Synthesized\Records\SynthesizedRecordDeconstruct.cs (1)
48RefKind.Out,
Symbols\Synthesized\Records\SynthesizedRecordEqualityContractProperty.cs (1)
37RefKind.None,
Symbols\Synthesized\Records\SynthesizedRecordEqualityOperator.cs (1)
45if (member is MethodSymbol candidate && candidate.ParameterCount == 1 && candidate.Parameters[0].RefKind == RefKind.None &&
Symbols\Synthesized\Records\SynthesizedRecordEqualityOperatorBase.cs (2)
73ordinal: 0, RefKind.None, ScopedKind.None, "left", Locations), 76ordinal: 1, RefKind.None, ScopedKind.None, "right", Locations)));
Symbols\Synthesized\Records\SynthesizedRecordEquals.cs (1)
45ordinal: 0, RefKind.None, ScopedKind.None, "other", Locations)),
Symbols\Synthesized\Records\SynthesizedRecordObjEquals.cs (1)
36ordinal: 0, RefKind.None, ScopedKind.None, "obj", Locations)),
Symbols\Synthesized\Records\SynthesizedRecordOrdinaryMethod.cs (2)
83public sealed override RefKind RefKind => RefKind.None;
Symbols\Synthesized\Records\SynthesizedRecordPrintMembers.cs (1)
97ordinal: 0, RefKind.None, ScopedKind.None, "builder", Locations)),
Symbols\Synthesized\Records\SynthesizedRecordPropertySymbol.cs (1)
34RefKind.None,
Symbols\Synthesized\RefKindVector.cs (9)
38internal RefKind this[int index] 45(false, false) => RefKind.None, 46(false, true) => RefKind.Ref, 47(true, false) => RefKind.Out, 48(true, true) => RefKind.RefReadOnly, 56RefKind.None => (false, false), 57RefKind.Ref => (false, true), 58RefKind.Out => (true, false), 59RefKind.RefReadOnly => (true, true),
Symbols\Synthesized\SynthesizedAccessorValueParameterSymbol.cs (1)
21: base(accessor, ordinal, paramType, RefKind.None, ParameterSymbol.ValueParameterName, accessor.Locations,
Symbols\Synthesized\SynthesizedBackingFieldSymbol.cs (4)
92Debug.Assert(property.RefKind is RefKind.None or RefKind.Ref or RefKind.RefReadOnly); 112public override RefKind RefKind => _property.RefKind;
Symbols\Synthesized\SynthesizedDelegateSymbol.cs (6)
21SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(objectType), 0, RefKind.None, "object"), 22SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(intPtrType), 1, RefKind.None, "method")); 35internal ParameterDescription(TypeWithAnnotations type, RefKind refKind, ScopedKind scope, ConstantValue? defaultValue, bool isParams, bool hasUnscopedRefAttribute) 46internal readonly RefKind RefKind; 59RefKind refKind) 163public override RefKind RefKind { get; }
Symbols\Synthesized\SynthesizedEmbeddedNativeIntegerAttributeSymbol.cs (1)
53m => ImmutableArray.Create(SynthesizedParameterSymbol.Create(m, boolArrayType, 0, RefKind.None)),
Symbols\Synthesized\SynthesizedEmbeddedNullableAttributeSymbol.cs (2)
53m => ImmutableArray.Create(SynthesizedParameterSymbol.Create(m, annotatedByteType, 0, RefKind.None)), 57m => ImmutableArray.Create(SynthesizedParameterSymbol.Create(m, byteArrayType, 0, RefKind.None)),
Symbols\Synthesized\SynthesizedEmbeddedNullableContextAttributeSymbol.cs (1)
41m => ImmutableArray.Create(SynthesizedParameterSymbol.Create(m, TypeWithAnnotations.Create(systemByteType), 0, RefKind.None)),
Symbols\Synthesized\SynthesizedEmbeddedNullablePublicOnlyAttributeSymbol.cs (1)
41m => ImmutableArray.Create(SynthesizedParameterSymbol.Create(m, TypeWithAnnotations.Create(systemBooleanType), 0, RefKind.None)),
Symbols\Synthesized\SynthesizedEmbeddedRefSafetyRulesAttributeSymbol.cs (1)
39m => ImmutableArray.Create(SynthesizedParameterSymbol.Create(m, TypeWithAnnotations.Create(int32Type), 0, RefKind.None)),
Symbols\Synthesized\SynthesizedEntryPointSymbol.cs (10)
115public override RefKind RefKind 117get { return RefKind.None; } 299default(ImmutableArray<RefKind>), 350argumentRefKindsOpt: default(ImmutableArray<RefKind>), 398refKind: RefKind.None, 416refKind: RefKind.None, 509RefKind.None, 528TypeWithAnnotations.Create(submissionArrayType), 0, RefKind.None, "submissionArray")); 579argumentRefKindsOpt: default(ImmutableArray<RefKind>), 599RefKind.None,
Symbols\Synthesized\SynthesizedEnumValueFieldSymbol.cs (2)
29public override RefKind RefKind => RefKind.None;
Symbols\Synthesized\SynthesizedFieldSymbol.cs (2)
36public override RefKind RefKind => RefKind.None;
Symbols\Synthesized\SynthesizedGlobalMethodSymbol.cs (2)
198public override RefKind RefKind 200get { return RefKind.None; }
Symbols\Synthesized\SynthesizedImplementationMethod.cs (1)
96public override RefKind RefKind
Symbols\Synthesized\SynthesizedInstanceConstructor.cs (2)
149public override RefKind RefKind 151get { return RefKind.None; }
Symbols\Synthesized\SynthesizedInteractiveInitializerMethod.cs (2)
114public override RefKind RefKind 116get { return RefKind.None; }
Symbols\Synthesized\SynthesizedIntrinsicOperatorSymbol.cs (5)
216public override RefKind RefKind 220return RefKind.None; 468) : base(container, TypeWithAnnotations.Create(type), ordinal, RefKind.None, ScopedKind.None, name) 472internal override bool IsMetadataIn => RefKind == RefKind.In; 474internal override bool IsMetadataOut => RefKind == RefKind.Out;
Symbols\Synthesized\SynthesizedLambdaCacheFieldSymbol.cs (2)
36public override RefKind RefKind => RefKind.None;
Symbols\Synthesized\SynthesizedLocal.cs (5)
27private readonly RefKind _refKind; 41RefKind refKind = RefKind.None 51Debug.Assert(refKind != RefKind.Out); 98public sealed override RefKind RefKind
Symbols\Synthesized\SynthesizedParameterSymbol.cs (11)
22private readonly RefKind _refKind; 29RefKind refKind, 47public override RefKind RefKind => _refKind; 179if (this.RefKind == RefKind.RefReadOnly) 224RefKind refKind, 231internal sealed override bool IsMetadataIn => RefKind == RefKind.In; 233internal sealed override bool IsMetadataOut => RefKind == RefKind.Out; 239RefKind refKind, 328RefKind refKind, 384internal override bool IsMetadataIn => RefKind == RefKind.In || _baseParameterForAttributes?.GetDecodedWellKnownAttributeData()?.HasInAttribute == true; 386internal override bool IsMetadataOut => RefKind == RefKind.Out || _baseParameterForAttributes?.GetDecodedWellKnownAttributeData()?.HasOutAttribute == true;
Symbols\Synthesized\SynthesizedSealedPropertyAccessor.cs (1)
181public override RefKind RefKind
Symbols\Synthesized\SynthesizedSimpleProgramEntryPointSymbol.cs (3)
67TypeWithAnnotations.Create(Binder.GetSpecialType(compilation, SpecialType.System_String, NoLocation.Singleton, diagnostics)))), 0, RefKind.None, "args")); 146public override RefKind RefKind 150return RefKind.None;
Symbols\Synthesized\SynthesizedStaticConstructor.cs (2)
127public override RefKind RefKind 131return RefKind.None;
Symbols\Synthesized\SynthesizedStringHashFunctionSymbol.cs (2)
21this.SetParameters(ImmutableArray.Create<ParameterSymbol>(SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(paramType), 0, RefKind.None, "s"))); 31this.SetParameters(ImmutableArray.Create<ParameterSymbol>(SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(paramType), 0, RefKind.None, "s")));
Symbols\Synthesized\SynthesizedSubmissionConstructor.cs (1)
29SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(submissionArrayType), 0, RefKind.None, "submissionArray"));
Symbols\Synthesized\SynthesizedThrowIfNullMethod.cs (2)
22SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(argumentParamType), ordinal: 0, RefKind.None, "argument"), 23SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(paramNameParamType), ordinal: 1, RefKind.None, "paramName")));
Symbols\Synthesized\SynthesizedThrowMethod.cs (1)
18this.SetParameters(ImmutableArray.Create<ParameterSymbol>(SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(paramType), 0, RefKind.None, "paramName")));
Symbols\Synthesized\SynthesizedThrowSwitchExpressionExceptionMethod.cs (1)
19this.SetParameters(ImmutableArray.Create(SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(paramType), 0, RefKind.None, "unmatchedValue")));
Symbols\Synthesized\TypeSubstitutedLocalSymbol.cs (1)
102public override RefKind RefKind
Symbols\Tuples\TupleErrorFieldSymbol.cs (2)
157public override RefKind RefKind => RefKind.None;
Symbols\Tuples\TupleFieldSymbol.cs (1)
124public sealed override RefKind RefKind => _underlyingField.RefKind;
Symbols\TypeSymbol.cs (2)
1960RefKind interfaceMemberRefKind = RefKind.None;
Symbols\UpdatedContainingSymbolLocal.cs (1)
79public override RefKind RefKind => _underlyingLocal.RefKind;
Symbols\VarianceSafety.cs (3)
163requireInputSafety: method.RefKind != RefKind.None, 199requireInputSafety: hasSetter || !(property.GetMethod?.RefKind == RefKind.None), 242requireOutputSafety: param.RefKind != RefKind.None,
Symbols\Wrapped\WrappedMethodSymbol.cs (1)
56public override RefKind RefKind
Symbols\Wrapped\WrappedParameterSymbol.cs (1)
44public sealed override RefKind RefKind
Symbols\Wrapped\WrappedPropertySymbol.cs (1)
47public override RefKind RefKind
Syntax\SyntaxNodeExtensions.cs (11)
222internal static RefKind GetRefKindInLocalOrReturn(this TypeSyntax syntax, BindingDiagnosticBag diagnostics) 224syntax.SkipRefInLocalOrReturn(diagnostics, out var refKind); 238internal static TypeSyntax SkipRefInField(this TypeSyntax syntax, out RefKind refKind) 245internal static TypeSyntax SkipRefInLocalOrReturn(this TypeSyntax syntax, BindingDiagnosticBag? diagnostics, out RefKind refKind) 248private static TypeSyntax SkipRefWorker(TypeSyntax syntax, BindingDiagnosticBag? diagnostics, out RefKind refKind) 254? RefKind.RefReadOnly 255: RefKind.Ref; 283refKind = RefKind.None; 320out RefKind refKind) 324refKind = RefKind.None; 331refKind = RefKind.Ref;
Microsoft.CodeAnalysis.CSharp.CodeStyle (12)
ArgumentSyntaxExtensions.cs (7)
25public static RefKind GetRefKind(this ArgumentSyntax? argument) 28SyntaxKind.RefKeyword => RefKind.Ref, 29SyntaxKind.OutKeyword => RefKind.Out, 30SyntaxKind.InKeyword => RefKind.In, 31_ => RefKind.None, 83parameter.RefKind != RefKind.Out) 89parameter.RefKind != RefKind.Ref)
CastSimplifier.cs (3)
560if (castedSymbol is not IFieldSymbol and not ILocalSymbol and not IParameterSymbol and not IParameterSymbol { RefKind: RefKind.Ref }) 1242if (operation is IPropertyReferenceOperation { Property.RefKind: not RefKind.Ref }) 1246if (operation is IInvocationOperation { TargetMethod.RefKind: not RefKind.Ref })
CSharpSyntaxFacts.cs (1)
590public RefKind GetRefKindOfArgument(SyntaxNode node)
ExpressionSyntaxExtensions.cs (1)
373ReducedFrom.Parameters: [{ RefKind: RefKind.Ref }, ..],
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (12)
AbstractAssignOutParametersCodeFixProvider.cs (1)
115.Where(p => p.RefKind == RefKind.Out)
CSharpSyntaxGeneratorInternal.cs (6)
120internal static SyntaxTokenList GetParameterModifiers(RefKind refKind, bool forFunctionPointerReturnParameter = false) 123RefKind.None => new SyntaxTokenList(), 124RefKind.Out => SyntaxFactory.TokenList(SyntaxFactory.Token(SyntaxKind.OutKeyword)), 125RefKind.Ref => SyntaxFactory.TokenList(SyntaxFactory.Token(SyntaxKind.RefKeyword)), 129RefKind.In when !forFunctionPointerReturnParameter => SyntaxFactory.TokenList(SyntaxFactory.Token(SyntaxKind.InKeyword)), 130RefKind.RefReadOnly when forFunctionPointerReturnParameter => SyntaxFactory.TokenList(SyntaxFactory.Token(SyntaxKind.RefKeyword), SyntaxFactory.Token(SyntaxKind.ReadOnlyKeyword)),
CSharpTypeInferenceService.TypeInferrer.cs (3)
727return InferTypeInArgument(index, parameterizedSymbols, name, RefKind.None); 760var refKind = argumentOpt.GetRefKind(); 769RefKind refKind)
MakeLocalFunctionStaticCodeFixHelper.cs (1)
223refKind: RefKind.None,
RemoveInKeywordCodeFixProvider.cs (1)
48if (argumentSyntax == null || argumentSyntax.GetRefKind() != RefKind.In)
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (154)
CodeGen\CodeGenFunctionPointersTests.cs (63)
102(RefKind.None, IsSpecialType(SpecialType.System_Int32)), 103(RefKind.None, IsSpecialType(SpecialType.System_String))); 146(RefKind.Ref, IsArrayType(IsSpecialType(SpecialType.System_Int32))), 147(RefKind.Ref, IsTypeName("C")), 148(RefKind.Ref, IsSpecialType(SpecialType.System_String))); 170(RefKind.Ref, IsArrayType(IsSpecialType(SpecialType.System_Int32))), 171(RefKind.Out, IsTypeName("C")), 172(RefKind.Out, IsSpecialType(SpecialType.System_String))); 197(RefKind.None, IsVoidType()), 198(RefKind.None, IsFunctionPointerTypeSymbol(CallingConvention.Standard, 199(RefKind.None, IsVoidType()), 200(RefKind.None, IsSpecialType(SpecialType.System_Int32))) 205(RefKind.None, IsFunctionPointerTypeSymbol(CallingConvention.Default, 206(RefKind.None, IsTypeName("S")))), 207(RefKind.None, IsTypeName("C"))); 229(RefKind.RefReadOnly, IsSpecialType(SpecialType.System_Boolean)), 230(RefKind.In, IsSpecialType(SpecialType.System_String)), 231(RefKind.In, IsSpecialType(SpecialType.System_Int32))); 565(RefKind.RefReadOnly, IsSpecialType(SpecialType.System_Int32))); 569(RefKind.RefReadOnly, IsSpecialType(SpecialType.System_Int32))); 573(RefKind.None, IsVoidType()), 574(RefKind.Out, IsSpecialType(SpecialType.System_Int32))); 578(RefKind.None, IsVoidType()), 579(RefKind.In, IsSpecialType(SpecialType.System_Int32))); 583(RefKind.None, IsVoidType()), 584(RefKind.Out, IsSpecialType(SpecialType.System_Int32))); 588(RefKind.None, IsVoidType()), 589(RefKind.In, IsSpecialType(SpecialType.System_Int32))); 649(RefKind.None, IsVoidType()), 650(RefKind.Ref, 652(RefKind.RefReadOnly, IsSpecialType(SpecialType.System_String))))); 655(RefKind.None, 657(RefKind.None, IsSpecialType(SpecialType.System_Int32)))), 658(RefKind.In, 660(RefKind.None, 662(RefKind.None, IsVoidType())))))); 690(RefKind.RefReadOnly, IsSpecialType(SpecialType.System_Boolean)), 691(RefKind.In, IsSpecialType(SpecialType.System_Int32))); 746(RefKind.Ref, IsSpecialType(SpecialType.System_Boolean)), 747(RefKind.Ref, IsSpecialType(SpecialType.System_Int32))); 790(RefKind.None, IsVoidType()), 791(RefKind.None, IsSpecialType(SpecialType.System_String)))); 794(RefKind.None, IsSpecialType(SpecialType.System_Int32)))); 820(RefKind.None, IsTypeName("C")), 821(RefKind.None, IsTypeName("C"))); 988(RefKind.None, IsVoidType())); 996(RefKind.None, IsVoidType())); 7661returnRefKind: RefKind.None, parameterTypes: ImmutableArray<TypeWithAnnotations>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, 7665parameterRefCustomModifiers: default, returnRefKind: RefKind.Ref, parameterTypes: ImmutableArray<TypeWithAnnotations>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, 7670parameterRefCustomModifiers: default, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<TypeWithAnnotations>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, 7674parameterRefCustomModifiers: default, returnRefKind: RefKind.Ref, parameterTypes: ImmutableArray<TypeWithAnnotations>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, 7746returnRefKind: RefKind.None, parameterTypes: ImmutableArray<TypeWithAnnotations>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, 7750returnRefKind: RefKind.Ref, parameterTypes: ImmutableArray<TypeWithAnnotations>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, 7755returnRefKind: RefKind.None, parameterTypes: ImmutableArray<TypeWithAnnotations>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, 7759returnRefKind: RefKind.Ref, parameterTypes: ImmutableArray<TypeWithAnnotations>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty,
CodeGen\CodeGenLocalFunctionTests.cs (12)
3136Assert.Equal(RefKind.Ref, goo.Parameters[0].RefKind); 3161Assert.Equal(RefKind.Ref, goo.Parameters[0].RefKind); 3162Assert.Equal(RefKind.Ref, bar.Parameters[0].RefKind); 3163Assert.Equal(RefKind.Ref, bar.Parameters[1].RefKind); 3214Assert.Equal(RefKind.Ref, inner.Parameters[0].RefKind); 3215Assert.Equal(RefKind.Ref, inner.Parameters[1].RefKind); 3216Assert.Equal(RefKind.Ref, middle.Parameters[0].RefKind); 3279Assert.Equal(RefKind.Ref, goo.Parameters[0].RefKind); 3318Assert.Equal(RefKind.Ref, goo.Parameters[1].RefKind); 3319Assert.Equal(RefKind.Ref, bar.Parameters[1].RefKind); 3320Assert.Equal(RefKind.Ref, bar.Parameters[2].RefKind); 6170var synthesizedParam = SynthesizedParameterSymbol.Create(localFunction, param.TypeWithAnnotations, ordinal: 0, RefKind.Out, param.Name, baseParameterForAttributes: (SourceComplexParameterSymbolBase)param);
CodeGen\CodeGenReadonlyStructTests.cs (61)
829Assert.Equal(RefKind.Out, namedType.Constructors[0].ThisParameter.RefKind); 830Assert.Equal(RefKind.In, namedType.GetMethod("M1").ThisParameter.RefKind); 831Assert.Equal(RefKind.In, namedType.GetMethod("ToString").ThisParameter.RefKind); 846Assert.Equal(RefKind.Out, namedType.Constructors[0].ThisParameter.RefKind); 847Assert.Equal(RefKind.In, namedType.GetMethod("M1").ThisParameter.RefKind); 848Assert.Equal(RefKind.In, namedType.GetMethod("ToString").ThisParameter.RefKind); 853Assert.Equal(RefKind.Out, namedType.Constructors[0].ThisParameter.RefKind); 854Assert.Equal(RefKind.In, namedType.GetMethod("M1").ThisParameter.RefKind); 855Assert.Equal(RefKind.In, namedType.GetMethod("ToString").ThisParameter.RefKind); 860Assert.Equal(RefKind.Out, namedType.Constructors[0].ThisParameter.RefKind); 861Assert.Equal(RefKind.In, namedType.GetMethod("M1").ThisParameter.RefKind); 862Assert.Equal(RefKind.In, namedType.GetMethod("ToString").ThisParameter.RefKind); 867Assert.Equal(RefKind.Out, namedType.Constructors[0].ThisParameter.RefKind); 868Assert.Equal(RefKind.Ref, namedType.GetMethod("M1").ThisParameter.RefKind); 869Assert.Equal(RefKind.Ref, namedType.GetMethod("ToString").ThisParameter.RefKind); 874Assert.Equal(RefKind.None, namedType.Constructors[0].ThisParameter.RefKind); 875Assert.Equal(RefKind.None, namedType.GetMethod("M1").ThisParameter.RefKind); 876Assert.Equal(RefKind.None, namedType.GetMethod("ToString").ThisParameter.RefKind); 881Assert.Equal(RefKind.None, namedType.Constructors[0].ThisParameter.RefKind); 882Assert.Equal(RefKind.None, namedType.GetMethod("Invoke").ThisParameter.RefKind); 913Assert.Equal(RefKind.Out, s1.Constructors[0].ThisParameter.RefKind); 914Assert.Equal(RefKind.In, s1.GetMethod("M1").ThisParameter.RefKind); 915Assert.Equal(RefKind.In, s1.GetMethod("ToString").ThisParameter.RefKind); 1003Assert.Equal(RefKind.Out, namedType.Constructors[0].ThisParameter.RefKind); 1004Assert.Equal(RefKind.In, namedType.GetMethod("M1").ThisParameter.RefKind); 1005Assert.Equal(RefKind.In, namedType.GetMethod("ToString").ThisParameter.RefKind); 1010Assert.Equal(RefKind.Out, namedType.Constructors[0].ThisParameter.RefKind); 1011Assert.Equal(RefKind.In, namedType.GetMethod("M1").ThisParameter.RefKind); 1012Assert.Equal(RefKind.In, namedType.GetMethod("ToString").ThisParameter.RefKind); 1017Assert.Equal(RefKind.Out, namedType.Constructors[0].ThisParameter.RefKind); 1018Assert.Equal(RefKind.In, namedType.GetMethod("M1").ThisParameter.RefKind); 1019Assert.Equal(RefKind.In, namedType.GetMethod("ToString").ThisParameter.RefKind); 1024Assert.Equal(RefKind.Out, namedType.Constructors[0].ThisParameter.RefKind); 1025Assert.Equal(RefKind.In, namedType.GetMethod("M1").ThisParameter.RefKind); 1026Assert.Equal(RefKind.In, namedType.GetMethod("ToString").ThisParameter.RefKind); 1031Assert.Equal(RefKind.Out, namedType.Constructors[0].ThisParameter.RefKind); 1032Assert.Equal(RefKind.Ref, namedType.GetMethod("M1").ThisParameter.RefKind); 1033Assert.Equal(RefKind.Ref, namedType.GetMethod("ToString").ThisParameter.RefKind); 1038Assert.Equal(RefKind.None, namedType.Constructors[0].ThisParameter.RefKind); 1039Assert.Equal(RefKind.None, namedType.GetMethod("M1").ThisParameter.RefKind); 1040Assert.Equal(RefKind.None, namedType.GetMethod("ToString").ThisParameter.RefKind); 1045Assert.Equal(RefKind.None, namedType.Constructors[0].ThisParameter.RefKind); 1046Assert.Equal(RefKind.None, namedType.GetMethod("Invoke").ThisParameter.RefKind); 1571verifyReadOnly(s1.GetMethod("M1"), false, RefKind.Ref); 1572verifyReadOnly(s1.GetMethod("M2"), true, RefKind.RefReadOnly); 1574verifyReadOnly(s1.GetProperty("P1").GetMethod, true, RefKind.RefReadOnly); 1575verifyReadOnly(s1.GetProperty("P1").SetMethod, false, RefKind.Ref); 1577verifyReadOnly(s1.GetProperty("P2").GetMethod, true, RefKind.RefReadOnly); 1579verifyReadOnly(s1.GetProperty("P3").GetMethod, true, RefKind.RefReadOnly); 1580verifyReadOnly(s1.GetProperty("P3").SetMethod, false, RefKind.Ref); 1582verifyReadOnly(s1.GetProperty("P4").GetMethod, false, RefKind.Ref); 1583verifyReadOnly(s1.GetProperty("P4").SetMethod, true, RefKind.RefReadOnly); 1588verifyReadOnly(s1.GetEvent("E").AddMethod, true, RefKind.RefReadOnly); 1589verifyReadOnly(s1.GetEvent("E").RemoveMethod, true, RefKind.RefReadOnly); 1593verifyReadOnly(s2.GetMethod("M1"), true, RefKind.RefReadOnly); 1595verifyReadOnly(s2.GetProperty("P1").GetMethod, true, RefKind.RefReadOnly); 1596verifyReadOnly(s2.GetProperty("P2").GetMethod, true, RefKind.RefReadOnly); 1597verifyReadOnly(s2.GetProperty("P3").SetMethod, true, RefKind.RefReadOnly); 1602verifyReadOnly(s2.GetEvent("E").AddMethod, true, RefKind.RefReadOnly); 1603verifyReadOnly(s2.GetEvent("E").RemoveMethod, true, RefKind.RefReadOnly); 1605void verifyReadOnly(MethodSymbol method, bool isReadOnly, RefKind? refKind)
Emit\EmitCustomModifiers.cs (3)
605Assert.Equal(RefKind.Ref, parameter.RefKind); 661Assert.Equal(RefKind.Ref, baseParameter.RefKind); 669Assert.Equal(RefKind.Ref, derivedParameter.RefKind);
Emit\EmitMetadataTests.cs (5)
448Assert.Equal(RefKind.Ref, parameter1.RefKind); 2025Assert.Equal(RefKind.None, m.Parameters[0].RefKind); 2026Assert.Equal(RefKind.Ref, m.Parameters[1].RefKind); 2027Assert.Equal(RefKind.Out, m.Parameters[2].RefKind); 2091if (invoke.Parameters[i].RefKind != RefKind.None)
Emit\InAttributeModifierTests.cs (4)
3827Assert.Equal(RefKind.RefReadOnly, interfaceMethod.RefKind); 3832Assert.Equal(RefKind.None, classMethod.RefKind); 3856Assert.Equal(RefKind.RefReadOnly, parentMethod.RefKind); 3861Assert.Equal(RefKind.None, classMethod.RefKind);
Emit\NoPiaEmbedTypes.cs (6)
1522Assert.Equal(RefKind.Ref, param.RefKind); 1527Assert.Equal(RefKind.Out, param.RefKind); 1532Assert.Equal(RefKind.Ref, param.RefKind); 1537Assert.Equal(RefKind.Ref, param.RefKind); 1542Assert.Equal(RefKind.None, param.RefKind); 1548Assert.Equal(RefKind.None, param.RefKind);
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (44)
Attributes\AttributeTests_RefReadOnly.cs (44)
38Assert.Equal(RefKind.RefReadOnly, method.RefKind); 42Assert.Equal(RefKind.In, parameter.RefKind); 68Assert.Equal(RefKind.In, parameter.RefKind); 92Assert.Equal(RefKind.RefReadOnly, method.RefKind); 120Assert.Equal(RefKind.RefReadOnly, method.RefKind); 124Assert.Equal(RefKind.In, parameter.RefKind); 154Assert.Equal(RefKind.In, parameter.RefKind); 206Assert.Equal(RefKind.In, parameter.RefKind); 233Assert.Equal(RefKind.In, parameter.RefKind); 277Assert.Equal(RefKind.In, parameter.RefKind); 310Assert.Equal(RefKind.RefReadOnly, property.RefKind); 339Assert.Equal(RefKind.RefReadOnly, property.RefKind); 376Assert.Equal(RefKind.RefReadOnly, property.RefKind); 402Assert.Equal(RefKind.RefReadOnly, indexer.RefKind); 406Assert.Equal(RefKind.In, parameter.RefKind); 426Assert.Equal(RefKind.In, parameter.RefKind); 446Assert.Equal(RefKind.RefReadOnly, indexer.RefKind); 474Assert.Equal(RefKind.RefReadOnly, indexer.RefKind); 478Assert.Equal(RefKind.In, parameter.RefKind); 501Assert.Equal(RefKind.RefReadOnly, method.RefKind); 505Assert.Equal(RefKind.In, parameter.RefKind); 522Assert.Equal(RefKind.In, parameter.RefKind); 537Assert.Equal(RefKind.RefReadOnly, method.RefKind); 561Assert.Equal(RefKind.RefReadOnly, method.RefKind); 565Assert.Equal(RefKind.In, parameter.RefKind); 598Assert.Equal(RefKind.RefReadOnly, method.RefKind); 602Assert.Equal(RefKind.In, parameter.RefKind); 626Assert.Equal(RefKind.In, parameter.RefKind); 652Assert.Equal(RefKind.RefReadOnly, method.RefKind); 686Assert.Equal(RefKind.RefReadOnly, method.RefKind); 690Assert.Equal(RefKind.In, parameter.RefKind); 725Assert.Equal(RefKind.RefReadOnly, method.RefKind); 729Assert.Equal(RefKind.In, parameter.RefKind); 757Assert.Equal(RefKind.In, parameter.RefKind); 784Assert.Equal(RefKind.RefReadOnly, method.RefKind); 819Assert.Equal(RefKind.RefReadOnly, method.RefKind); 823Assert.Equal(RefKind.In, parameter.RefKind); 1161Assert.Equal(RefKind.In, parameter.RefKind); 2346Assert.Equal(RefKind.RefReadOnly, method.RefKind); 2370Assert.Equal(RefKind.RefReadOnly, method.Parameters[0].RefKind); 2371Assert.Equal(RefKind.Ref, method.Parameters[1].RefKind); 2393Assert.Equal(RefKind.RefReadOnly, method.RefKind); 2417Assert.Equal(RefKind.Ref, method.Parameters[0].RefKind); 2418Assert.Equal(RefKind.RefReadOnly, method.Parameters[1].RefKind);
Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ExpressionCompiler (41)
CompilationContext.cs (7)
375return new BoundReturnStatement(syntax, RefKind.None, expression, @checked: false) { WasCompilerGenerated = true }; 634return new BoundReturnStatement(syntax, RefKind.None, expression, @checked: false) { WasCompilerGenerated = true }; 647return new BoundReturnStatement(syntax, RefKind.None, expression, @checked: false) { WasCompilerGenerated = true }; 659return new BoundReturnStatement(syntax, RefKind.None, expression, @checked: false) { WasCompilerGenerated = true }; 671var statement = new BoundReturnStatement(syntax, RefKind.None, expression, @checked: false) { WasCompilerGenerated = true }; 716RefKind.None, 742return new BoundReturnStatement(syntax, RefKind.None, expression, @checked: false) { WasCompilerGenerated = true };
CompilationExtensions.cs (2)
106RefKind refKind) 117RefKind refKind)
CSharpEESymbolProvider.cs (6)
38RefKind refKind; 43refKind = RefKind.None; 49refKind = info.IsByRef ? RefKind.Ref : RefKind.None; 67type = IncludeDynamicAndTupleElementNamesIfAny(type, RefKind.None, dynamicFlagsOpt, tupleElementNamesOpt); 111RefKind refKind,
CSharpInstructionDecoder.cs (2)
106case RefKind.Out: 109case RefKind.Ref:
EEAssemblyBuilder.cs (1)
109((local.RefKind == RefKind.None) ? LocalSlotConstraints.None : LocalSlotConstraints.ByRef);
Rewriters\LocalDeclarationRewriter.cs (1)
142var bytes = compilation.GetCustomTypeInfoPayload(local.Type, customModifiersCount: 0, refKind: RefKind.None);
SymbolExtensions.cs (1)
24return method.DeclaringCompilation.GetCustomTypeInfoPayload(method.ReturnType, method.ReturnTypeWithAnnotations.CustomModifiers.Length + method.RefCustomModifiers.Length, RefKind.None);
Symbols\DisplayClassInstance.cs (1)
46Debug.Assert(local.RefKind == RefKind.None);
Symbols\DisplayClassVariable.cs (2)
219public override RefKind RefKind => RefKind.None;
Symbols\EEConstructorSymbol.cs (1)
34new BoundReturnStatement(syntax, RefKind.None, null, @checked: false))));
Symbols\EEDisplayClassFieldLocalSymbol.cs (2)
75public override RefKind RefKind 77get { return RefKind.None; }
Symbols\EELocalConstantSymbol.cs (2)
97public override RefKind RefKind 99get { return RefKind.None; }
Symbols\EELocalSymbol.cs (4)
26private readonly RefKind _refKind; 36RefKind refKind, 51RefKind refKind, 139public override RefKind RefKind
Symbols\EEMethodSymbol.cs (2)
309public override RefKind RefKind 545statementsBuilder.Add(new BoundReturnStatement(syntax, RefKind.None, expressionOpt: null, @checked: false));
Symbols\PlaceholderLocalSymbol.cs (3)
114public override RefKind RefKind 116get { return RefKind.None; } 228RefKind.None,
Symbols\PlaceholderMethodSymbol.cs (2)
154public override RefKind RefKind 156get { return RefKind.None; }
Symbols\SynthesizedContextMethodSymbol.cs (2)
125public override RefKind RefKind 127get { return RefKind.None; }
Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ExpressionCompiler.UnitTests (2)
ExpressionCompilerTests.cs (2)
786Assert.Equal(RefKind.Ref, parameter.RefKind); 1034Assert.Equal(RefKind.Out, parameter.RefKind);
Microsoft.CodeAnalysis.CSharp.Features (34)
AbstractAssignOutParametersCodeFixProvider.cs (1)
115.Where(p => p.RefKind == RefKind.Out)
CodeRefactorings\ConvertLocalFunctionToMethod\CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs (2)
101refKind: dataFlow.WrittenInside.Contains(capture) ? RefKind.Ref : RefKind.None,
Completion\CompletionProviders\CrefCompletionProvider.cs (3)
319RefKind.Ref => "ref ", 320RefKind.Out => "out ", 321RefKind.In => "in ",
Completion\CompletionProviders\ExplicitInterfaceMemberCompletionProvider.CompletionSymbolDisplay.cs (3)
93RefKind.Out => "out ", 94RefKind.Ref => "ref ", 95RefKind.In => "in ",
Completion\Providers\ContextVariableArgumentProvider.cs (4)
38case RefKind.Ref: 42case RefKind.Out: 46case RefKind.In: 47case RefKind.None:
Completion\Providers\OutVariableArgumentProvider.cs (1)
32if (context.Parameter.RefKind != RefKind.Out)
ConvertLinq\CSharpConvertLinqQueryToForEachProvider.cs (2)
311methodSymbol.RefKind == RefKind.None) 348methodSymbol.RefKind == RefKind.None &&
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (1)
112refKind: RefKind.None,
GenerateConstructor\CSharpGenerateConstructorService.cs (1)
77refKind: RefKind.None,
GenerateMember\GenerateParameterizedMember\CSharpGenerateConversionService.cs (1)
215refKind: RefKind.None,
GenerateMember\GenerateParameterizedMember\CSharpGenerateDeconstructMethodService.cs (2)
57refKind: RefKind.Out, 69attributes: default, RefKind.Out, isParams: false, element.Type, element.Name));
GenerateMember\GenerateParameterizedMember\CSharpGenerateParameterizedMemberService.cs (4)
44protected override RefKind DetermineRefKind(CancellationToken cancellationToken) 45=> _invocationExpression.IsParentKind(SyntaxKind.RefExpression) ? RefKind.Ref : RefKind.None; 133protected override ImmutableArray<RefKind> DetermineParameterModifiers(CancellationToken cancellationToken)
GenerateType\CSharpGenerateTypeService.cs (1)
842refKind: RefKind.None,
ImplementInterface\CSharpImplementInterfaceService.cs (1)
97g.Argument(DisposingName, RefKind.None, g.FalseLiteralExpression()))));
MakeLocalFunctionStaticCodeFixHelper.cs (1)
223refKind: RefKind.None,
RemoveInKeywordCodeFixProvider.cs (1)
48if (argumentSyntax == null || argumentSyntax.GetRefKind() != RefKind.In)
SignatureHelp\AbstractCSharpSignatureHelpProvider.LightweightOverloadResolution.cs (5)
151var parameterRefKind = parameter.RefKind; 152if (parameterRefKind == RefKind.None) 173var argumentRefKind = argument.GetRefKind(); 174if (parameterRefKind == RefKind.In && argumentRefKind == RefKind.None)
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (2)
IOperation\IOperationTests.cs (2)
312Assert.Equal(RefKind.RefReadOnly, op.Locals.Single().RefKind); 380Assert.Equal(RefKind.RefReadOnly, op.Locals.Single().RefKind);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (349)
Semantics\FunctionPointerTests.cs (2)
3921(RefKind.None, IsVoidType()), 3922(RefKind.None, IsErrorType()));
Semantics\LambdaTests.cs (5)
6865Assert.Equal(RefKind.Ref, lambdas[0].Parameters[0].RefKind); 6866Assert.Equal(RefKind.In, lambdas[1].Parameters[0].RefKind); 6867Assert.Equal(RefKind.Out, lambdas[2].Parameters[0].RefKind); 7079Assert.Equal(RefKind.None, lambdaParameter1.RefKind); 7084Assert.Equal(RefKind.None, lambdaParameter2.RefKind);
Semantics\RecordStructTests.cs (2)
3411Assert.Equal(RefKind.Out, deconstruct.Parameters[0].RefKind); 3414Assert.Equal(RefKind.Out, deconstruct.Parameters[1].RefKind);
Semantics\RecordTests.cs (2)
14123Assert.Equal(RefKind.Out, deconstruct.Parameters[0].RefKind); 14126Assert.Equal(RefKind.Out, deconstruct.Parameters[1].RefKind);
Semantics\RefExtensionMethodsTests.cs (4)
2148Assert.Equal(RefKind.Ref, symbol.RefKind); 2167Assert.Equal(RefKind.In, symbol.RefKind); 2186Assert.Equal(RefKind.Ref, symbol.RefKind); 2205Assert.Equal(RefKind.In, symbol.RefKind);
Semantics\RefFieldTests.cs (332)
146VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F1"), "ref T S<T>.F1", RefKind.Ref, new string[0]); 147VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F2"), "ref readonly T S<T>.F2", RefKind.RefReadOnly, new string[0]); 152VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F1"), "ref T S<T>.F1", RefKind.Ref, new string[0]); 153VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F2"), "ref readonly T S<T>.F2", RefKind.RefReadOnly, new string[0]); 172VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F"), "ref T S<T>.F", RefKind.Ref, new string[0]); 177VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F"), "ref T S<T>.F", RefKind.Ref, new string[0]); 208VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F"), "ref T S<T>.F", RefKind.Ref, new string[0]); 218VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F"), "ref T S<T>.F", RefKind.Ref, new string[0]); 241VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F"), "ref readonly T S<T>.F", RefKind.RefReadOnly, new string[0]); 246VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F"), "ref readonly T S<T>.F", RefKind.RefReadOnly, new string[0]); 282VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F"), "ref readonly T S<T>.F", RefKind.RefReadOnly, new string[0]); 292VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F"), "ref readonly T S<T>.F", RefKind.RefReadOnly, new string[0]); 316VerifyFieldSymbol(field, "ref modopt(System.SByte) modopt(System.Object) System.Int32 A<System.Int32>.F", RefKind.Ref, new[] { "System.SByte", "System.Object" }); 344VerifyFieldSymbol(field, "ref readonly System.Int32 A.F", RefKind.RefReadOnly, new string[0]); 509VerifyFieldSymbol(tupleType.GetField("Item1"), "ref System.Int32 (System.Int32, System.Object).Item1", RefKind.Ref, new string[0] { }); 510VerifyFieldSymbol(tupleType.GetField("Item2"), "ref modopt(System.Object) modopt(System.SByte) System.Object (System.Int32, System.Object).Item2", RefKind.Ref, new[] { "System.Object", "System.SByte" }); 2104private static void VerifyFieldSymbol(FieldSymbol field, string expectedDisplayString, RefKind expectedRefKind, string[] expectedRefCustomModifiers) 10469VerifyParameterSymbol(parameters[0], "R x1", RefKind.None, ScopedKind.None); 10470VerifyParameterSymbol(parameters[1], "scoped R y1", RefKind.None, ScopedKind.ScopedValue); 10473VerifyParameterSymbol(parameters[0], "ref R x2", RefKind.Ref, ScopedKind.None); 10474VerifyParameterSymbol(parameters[1], "scoped ref R y2", RefKind.Ref, ScopedKind.ScopedRef); 10477VerifyParameterSymbol(parameters[0], "in R x3", RefKind.In, ScopedKind.None); 10478VerifyParameterSymbol(parameters[1], "scoped in R y3", RefKind.In, ScopedKind.ScopedRef); 10481VerifyParameterSymbol(parameters[0], "out R x4", RefKind.Out, useUpdatedEscapeRules ? ScopedKind.ScopedRef : ScopedKind.None); 10482VerifyParameterSymbol(parameters[1], "out R y4", RefKind.Out, ScopedKind.ScopedRef); 10518VerifyParameterSymbol(comp.GetMember<NamedTypeSymbol>("A").Constructors.Single(c => !c.IsImplicitlyDeclared).Parameters[0], "scoped ref T t", RefKind.Ref, ScopedKind.ScopedRef); 10519VerifyParameterSymbol(comp.GetMember<PropertySymbol>("A.this[]").GetMethod.Parameters[0], "scoped in System.Object o", RefKind.In, ScopedKind.ScopedRef); 10578VerifyParameterSymbol(localFunctions[0].Parameters[0], "R x1", RefKind.None, ScopedKind.None); 10579VerifyParameterSymbol(localFunctions[0].Parameters[1], "scoped R y1", RefKind.None, ScopedKind.ScopedValue); 10580VerifyParameterSymbol(localFunctions[1].Parameters[0], "ref System.Int32 x2", RefKind.Ref, ScopedKind.None); 10581VerifyParameterSymbol(localFunctions[1].Parameters[1], "scoped ref System.Int32 y2", RefKind.Ref, ScopedKind.ScopedRef); 10582VerifyParameterSymbol(localFunctions[2].Parameters[0], "in System.Int32 x3", RefKind.In, ScopedKind.None); 10583VerifyParameterSymbol(localFunctions[2].Parameters[1], "scoped in System.Int32 y3", RefKind.In, ScopedKind.ScopedRef); 10584VerifyParameterSymbol(localFunctions[3].Parameters[0], "out System.Int32 x4", RefKind.Out, useUpdatedEscapeRules ? ScopedKind.ScopedRef : ScopedKind.None); 10585VerifyParameterSymbol(localFunctions[3].Parameters[1], "out System.Int32 y4", RefKind.Out, ScopedKind.ScopedRef); 10586VerifyParameterSymbol(localFunctions[4].Parameters[0], "ref R x5", RefKind.Ref, ScopedKind.None); 10587VerifyParameterSymbol(localFunctions[4].Parameters[1], "scoped ref R y5", RefKind.Ref, ScopedKind.ScopedRef); 10588VerifyParameterSymbol(localFunctions[5].Parameters[0], "in R x6", RefKind.In, ScopedKind.None); 10589VerifyParameterSymbol(localFunctions[5].Parameters[1], "scoped in R y6", RefKind.In, ScopedKind.ScopedRef); 10590VerifyParameterSymbol(localFunctions[6].Parameters[0], "out R x7", RefKind.Out, useUpdatedEscapeRules ? ScopedKind.ScopedRef : ScopedKind.None); 10591VerifyParameterSymbol(localFunctions[6].Parameters[1], "out R y7", RefKind.Out, ScopedKind.ScopedRef); 10651verifyParameter(delegateTypesAndLambdas[0], 0, "R", "x1", RefKind.None, ScopedKind.None, false); 10652verifyParameter(delegateTypesAndLambdas[0], 1, "scoped R", "y1", RefKind.None, ScopedKind.ScopedValue, false); 10653verifyParameter(delegateTypesAndLambdas[1], 0, "ref System.Int32", "x2", RefKind.Ref, ScopedKind.None, false); 10654verifyParameter(delegateTypesAndLambdas[1], 1, "scoped ref System.Int32", "y2", RefKind.Ref, ScopedKind.ScopedRef, false); 10655verifyParameter(delegateTypesAndLambdas[2], 0, "in System.Int32", "x3", RefKind.In, ScopedKind.None, false); 10656verifyParameter(delegateTypesAndLambdas[2], 1, "scoped in System.Int32", "y3", RefKind.In, ScopedKind.ScopedRef, false); 10657verifyParameter(delegateTypesAndLambdas[3], 0, "out System.Int32", "x4", RefKind.Out, useUpdatedEscapeRules ? ScopedKind.ScopedRef : ScopedKind.None, false); 10658verifyParameter(delegateTypesAndLambdas[3], 1, "out System.Int32", "y4", RefKind.Out, ScopedKind.ScopedRef, false); 10659verifyParameter(delegateTypesAndLambdas[3], 2, "out System.Int32", "z4", RefKind.Out, ScopedKind.None, true); 10660verifyParameter(delegateTypesAndLambdas[4], 0, "ref R", "x5", RefKind.Ref, ScopedKind.None, false); 10661verifyParameter(delegateTypesAndLambdas[4], 1, "scoped ref R", "y5", RefKind.Ref, ScopedKind.ScopedRef, false); 10662verifyParameter(delegateTypesAndLambdas[5], 0, "in R", "x6", RefKind.In, ScopedKind.None, false); 10663verifyParameter(delegateTypesAndLambdas[5], 1, "scoped in R", "y6", RefKind.In, ScopedKind.ScopedRef, false); 10664verifyParameter(delegateTypesAndLambdas[6], 0, "out R", "x7", RefKind.Out, useUpdatedEscapeRules ? ScopedKind.ScopedRef : ScopedKind.None, false); 10665verifyParameter(delegateTypesAndLambdas[6], 1, "out R", "y7", RefKind.Out, ScopedKind.ScopedRef, false); 10668static void verifyParameter((NamedTypeSymbol, LambdaSymbol) delegateTypeAndLambda, int parameterIndex, string expectedDisplayType, string expectedDisplayName, RefKind expectedRefKind, ScopedKind expectedScope, bool expectedHasUnscopedRefAttribute) 10708VerifyParameterSymbol(comp.GetMember<NamedTypeSymbol>("D1").DelegateInvokeMethod.Parameters[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 10709VerifyParameterSymbol(comp.GetMember<NamedTypeSymbol>("D2").DelegateInvokeMethod.Parameters[0], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 10774VerifyParameterSymbol(methods[0].Parameters[0], "R", RefKind.None, ScopedKind.None); 10775VerifyParameterSymbol(methods[1].Parameters[0], "ref R", RefKind.Ref, ScopedKind.None); 10776VerifyParameterSymbol(methods[1].Parameters[1], "ref System.Int32", RefKind.Ref, ScopedKind.None); 10777VerifyParameterSymbol(methods[2].Parameters[0], "ref R", RefKind.Ref, ScopedKind.None); 10796VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F0").Parameters[0], "scoped R r", RefKind.None, ScopedKind.ScopedValue); 10797VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F3").Parameters[0], "scoped ref R r", RefKind.Ref, ScopedKind.ScopedRef); 10798VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F6").Parameters[0], "scoped in R r", RefKind.In, ScopedKind.ScopedRef); 10799VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F9").Parameters[0], "out R r", RefKind.Out, ScopedKind.ScopedRef); 10906VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F0").Parameters[0], "scoped s", RefKind.None, ScopedKind.None); 10907VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F1").Parameters[0], "scoped scoped s", RefKind.None, ScopedKind.ScopedValue); 10908VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F2").Parameters[0], "ref scoped s", RefKind.Ref, ScopedKind.None); 10909VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F4").Parameters[0], "scoped ref scoped s", RefKind.Ref, ScopedKind.ScopedRef); 10910VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F5").Parameters[0], "in scoped s", RefKind.In, ScopedKind.None); 10911VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F7").Parameters[0], "scoped in scoped s", RefKind.In, ScopedKind.ScopedRef); 10912VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F8").Parameters[0], "out scoped s", RefKind.Out, ScopedKind.ScopedRef); 10913VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.FA").Parameters[0], "out scoped s", RefKind.Out, ScopedKind.ScopedRef); 10942VerifyParameterSymbol(lambdas[0].Parameters[0], "R r1", RefKind.None, ScopedKind.None); 10943VerifyParameterSymbol(lambdas[1].Parameters[0], "R r2", RefKind.None, ScopedKind.None); 10988VerifyParameterSymbol(comp.GetMember<PEMethodSymbol>("A.F1").Parameters[0], "out System.Int32 i", RefKind.Out, ScopedKind.ScopedRef); 11022VerifyParameterSymbol(parameters[0], "R a", RefKind.None, ScopedKind.None); 11023VerifyParameterSymbol(parameters[1], "ref R b", RefKind.Ref, ScopedKind.None); 11024VerifyParameterSymbol(parameters[2], "in R c", RefKind.In, ScopedKind.None); 11025VerifyParameterSymbol(parameters[3], "out R d", RefKind.Out, ScopedKind.ScopedRef); 11059VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.ReturnRef").Parameters[0], "scoped ref R r", RefKind.Ref, ScopedKind.ScopedRef); 11100VerifyParameterSymbol(comp.GetMember<MethodSymbol>("C..ctor").ThisParameter, "C this", RefKind.None, ScopedKind.None); 11101VerifyParameterSymbol(comp.GetMember<MethodSymbol>("C.F1").ThisParameter, "C this", RefKind.None, ScopedKind.None); 11102VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1..ctor").ThisParameter, "out S1 this", RefKind.Out, ScopedKind.ScopedRef); 11103VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F1").ThisParameter, "ref S1 this", RefKind.Ref, ScopedKind.ScopedRef); 11104VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F2").ThisParameter, "in S1 this", RefKind.In, ScopedKind.ScopedRef); 11105VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R1..ctor").ThisParameter, "out R1 this", RefKind.Out, ScopedKind.ScopedRef); 11106VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R1.F1").ThisParameter, "ref R1 this", RefKind.Ref, ScopedKind.ScopedRef); 11107VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R1.F2").ThisParameter, "in R1 this", RefKind.In, ScopedKind.ScopedRef); 11108VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2..ctor").ThisParameter, "out S2 this", RefKind.Out, ScopedKind.ScopedRef); 11109VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F1").ThisParameter, "in S2 this", RefKind.In, ScopedKind.ScopedRef); 11110VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F2").ThisParameter, "in S2 this", RefKind.In, ScopedKind.ScopedRef); 11111VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R2..ctor").ThisParameter, "out R2 this", RefKind.Out, ScopedKind.ScopedRef); 11112VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R2.F1").ThisParameter, "in R2 this", RefKind.In, ScopedKind.ScopedRef); 11113VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R2.F2").ThisParameter, "in R2 this", RefKind.In, ScopedKind.ScopedRef); 11117VerifyParameterSymbol(thisParameter, "ref S1 this", RefKind.Ref, ScopedKind.ScopedRef); 11153VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Extensions.F0").Parameters[0], "R<System.Object> r", RefKind.None, ScopedKind.None); 11154VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Extensions.F1").Parameters[0], "scoped R<System.Object> r", RefKind.None, ScopedKind.ScopedValue); 11155VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Extensions.F2").Parameters[0], "scoped", RefKind.None, ScopedKind.None); 11156VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Extensions.F3").Parameters[0], "scoped ref T t", RefKind.Ref, ScopedKind.ScopedRef); 11174VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F2").Parameters[0], "scoped params System.Object[] args", RefKind.None, ScopedKind.ScopedValue); 11430verifyValueParameter(comp.GetMember<PropertySymbol>("R2.P2"), "R1 value", RefKind.None, ScopedKind.None); 11431verifyValueParameter(comp.GetMember<PropertySymbol>("R2.P3"), "R1 value", RefKind.None, ScopedKind.None); 11434static void verifyValueParameter(PropertySymbol property, string expectedDisplayString, RefKind expectedRefKind, ScopedKind expectedScope) 11457VerifyParameterSymbol(method.Parameters[0], "scoped R<System.Int32> x", RefKind.None, ScopedKind.ScopedValue); 11458VerifyParameterSymbol(method.Parameters[1], "scoped in System.Int32 y", RefKind.In, ScopedKind.ScopedRef); 11491VerifyParameterSymbol(method.Parameters[0], "scoped R x", RefKind.None, ScopedKind.ScopedValue); 11492VerifyParameterSymbol(method.Parameters[1], "scoped in System.Int32 y", RefKind.In, ScopedKind.ScopedRef); 11499private static void VerifyParameterSymbol(ParameterSymbol parameter, string expectedDisplayString, RefKind expectedRefKind, ScopedKind expectedScope, bool expectedHasUnscopedRefAttribute = false) 11512private static void VerifyParameterSymbol(IParameterSymbol parameter, string expectedDisplayString, RefKind expectedRefKind, ScopedKind expectedScope) 11571VerifyLocalSymbol(locals[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 11572VerifyLocalSymbol(locals[1], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 11573VerifyLocalSymbol(locals[2], "scoped ref readonly R r5", RefKind.RefReadOnly, ScopedKind.ScopedRef); 11574VerifyLocalSymbol(locals[3], "scoped R r11", RefKind.None, ScopedKind.ScopedValue); 11575VerifyLocalSymbol(locals[4], "scoped ref R r21", RefKind.Ref, ScopedKind.ScopedRef); 11576VerifyLocalSymbol(locals[5], "scoped ref readonly R r51", RefKind.RefReadOnly, ScopedKind.ScopedRef); 11645Assert.Equal(RefKind.None, f.RefKind); 11708VerifyLocalSymbol(locals[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 11709VerifyLocalSymbol(locals[1], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 11710VerifyLocalSymbol(locals[2], "scoped ref readonly R r5", RefKind.RefReadOnly, ScopedKind.ScopedRef); 11894VerifyLocalSymbol(locals[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 11895VerifyLocalSymbol(locals[1], "scoped R r2", RefKind.None, ScopedKind.ScopedValue); 11896VerifyLocalSymbol(locals[2], "scoped R r5", RefKind.None, ScopedKind.ScopedValue); 11897VerifyLocalSymbol(locals[3], "scoped R r11", RefKind.None, ScopedKind.ScopedValue); 11898VerifyLocalSymbol(locals[4], "scoped R r21", RefKind.None, ScopedKind.ScopedValue); 11899VerifyLocalSymbol(locals[5], "scoped R r51", RefKind.None, ScopedKind.ScopedValue); 12084Assert.Equal(RefKind.None, f.RefKind); 12305VerifyLocalSymbol(locals[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 12306VerifyLocalSymbol(locals[1], "scoped R r2", RefKind.None, ScopedKind.ScopedValue); 12307VerifyLocalSymbol(locals[2], "scoped R r5", RefKind.None, ScopedKind.ScopedValue); 12308VerifyLocalSymbol(locals[3], "scoped R r11", RefKind.None, ScopedKind.ScopedValue); 12309VerifyLocalSymbol(locals[4], "scoped R r21", RefKind.None, ScopedKind.ScopedValue); 12310VerifyLocalSymbol(locals[5], "scoped R r51", RefKind.None, ScopedKind.ScopedValue); 12491Assert.Equal(RefKind.None, f.RefKind); 12661VerifyLocalSymbol(locals[0], "scoped s1", RefKind.None, ScopedKind.None); 12662VerifyLocalSymbol(locals[1], "ref scoped s2", RefKind.Ref, ScopedKind.None); 12663VerifyLocalSymbol(locals[2], "ref scoped s3", RefKind.Ref, ScopedKind.None); 12664VerifyLocalSymbol(locals[3], "scoped scoped s4", RefKind.None, ScopedKind.ScopedValue); 12665VerifyLocalSymbol(locals[4], "scoped ref scoped s5", RefKind.Ref, ScopedKind.ScopedRef); 12666VerifyLocalSymbol(locals[5], "scoped ref scoped s6", RefKind.Ref, ScopedKind.ScopedRef); 12716VerifyLocalSymbol(locals[0], "scoped s1", RefKind.None, ScopedKind.None); 12717VerifyLocalSymbol(locals[1], "ref scoped s2", RefKind.Ref, ScopedKind.None); 12718VerifyLocalSymbol(locals[2], "ref scoped s3", RefKind.Ref, ScopedKind.None); 12719VerifyLocalSymbol(locals[3], "scoped scoped s4", RefKind.None, ScopedKind.ScopedValue); 12720VerifyLocalSymbol(locals[4], "scoped ref scoped s5", RefKind.Ref, ScopedKind.ScopedRef); 12721VerifyLocalSymbol(locals[5], "scoped ref scoped s6", RefKind.Ref, ScopedKind.ScopedRef); 12775VerifyLocalSymbol(locals[0], "scoped s1", RefKind.None, ScopedKind.None); 12776VerifyLocalSymbol(locals[2], "scoped s3", RefKind.None, ScopedKind.None); 12777VerifyLocalSymbol(locals[4], "scoped scoped s4", RefKind.None, ScopedKind.ScopedValue); 12778VerifyLocalSymbol(locals[6], "scoped scoped s6", RefKind.None, ScopedKind.ScopedValue); 12820VerifyLocalSymbol(locals[0], "scoped s1", RefKind.None, ScopedKind.None); 12821VerifyLocalSymbol(locals[1], "scoped s3", RefKind.None, ScopedKind.None); 12822VerifyLocalSymbol(locals[2], "scoped scoped s4", RefKind.None, ScopedKind.ScopedValue); 12823VerifyLocalSymbol(locals[3], "scoped scoped s6", RefKind.None, ScopedKind.ScopedValue); 12847VerifyLocalSymbol(locals[0], "System.Boolean scoped", RefKind.None, ScopedKind.None); 12872VerifyLocalSymbol(locals[0], "System.Boolean scoped", RefKind.None, ScopedKind.None); 12892VerifyLocalSymbol(locals[0], "System.Boolean scoped", RefKind.None, ScopedKind.None); 12914VerifyLocalSymbol(locals[0], "System.Boolean scoped", RefKind.None, ScopedKind.None); 12955VerifyLocalSymbol(locals[0], "scoped R<System.Int32> r1", RefKind.None, ScopedKind.ScopedValue); 12956VerifyLocalSymbol(locals[1], "scoped ref R<System.Int32> r3", RefKind.Ref, ScopedKind.ScopedRef); 13019VerifyLocalSymbol(locals[0], "scoped R<System.Int32> r1", RefKind.None, ScopedKind.ScopedValue); 13020VerifyLocalSymbol(locals[1], "scoped ref R<System.Int32> r3", RefKind.Ref, ScopedKind.ScopedRef); 13095VerifyLocalSymbol(locals[0], "scoped R<System.Int32> r1", RefKind.None, ScopedKind.ScopedValue); 13096VerifyLocalSymbol(locals[2], "scoped R<System.Int32> r3", RefKind.None, ScopedKind.ScopedValue); 13166VerifyLocalSymbol(locals[0], "scoped R<System.Int32> r1", RefKind.None, ScopedKind.ScopedValue); 13167VerifyLocalSymbol(locals[1], "scoped R<System.Int32> r3", RefKind.None, ScopedKind.ScopedValue); 13225VerifyLocalSymbol(locals[0], "ref System.Int32 a", RefKind.Ref, ScopedKind.None); 13226VerifyLocalSymbol(locals[1], "ref System.Int32 b", RefKind.Ref, ScopedKind.None); 13865VerifyLocalSymbol(locals[0], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 13866VerifyLocalSymbol(locals[1], "scoped ref R r5", RefKind.Ref, ScopedKind.ScopedRef); 13907VerifyLocalSymbol(locals[0], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 13908VerifyLocalSymbol(locals[1], "scoped ref R r5", RefKind.Ref, ScopedKind.ScopedRef); 14032VerifyLocalSymbol(locals[0], "R r11", RefKind.None, ScopedKind.None); 14033VerifyLocalSymbol(locals[1], "R r12", RefKind.None, ScopedKind.None); 14034VerifyLocalSymbol(locals[2], "scoped R r21", RefKind.None, ScopedKind.ScopedValue); 14035VerifyLocalSymbol(locals[3], "scoped R r22", RefKind.None, ScopedKind.ScopedValue); 14037VerifyLocalSymbol(locals[4], "ref R r31", RefKind.Ref, ScopedKind.None); 14038VerifyLocalSymbol(locals[5], "ref R r32", RefKind.Ref, ScopedKind.None); 14039VerifyLocalSymbol(locals[6], "scoped ref R r41", RefKind.Ref, ScopedKind.ScopedRef); 14040VerifyLocalSymbol(locals[7], "scoped ref R r42", RefKind.Ref, ScopedKind.ScopedRef); 14108VerifyLocalSymbol(locals[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 14109VerifyLocalSymbol(locals[1], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 14110VerifyLocalSymbol(locals[2], "scoped ref readonly R r5", RefKind.RefReadOnly, ScopedKind.ScopedRef); 14353VerifyLocalSymbol(locals[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 14354VerifyLocalSymbol(locals[1], "scoped R r2", RefKind.None, ScopedKind.ScopedValue); 14355VerifyLocalSymbol(locals[2], "scoped R r5", RefKind.None, ScopedKind.ScopedValue); 14356VerifyLocalSymbol(locals[3], "scoped R r11", RefKind.None, ScopedKind.ScopedValue); 14357VerifyLocalSymbol(locals[4], "scoped R r21", RefKind.None, ScopedKind.ScopedValue); 14358VerifyLocalSymbol(locals[5], "scoped R r51", RefKind.None, ScopedKind.ScopedValue); 14561VerifyLocalSymbol(locals[0], "scoped s1", RefKind.None, ScopedKind.None); 14562VerifyLocalSymbol(locals[1], "ref scoped s2", RefKind.Ref, ScopedKind.None); 14563VerifyLocalSymbol(locals[2], "ref scoped s3", RefKind.Ref, ScopedKind.None); 14564VerifyLocalSymbol(locals[3], "scoped scoped s4", RefKind.None, ScopedKind.ScopedValue); 14565VerifyLocalSymbol(locals[4], "scoped ref scoped s5", RefKind.Ref, ScopedKind.ScopedRef); 14566VerifyLocalSymbol(locals[5], "scoped ref scoped s6", RefKind.Ref, ScopedKind.ScopedRef); 14587VerifyLocalSymbol(locals[0], "System.Boolean scoped", RefKind.None, ScopedKind.None); 14648VerifyLocalSymbol(locals[0], "scoped R<System.Int32> r1", RefKind.None, ScopedKind.ScopedValue); 14649VerifyLocalSymbol(locals[1], "scoped ref R<System.Int32> r3", RefKind.Ref, ScopedKind.ScopedRef); 15219private static void VerifyLocalSymbol(LocalSymbol local, string expectedDisplayString, RefKind expectedRefKind, ScopedKind expectedScope) 15228private static void VerifyLocalSymbol(ILocalSymbol local, string expectedDisplayString, RefKind expectedRefKind, ScopedKind expectedScope) 15268VerifyParameterSymbol(method.Parameters[0], "ref System.Int32 i", RefKind.Ref, ScopedKind.None); 17401VerifyParameterSymbol(delegateInvokeMethods[0].Parameters[0], "R arg1", RefKind.None, ScopedKind.None); 17402VerifyParameterSymbol(delegateInvokeMethods[0].Parameters[1], "scoped R arg2", RefKind.None, ScopedKind.ScopedValue); 17403VerifyParameterSymbol(delegateInvokeMethods[1].Parameters[1], "scoped ref System.Int32 arg2", RefKind.Ref, ScopedKind.ScopedRef); 22296VerifyParameterSymbol(type.GetMethod("Get").ThisParameter, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 22297VerifyParameterSymbol(type.GetMethod("get_Item").ThisParameter, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 22301VerifyParameterSymbol(type.GetMethod("Get").ThisParameter, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22302VerifyParameterSymbol(type.GetMethod("get_Item").ThisParameter, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22365VerifyParameterSymbol(type.GetMethod("Get").ThisParameter, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 22366VerifyParameterSymbol(type.GetMethod("get_Item").ThisParameter, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 22371VerifyParameterSymbol(type.GetMethod("Get").ThisParameter, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22372VerifyParameterSymbol(type.GetMethod("get_Item").ThisParameter, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22519VerifyParameterSymbol(parameters[1], "scoped ref R x", RefKind.Ref, ScopedKind.ScopedRef); 22520VerifyParameterSymbol(parameters[2], "ref R y", RefKind.Ref, ScopedKind.None); 22582VerifyParameterSymbol(baseType.GetMethod("F1A").Parameters[0], "ref R<System.Int32> r1", RefKind.Ref, ScopedKind.None); 22583VerifyParameterSymbol(baseType.GetMethod("F2A").Parameters[0], "scoped ref R<System.Int32> r2", RefKind.Ref, ScopedKind.ScopedRef); 22671VerifyParameterSymbol(type.GetMethod("F1").Parameters[0], "ref R<T> r1", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22672VerifyParameterSymbol(type.GetMethod("F2").Parameters[0], "out T t2", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22673VerifyParameterSymbol(type.GetMethod("F3").Parameters[0], "in R<T> t3", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22674VerifyParameterSymbol(type.GetMethod("F4").Parameters[0], "R<T> t4", RefKind.None, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22755VerifyParameterSymbol(baseType.GetMethod("F4A").Parameters[0], "ref R<System.Int32> r4", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22778VerifyParameterSymbol(parameters[0], "System.Int32 x", RefKind.None, default, expectedHasUnscopedRefAttribute: true); 22779VerifyParameterSymbol(parameters[1], "System.Object y", RefKind.None, default, expectedHasUnscopedRefAttribute: true); 22806VerifyParameterSymbol(parameters[1], "out System.Int32 x", RefKind.Out, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 22807VerifyParameterSymbol(parameters[2], "out System.Int32 y", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22865VerifyParameterSymbol(baseType.GetMethod("F1A").Parameters[0], "out System.Int32 t1", RefKind.Out, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 22866VerifyParameterSymbol(baseType.GetMethod("F2A").Parameters[0], "out System.Int32 t2", RefKind.Out, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 22867VerifyParameterSymbol(baseType.GetMethod("F3A").Parameters[0], "out System.Int32 t3", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22930VerifyParameterSymbol(baseType.GetMethod("F1A").Parameters[0], "ref System.Int32 t1", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 22931VerifyParameterSymbol(baseType.GetMethod("F2A").Parameters[0], "scoped ref System.Int32 t2", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 22932VerifyParameterSymbol(baseType.GetMethod("F3A").Parameters[0], "ref System.Int32 t3", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22933VerifyParameterSymbol(baseType.GetMethod("F4A").Parameters[0], "ref System.Int32 t4", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22996VerifyParameterSymbol(baseType.GetMethod("F1A").Parameters[0], "in System.Int32 t1", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 22997VerifyParameterSymbol(baseType.GetMethod("F2A").Parameters[0], "scoped in System.Int32 t2", RefKind.In, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 22998VerifyParameterSymbol(baseType.GetMethod("F3A").Parameters[0], "in System.Int32 t3", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22999VerifyParameterSymbol(baseType.GetMethod("F4A").Parameters[0], "in System.Int32 t4", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23086VerifyParameterSymbol(baseType.GetMethod("F1A").Parameters[0], "R<System.Int32> r1", RefKind.None, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 23087VerifyParameterSymbol(baseType.GetMethod("F2A").Parameters[0], "scoped R<System.Int32> r2", RefKind.None, ScopedKind.ScopedValue, expectedHasUnscopedRefAttribute: false); 23088VerifyParameterSymbol(baseType.GetMethod("F3A").Parameters[0], "R<System.Int32> r3", RefKind.None, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23089VerifyParameterSymbol(baseType.GetMethod("F4A").Parameters[0], "R<System.Int32> r4", RefKind.None, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23114VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F1").Parameters[0], "R<T> r1", RefKind.None, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23115VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F2").Parameters[0], "ref R<T> r2", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23116VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F3").Parameters[0], "in R<T> r3", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23117VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F4").Parameters[0], "out R<T> r4", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23363VerifyParameterSymbol(lambdas[0].Parameters[0], "out System.Int32 i1", RefKind.Out, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23364VerifyParameterSymbol(lambdas[1].Parameters[0], "out System.Int32 i2", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23365VerifyParameterSymbol(lambdas[2].Parameters[0], "out System.Object o1", RefKind.Out, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23366VerifyParameterSymbol(lambdas[3].Parameters[0], "out System.Object o2", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23399VerifyParameterSymbol(lambdas[0].Parameters[0], "ref System.Int32 i1", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 23400VerifyParameterSymbol(lambdas[1].Parameters[0], "ref System.Int32 i2", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23401VerifyParameterSymbol(lambdas[2].Parameters[0], "ref System.Object o1", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 23402VerifyParameterSymbol(lambdas[3].Parameters[0], "ref System.Object o2", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23436VerifyParameterSymbol(lambdas[0].Parameters[0], "scoped ref R<System.Int32> r1", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23437VerifyParameterSymbol(lambdas[1].Parameters[0], "ref R<System.Int32> r2", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 23438VerifyParameterSymbol(lambdas[2].Parameters[0], "scoped ref R<System.Object> r1", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23439VerifyParameterSymbol(lambdas[3].Parameters[0], "ref R<System.Object> r2", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 23860VerifyParameterSymbol(typeA.GetMethod("NoAttributes").Parameters[0], "out System.Int32 i", RefKind.Out, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23861VerifyParameterSymbol(typeA.GetMethod("ScopedRefOnly").Parameters[0], "out System.Int32 i", RefKind.Out, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23862VerifyParameterSymbol(typeA.GetMethod("UnscopedRefOnly").Parameters[0], "out System.Int32 i", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23863VerifyParameterSymbol(typeA.GetMethod("ScopedRefAndUnscopedRef").Parameters[0], "out System.Int32 i", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23962VerifyParameterSymbol(typeA.GetMethod("NoAttributes").Parameters[0], "ref R x", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 23963VerifyParameterSymbol(typeA.GetMethod("ScopedRefOnly").Parameters[0], "scoped ref R x", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23964VerifyParameterSymbol(typeA.GetMethod("UnscopedRefOnly").Parameters[0], "ref R x", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23965VerifyParameterSymbol(typeA.GetMethod("ScopedRefAndUnscopedRef").Parameters[0], "ref R x", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24070VerifyParameterSymbol(typeA.GetMethod("NoAttributes").Parameters[0], "in R x", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 24071VerifyParameterSymbol(typeA.GetMethod("ScopedRefOnly").Parameters[0], "scoped in R x", RefKind.In, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 24072VerifyParameterSymbol(typeA.GetMethod("UnscopedRefOnly").Parameters[0], "in R x", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24073VerifyParameterSymbol(typeA.GetMethod("ScopedRefAndUnscopedRef").Parameters[0], "in R x", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24128VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F1").ThisParameter, "ref S1 this", RefKind.Ref, ScopedKind.ScopedRef); 24129VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F2").ThisParameter, "in S2 this", RefKind.In, ScopedKind.ScopedRef); 24130VerifyParameterSymbol(comp.GetMember<MethodSymbol>("A.F3").Parameters[0], "out System.Int32 i3", RefKind.Out, useUpdatedRules ? ScopedKind.ScopedRef : ScopedKind.None); 24131VerifyParameterSymbol(comp.GetMember<MethodSymbol>("A.F4").Parameters[0], "ref R r4", RefKind.Ref, ScopedKind.None); 24132VerifyParameterSymbol(comp.GetMember<MethodSymbol>("A.F5").Parameters[0], "in R r5", RefKind.In, ScopedKind.None); 24171VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F1").ThisParameter, "ref S1 this", RefKind.Ref, ScopedKind.ScopedRef); 24172VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F2").ThisParameter, "in S2 this", RefKind.In, ScopedKind.ScopedRef); 24173VerifyParameterSymbol(comp.GetMember<MethodSymbol>("A.F3").Parameters[0], "out System.Int32 i3", RefKind.Out, useUpdatedRules ? ScopedKind.ScopedRef : ScopedKind.None); 24174VerifyParameterSymbol(comp.GetMember<MethodSymbol>("A.F4").Parameters[0], "ref R r4", RefKind.Ref, ScopedKind.None); 24175VerifyParameterSymbol(comp.GetMember<MethodSymbol>("A.F5").Parameters[0], "in R r5", RefKind.In, ScopedKind.None); 24205verifyParameter(delegateTypesAndLambdas[0], 0, "out System.Int32", "i1", RefKind.Out, useUpdatedRules ? ScopedKind.ScopedRef : ScopedKind.None); 24206verifyParameter(delegateTypesAndLambdas[1], 0, "R", "r2", RefKind.None, ScopedKind.None); 24207verifyParameter(delegateTypesAndLambdas[2], 0, "ref R", "r3", RefKind.Ref, ScopedKind.None); 24208verifyParameter(delegateTypesAndLambdas[3], 0, "in R", "r4", RefKind.In, ScopedKind.None); 24209verifyParameter(delegateTypesAndLambdas[4], 0, "out R", "r5", RefKind.Out, useUpdatedRules ? ScopedKind.ScopedRef : ScopedKind.None); 24211static void verifyParameter((NamedTypeSymbol, LambdaSymbol) delegateTypeAndLambda, int parameterIndex, string expectedDisplayType, string expectedDisplayName, RefKind expectedRefKind, ScopedKind expectedScope) 24255VerifyParameterSymbol(getFunctionPointerMethod(comp, "A.F1").Parameters[0], "out modreq(System.Runtime.InteropServices.OutAttribute) System.Int32", RefKind.Out, useUpdatedRules ? ScopedKind.ScopedRef : ScopedKind.None); 24256VerifyParameterSymbol(getFunctionPointerMethod(comp, "A.F2").Parameters[0], "R", RefKind.None, ScopedKind.None); 24257VerifyParameterSymbol(getFunctionPointerMethod(comp, "A.F3").Parameters[0], "ref R", RefKind.Ref, ScopedKind.None); 24258VerifyParameterSymbol(getFunctionPointerMethod(comp, "A.F4").Parameters[0], "in modreq(System.Runtime.InteropServices.InAttribute) R", RefKind.In, ScopedKind.None); 24259VerifyParameterSymbol(getFunctionPointerMethod(comp, "A.F5").Parameters[0], "out modreq(System.Runtime.InteropServices.OutAttribute) R", RefKind.Out, useUpdatedRules ? ScopedKind.ScopedRef : ScopedKind.None); 24315VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S.F").ThisParameter, "ref S this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24316VerifyParameterSymbol(comp.GetMember<PropertySymbol>("S.P").GetMethod.ThisParameter, "ref S this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24317VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F1").Parameters[0], "out System.Int32 i1", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24318VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F2").Parameters[0], "R r2", RefKind.None, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24319VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F3").Parameters[0], "ref R r3", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24320VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F4").Parameters[0], "in R r4", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24321VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F5").Parameters[0], "out R r5", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24934VerifyParameterSymbol(typeA.GetMethod("F1").Parameters[0], "ref R x", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 24935VerifyParameterSymbol(typeA.GetMethod("F2").Parameters[0], "ref R x", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24936VerifyParameterSymbol(typeA.GetMethod("F3").Parameters[0], "in R x", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 24937VerifyParameterSymbol(typeA.GetMethod("F4").Parameters[0], "in R x", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 25675VerifyParameterSymbol(method.Parameters[0], "out System.Int32 i", RefKind.Out, version == 11 ? ScopedKind.ScopedRef : ScopedKind.None); 25714VerifyParameterSymbol(method.Parameters[0], "out System.Int32 i", RefKind.Out, ScopedKind.None); 25753VerifyParameterSymbol(method.Parameters[0], "out System.Int32 i", RefKind.Out, ScopedKind.None); 25803VerifyParameterSymbol(method.Parameters[0], "out T t", RefKind.Out, expectedUseUpdatedEscapeRules ? ScopedKind.ScopedRef : ScopedKind.None); 26295VerifyLocalSymbol(locals[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 26296VerifyLocalSymbol(locals[1], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 26297VerifyLocalSymbol(locals[2], "scoped ref readonly R r5", RefKind.RefReadOnly, ScopedKind.ScopedRef); 26385VerifyLocalSymbol(locals[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 26386VerifyLocalSymbol(locals[1], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 26387VerifyLocalSymbol(locals[2], "scoped ref readonly R r5", RefKind.RefReadOnly, ScopedKind.ScopedRef); 26505VerifyLocalSymbol(locals[0], "scoped s1", RefKind.None, ScopedKind.None); 26506VerifyLocalSymbol(locals[1], "ref scoped s2", RefKind.Ref, ScopedKind.None); 26507VerifyLocalSymbol(locals[2], "ref scoped s3", RefKind.Ref, ScopedKind.None); 26508VerifyLocalSymbol(locals[3], "scoped scoped s4", RefKind.None, ScopedKind.ScopedValue); 26509VerifyLocalSymbol(locals[4], "scoped ref scoped s5", RefKind.Ref, ScopedKind.ScopedRef); 26510VerifyLocalSymbol(locals[5], "scoped ref scoped s6", RefKind.Ref, ScopedKind.ScopedRef); 26606VerifyLocalSymbol(locals[0], "scoped s1", RefKind.None, ScopedKind.None); 26607VerifyLocalSymbol(locals[1], "ref scoped s2", RefKind.Ref, ScopedKind.None); 26608VerifyLocalSymbol(locals[2], "ref scoped s3", RefKind.Ref, ScopedKind.None); 26609VerifyLocalSymbol(locals[3], "scoped scoped s4", RefKind.None, ScopedKind.ScopedValue); 26610VerifyLocalSymbol(locals[4], "scoped ref scoped s5", RefKind.Ref, ScopedKind.ScopedRef); 26611VerifyLocalSymbol(locals[5], "scoped ref scoped s6", RefKind.Ref, ScopedKind.ScopedRef); 26657VerifyLocalSymbol(locals[0], "scoped R<System.Int32> r1", RefKind.None, ScopedKind.ScopedValue); 26658VerifyLocalSymbol(locals[1], "scoped R<System.Int32> r3", RefKind.None, ScopedKind.ScopedValue); 26717VerifyLocalSymbol(locals[0], "scoped R<System.Int32> r1", RefKind.None, ScopedKind.ScopedValue); 26718VerifyLocalSymbol(locals[1], "scoped R<System.Int32> r3", RefKind.None, ScopedKind.ScopedValue); 26941VerifyLocalSymbol(locals[0], "scoped R r2", RefKind.None, ScopedKind.ScopedValue); 26942VerifyLocalSymbol(locals[1], "scoped R r5", RefKind.None, ScopedKind.ScopedValue); 26989VerifyLocalSymbol(locals[0], "scoped R r2", RefKind.None, ScopedKind.ScopedValue); 26990VerifyLocalSymbol(locals[1], "scoped R r5", RefKind.None, ScopedKind.ScopedValue);
Semantics\RefLocalsAndReturnsTests.cs (2)
4867Assert.Equal(RefKind.None, f.RefKind); 4906Assert.Equal(RefKind.None, f.RefKind);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (150)
Compilation\SemanticModelAPITests.cs (2)
208Assert.Equal(RefKind.RefReadOnly, rxSymbol.RefKind); 240Assert.Equal(RefKind.RefReadOnly, rxSymbol.RefKind);
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (2)
43Assert.Equal(RefKind.RefReadOnly, rx.RefKind); 66Assert.Equal(RefKind.RefReadOnly, rxLocal.RefKind);
DocumentationComments\CrefTests.cs (2)
1314Single(m => m.ParameterRefKinds.Single() == RefKind.Out); 6708Assert.Equal(RefKind.In, parameterSymbol.RefKind);
SymbolDisplay\SymbolDisplayTests.cs (3)
6548Assert.Equal(RefKind.None, local.RefKind); 6593Assert.Equal(RefKind.Ref, local.RefKind); 6640Assert.Equal(RefKind.RefReadOnly, local.RefKind);
Symbols\CompilationCreationTests.cs (2)
2356Assert.Equal(RefKind.Ref, x1.RefKind); 2361Assert.Equal(RefKind.Out, x2.RefKind);
Symbols\ExtensionMethodTests.cs (4)
4041Assert.Equal(RefKind.In, parameter.RefKind); 4047Assert.Equal(RefKind.In, parameter.RefKind); 4071Assert.Equal(RefKind.Ref, parameter.RefKind); 4077Assert.Equal(RefKind.Ref, parameter.RefKind);
Symbols\FunctionPointerTypeSymbolTests.cs (90)
26[InlineData("", RefKind.None, "delegate*<System.Object>")] 27[InlineData("ref", RefKind.Ref, "delegate*<ref System.Object>")] 28[InlineData("ref readonly", RefKind.RefReadOnly, 31public void ValidReturnModifiers(string modifier, RefKind expectedKind, string expectedPublicType) 113verifyRefKind(RefKind.None, mParams[0]); 114verifyRefKind(RefKind.Ref, mParams[1]); 115verifyRefKind(RefKind.Ref, mParams[2]); 116verifyRefKind(RefKind.RefReadOnly, mParams[3]); 117verifyRefKind(RefKind.None, mParams[4]); 118verifyRefKind(RefKind.None, mParams[5]); 119verifyRefKind(RefKind.Ref, mParams[6]); 120verifyRefKind(RefKind.None, mParams[7]); 172static void verifyRefKind(RefKind expected, ParameterSymbol actual) 199Assert.Equal(RefKind.Ref, firstSignature.RefKind); 200Assert.Equal(RefKind.RefReadOnly, secondSignature.RefKind); 472Assert.Equal(RefKind.Ref, firstParam.Parameters.Single().RefKind); 475Assert.Equal(RefKind.In, secondParam.Parameters.Single().RefKind); 478Assert.Equal(RefKind.Out, thirdParam.Parameters.Single().RefKind); 481Assert.Equal(RefKind.None, fourthParam.Parameters.Single().RefKind); 574Assert.Equal(RefKind.None, firstParam.Parameters.Single().RefKind); 577Assert.Equal(RefKind.None, secondParam.Parameters.Single().RefKind); 580Assert.Equal(RefKind.Ref, thirdParam.Parameters.Single().RefKind); 583Assert.Equal(RefKind.In, fourthParam.Parameters.Single().RefKind); 586Assert.Equal(RefKind.Out, fifthParam.Parameters.Single().RefKind); 589Assert.Equal(RefKind.In, sixthParam.Parameters.Single().RefKind); 592Assert.Equal(RefKind.Ref, seventhParam.Parameters.Single().RefKind); 595Assert.Equal(RefKind.Out, eightParam.Parameters.Single().RefKind); 598Assert.Equal(RefKind.Ref, ninthParam.Parameters.Single().RefKind); 1538Assert.Throws<ArgumentNullException>("returnType", () => comp.CreateFunctionPointerTypeSymbol(returnType: null!, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty)); 1539Assert.Throws<ArgumentNullException>("parameterTypes", () => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: default, parameterRefKinds: ImmutableArray<RefKind>.Empty)); 1540Assert.Throws<ArgumentNullException>("parameterTypes[0]", () => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray.Create((ITypeSymbol?)null)!, parameterRefKinds: ImmutableArray.Create(RefKind.None))); 1541Assert.Throws<ArgumentNullException>("parameterRefKinds", () => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: default)); 1542Assert.Throws<ArgumentNullException>("callingConventionTypes[0]", () => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.Unmanaged, ImmutableArray.Create((INamedTypeSymbol)null!))); 1543Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray.Create(RefKind.None))); 1544Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.Out, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty)); 1545Assert.Throws<ArgumentOutOfRangeException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: (SignatureCallingConvention)10)); 1546Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.Default, callingConventionTypes: ImmutableArray.Create(cdeclType)!)); 1547Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.StdCall, callingConventionTypes: ImmutableArray.Create(cdeclType)!)); 1548Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.FastCall, callingConventionTypes: ImmutableArray.Create(cdeclType)!)); 1549Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.CDecl, callingConventionTypes: ImmutableArray.Create(cdeclType)!)); 1550Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.ThisCall, callingConventionTypes: ImmutableArray.Create(cdeclType)!)); 1551Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.Unmanaged, callingConventionTypes: ImmutableArray.Create(@string)!)); 1559var ptr = comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.VarArgs); 1575RefKind.None, 1577ImmutableArray.Create(RefKind.None, RefKind.None)); 1590RefKind.RefReadOnly, 1592ImmutableArray.Create(RefKind.In)); 1607RefKind.None, 1609ImmutableArray.Create(RefKind.Out)); 1625RefKind.RefReadOnly, 1627ImmutableArray.Create(RefKind.Out)); 1644var ptr = comp.CreateFunctionPointerTypeSymbol(@string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, convention); 1646ptr = comp.CreateFunctionPointerTypeSymbol(@string, returnRefKind: RefKind.RefReadOnly, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, convention); 1659var ptr = comp.CreateFunctionPointerTypeSymbol(@string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, SignatureCallingConvention.Unmanaged, ImmutableArray.Create(cdeclType, stdcallType)!); 1661ptr = comp.CreateFunctionPointerTypeSymbol(@string, returnRefKind: RefKind.RefReadOnly, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, SignatureCallingConvention.Unmanaged, ImmutableArray.Create(cdeclType, stdcallType)!); 1664ptr = comp.CreateFunctionPointerTypeSymbol(@string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, SignatureCallingConvention.Unmanaged, ImmutableArray.Create(cdeclType)!); 1970returnRefKind: RefKind.None, 1972parameterRefKinds: ImmutableArray<RefKind>.Empty, 2050returnRefKind: RefKind.None, 2053parameterRefKinds: ImmutableArray<RefKind>.Empty, 2059RefKind.Ref, 2062parameterRefKinds: ImmutableArray<RefKind>.Empty, 2117returnRefKind: RefKind.None, 2120parameterRefKinds: ImmutableArray<RefKind>.Empty, 2126RefKind.Ref, 2129parameterRefKinds: ImmutableArray<RefKind>.Empty, 2176returnRefKind: RefKind.None, 2179parameterRefKinds: ImmutableArray<RefKind>.Empty, 2185RefKind.Ref, 2188parameterRefKinds: ImmutableArray<RefKind>.Empty,
Symbols\InterfaceImplementationTests.cs (2)
2032Assert.Equal(RefKind.Ref, interfaceMethod.RefKind); 2033Assert.Equal(RefKind.Ref, baseMethod.RefKind);
Symbols\Metadata\MetadataMemberTests.cs (2)
284Assert.Equal(RefKind.Ref, p5.RefKind); 287Assert.Equal(RefKind.Out, p6.RefKind);
Symbols\Metadata\PE\DynamicTransformsTests.cs (3)
276Assert.Equal(RefKind.Ref, f2.Parameters[0].RefKind); 283Assert.Equal(RefKind.None, f3.Parameters[0].RefKind); 307Assert.Equal(RefKind.None, f4.Parameters[0].RefKind);
Symbols\Metadata\PE\LoadingIndexers.cs (1)
605Assert.Equal(RefKind.Ref, indexer.Parameters.Single().RefKind);
Symbols\Metadata\PE\LoadingMethods.cs (1)
376Assert.Equal(RefKind.Ref, byrefReturnMethod.RefKind);
Symbols\PEParameterSymbolTests.cs (5)
112Assert.Equal(RefKind.Out, x.RefKind); 116Assert.Equal(RefKind.Ref, y.RefKind); 120Assert.Equal(RefKind.None, z.RefKind); 127Assert.Equal(RefKind.Out, x1.RefKind); 134Assert.Equal(RefKind.Ref, y2.RefKind);
Symbols\Source\DelegateTests.cs (9)
179if (invoke.Parameters[i].RefKind != RefKind.None) 743Assert.Equal(RefKind.Ref, parameter.RefKind); 784Assert.Equal(RefKind.Ref, d.DelegateInvokeMethod.RefKind); 785Assert.Equal(RefKind.Ref, ((MethodSymbol)d.GetMembers("EndInvoke").Single()).RefKind); 801Assert.Equal(RefKind.RefReadOnly, d.DelegateInvokeMethod.RefKind); 802Assert.Equal(RefKind.RefReadOnly, ((MethodSymbol)d.GetMembers("EndInvoke").Single()).RefKind); 804Assert.Equal(RefKind.In, d.DelegateInvokeMethod.Parameters[0].RefKind); 833Assert.Equal(RefKind.In, lambda.Parameters[0].RefKind); 840Assert.Equal(RefKind.In, lambda.Parameters[0].RefKind);
Symbols\Source\ExpressionBodiedPropertyTests.cs (6)
511Assert.Equal(RefKind.Ref, p.GetMethod.RefKind); 534Assert.Equal(RefKind.RefReadOnly, p.GetMethod.RefKind); 561Assert.Equal(RefKind.RefReadOnly, p.GetMethod.RefKind); 562Assert.Equal(RefKind.In, p.GetMethod.Parameters[0].RefKind); 589Assert.Equal(RefKind.RefReadOnly, p.GetMethod.RefKind); 590Assert.Equal(RefKind.In, p.GetMethod.Parameters[0].RefKind);
Symbols\Source\MethodTests.cs (9)
363Assert.Equal(RefKind.Ref, p1.RefKind); 364Assert.Equal(RefKind.Out, p2.RefKind); 405Assert.Equal(RefKind.Ref, m.RefKind); 410Assert.Equal(RefKind.Ref, p1.RefKind); 454Assert.Equal(RefKind.Ref, p1.RefKind); 455Assert.Equal(RefKind.Out, p2.RefKind); 533Assert.Equal(RefKind.Ref, param.RefKind); 1759Assert.Equal(RefKind.Ref, interfaceMethod.RefKind); 1767Assert.Equal(RefKind.Ref, classMethod.RefKind);
Symbols\Source\PropertyTests.cs (1)
1793Assert.Equal(RefKind.Ref, classProperty.RefKind);
Symbols\SymbolErrorTests.cs (1)
3360Assert.Equal(RefKind.Ref, param.RefKind);
Symbols\TypeTests.cs (5)
513Assert.Equal(RefKind.Ref, p1.RefKind); 515Assert.Equal(RefKind.Out, p2.RefKind); 517Assert.Equal(RefKind.None, p3.RefKind); 1557Assert.Equal(RefKind.Ref, paras[0].RefKind); 1558Assert.Equal(RefKind.Out, paras[1].RefKind);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (13)
Extensions.cs (1)
570Assert.Equal(RefKind.None, valueParameter.RefKind);
FunctionPointerUtilities.cs (12)
269public static void VerifyFunctionPointerSymbol(TypeSymbol type, CallingConvention expectedConvention, (RefKind RefKind, Action<TypeSymbol> TypeVerifier) returnVerifier, params (RefKind RefKind, Action<TypeSymbol> TypeVerifier)[] argumentVerifiers) 281case RefKind.RefReadOnly: 286case RefKind.None: 287case RefKind.Ref: 292case RefKind.Out: 307case RefKind.Out: 312case RefKind.In: 317case RefKind.Ref: 318case RefKind.None: 348public static Action<TypeSymbol> IsFunctionPointerTypeSymbol(CallingConvention callingConvention, (RefKind, Action<TypeSymbol>) returnVerifier, params (RefKind, Action<TypeSymbol>)[] argumentVerifiers)
Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests (3)
Metadata\WinMdDumpTest.cs (3)
343AppendSignatureType(result, method.ReturnType, RefKind.None); 416private static void AppendSignatureType(StringBuilder result, TypeSymbol type, RefKind refKind) 420if (refKind != RefKind.None)
Microsoft.CodeAnalysis.CSharp.Workspaces (32)
ArgumentSyntaxExtensions.cs (7)
25public static RefKind GetRefKind(this ArgumentSyntax? argument) 28SyntaxKind.RefKeyword => RefKind.Ref, 29SyntaxKind.OutKeyword => RefKind.Out, 30SyntaxKind.InKeyword => RefKind.In, 31_ => RefKind.None, 83parameter.RefKind != RefKind.Out) 89parameter.RefKind != RefKind.Ref)
CastSimplifier.cs (3)
560if (castedSymbol is not IFieldSymbol and not ILocalSymbol and not IParameterSymbol and not IParameterSymbol { RefKind: RefKind.Ref }) 1242if (operation is IPropertyReferenceOperation { Property.RefKind: not RefKind.Ref }) 1246if (operation is IInvocationOperation { TargetMethod.RefKind: not RefKind.Ref })
CodeGeneration\CSharpSyntaxGenerator.cs (11)
194string name, SyntaxNode? type, SyntaxNode? initializer, RefKind refKind, bool isExtension, bool isParams) 211internal static SyntaxToken GetArgumentModifiers(RefKind refKind) 215case RefKind.None: 216case RefKind.In: 218case RefKind.Out: 220case RefKind.Ref: 3432private protected override SyntaxNode TypeExpression(ITypeSymbol typeSymbol, RefKind refKind) 3437RefKind.Ref => SyntaxFactory.RefType(type), 3438RefKind.RefReadOnly => SyntaxFactory.RefType(SyntaxFactory.Token(SyntaxKind.RefKeyword), SyntaxFactory.Token(SyntaxKind.ReadOnlyKeyword), type), 3485public override SyntaxNode Argument(string? name, RefKind refKind, SyntaxNode expression) 3620=> this.ParameterDeclaration(identifier, type, initializer: null, RefKind.None);
CSharpSyntaxFacts.cs (1)
590public RefKind GetRefKindOfArgument(SyntaxNode node)
CSharpSyntaxGeneratorInternal.cs (6)
120internal static SyntaxTokenList GetParameterModifiers(RefKind refKind, bool forFunctionPointerReturnParameter = false) 123RefKind.None => new SyntaxTokenList(), 124RefKind.Out => SyntaxFactory.TokenList(SyntaxFactory.Token(SyntaxKind.OutKeyword)), 125RefKind.Ref => SyntaxFactory.TokenList(SyntaxFactory.Token(SyntaxKind.RefKeyword)), 129RefKind.In when !forFunctionPointerReturnParameter => SyntaxFactory.TokenList(SyntaxFactory.Token(SyntaxKind.InKeyword)), 130RefKind.RefReadOnly when forFunctionPointerReturnParameter => SyntaxFactory.TokenList(SyntaxFactory.Token(SyntaxKind.RefKeyword), SyntaxFactory.Token(SyntaxKind.ReadOnlyKeyword)),
CSharpTypeInferenceService.TypeInferrer.cs (3)
727return InferTypeInArgument(index, parameterizedSymbols, name, RefKind.None); 760var refKind = argumentOpt.GetRefKind(); 769RefKind refKind)
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs\ExpressionSyntaxExtensions.cs (1)
373ReducedFrom.Parameters: [{ RefKind: RefKind.Ref }, ..],
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (4)
CodeGeneration\SyntaxGeneratorTests.cs (4)
468VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.Argument(RefKind.Ref, Generator.IdentifierName("y"))), "x(ref y)"); 469VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.Argument(RefKind.Out, Generator.IdentifierName("y"))), "x(out y)"); 532new[] { Generator.Argument("goo", RefKind.None, Generator.IdentifierName("x")), 533Generator.Argument("bar", RefKind.None, Generator.IdentifierName("y")) }), "(goo: x, bar: y)");
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (17)
CodeGeneration\CodeGenerationTests.cs (7)
165RefKind.None, 362RefKind.None, 459RefKind.None, 470RefKind.None, 494RefKind.None, 672attributes: default, RefKind.None, isParams, GetTypeSymbol(s.Compilation, type), name, 679attributes: default, RefKind.None, isParams, GetTypeSymbol(s.Compilation, typeFullName, typeArrayRank), parameterName,
CodeGeneration\ExpressionGenerationTests.cs (10)
383f.Argument("n", RefKind.None, f.IdentifierName("a"))), 396f.Argument(null, RefKind.Out, f.IdentifierName("a")), 397f.Argument(null, RefKind.Ref, f.IdentifierName("b"))), 410f.Argument("n1", RefKind.Out, f.IdentifierName("a")), 411f.Argument("n2", RefKind.Ref, f.IdentifierName("b"))), 449f.Argument("n", RefKind.None, f.IdentifierName("a"))), 462f.Argument(null, RefKind.Out, f.IdentifierName("a")), 463f.Argument(null, RefKind.Ref, f.IdentifierName("b"))), 476f.Argument("n1", RefKind.Out, f.IdentifierName("a")), 477f.Argument("n2", RefKind.Ref, f.IdentifierName("b"))),
Microsoft.CodeAnalysis.Features (59)
AbstractAddParameterCodeFixProvider.cs (2)
391private async Task<(ITypeSymbol, RefKind)> GetArgumentTypeAndRefKindAsync(Document invocationDocument, TArgumentSyntax argument, CancellationToken cancellationToken) 396var refKind = syntaxFacts.GetRefKindOfArgument(argument);
AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (2)
507case RefKind.Out: 514case RefKind.Ref:
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.State.cs (1)
112return constructorParams.All(parameter => parameter.RefKind == RefKind.None) &&
AddParameterService.cs (2)
77RefKind refKind, 162RefKind refKind,
ChangeSignature\AbstractChangeSignatureService.cs (1)
823refKind: RefKind.None,
Completion\Providers\AbstractContextVariableArgumentProvider.cs (1)
31|| context.Parameter.RefKind != RefKind.None;
ConvertToInterpolatedString\AbstractConvertPlaceholderToInterpolatedStringRefactoringProvider.cs (1)
72if (syntaxFacts.GetRefKindOfArgument(argument) != RefKind.None)
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (2)
862RefKind.None, 867CodeGenerationSymbolFactory.CreateParameterSymbol(RefKind.Out, p.Type, p.Name)),
EncapsulateField\AbstractEncapsulateFieldService.cs (1)
382refKind: RefKind.None,
ExtractMethod\MethodExtractor.CodeGenerator.cs (5)
354var refKind = GetRefKind(parameter.ParameterModifier); 370private static RefKind GetRefKind(ParameterBehavior parameterBehavior) 372return parameterBehavior == ParameterBehavior.Ref ? RefKind.Ref : 373parameterBehavior == ParameterBehavior.Out ? RefKind.Out : RefKind.None;
GenerateConstructorFromMembers\AbstractGenerateConstructorFromMembersCodeRefactoringProvider.State.cs (1)
107where c.Parameters.All(p => p.RefKind == RefKind.None) && !c.Parameters.Any(static p => p.IsParams)
GenerateEqualsAndGetHashCodeFromMembers\AbstractGenerateEqualsAndGetHashCodeService.cs (1)
141refKind: RefKind.None,
GenerateFromMembers\AbstractGenerateFromMembersCodeRefactoringProvider.cs (1)
112refKind: RefKind.None,
GenerateMember\GenerateConstructor\AbstractGenerateConstructorService.State.cs (1)
44private ImmutableArray<RefKind> _parameterRefKinds;
GenerateMember\GenerateConstructor\Argument.cs (2)
11public readonly RefKind RefKind; 15public Argument(RefKind refKind, string? name, TExpressionSyntax? expression)
GenerateMember\GenerateParameterizedMember\AbstractGenerateDeconstructMethodService.State.cs (1)
81refKind: RefKind.None,
GenerateMember\GenerateParameterizedMember\AbstractGenerateMethodService.State.cs (1)
256refKind: RefKind.None,
GenerateMember\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.MethodSignatureInfo.cs (2)
34protected override RefKind DetermineRefKind(CancellationToken cancellationToken) 40protected override ImmutableArray<RefKind> DetermineParameterModifiers(CancellationToken cancellationToken)
GenerateMember\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.SignatureInfo.cs (2)
50protected abstract RefKind DetermineRefKind(CancellationToken cancellationToken); 65protected abstract ImmutableArray<RefKind> DetermineParameterModifiers(CancellationToken cancellationToken);
GenerateMember\GenerateVariable\AbstractGenerateVariableService.CodeAction.cs (4)
28private readonly RefKind _refKind; 39RefKind refKind, 68var setAccessor = _isReadonly || _refKind != RefKind.None 119return _state.TypeToGenerateIn.TypeKind != TypeKind.Interface && _refKind != RefKind.None
GenerateMember\GenerateVariable\AbstractGenerateVariableService.cs (8)
155document, state, generateProperty: false, isReadonly: false, isConstant: true, refKind: RefKind.None, fallbackOptions)); 169document, state, generateProperty: false, isReadonly: true, isConstant: false, refKind: RefKind.None, fallbackOptions)); 183document, state, generateProperty: false, isReadonly: false, isConstant: false, refKind: RefKind.None, fallbackOptions)); 231parameter.RefKind is RefKind.Out || 256private static RefKind GetRefKindFromContext(State state) 260return RefKind.Ref; 264return RefKind.RefReadOnly; 268return RefKind.None;
GenerateMember\GenerateVariable\AbstractGenerateVariableService.GenerateParameterCodeAction.cs (1)
50RefKind.None,
GenerateType\AbstractGenerateTypeService.GenerateNamedType.cs (2)
50RefKind.None, 201var refKind = syntaxFacts.GetRefKindOfArgument(argumentList[i]);
ImplementInterface\AbstractImplementInterfaceService.DisposePatternCodeAction.cs (1)
296g.Argument(DisposingName, RefKind.None, g.TrueLiteralExpression())))));
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (1)
259if (parameter.RefKind == RefKind.Out)
InitializeParameter\AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs (1)
363RefKind.None,
IntroduceParameter\IntroduceParameterDocumentRewriter.cs (1)
587? _generator.Argument(parameterName, RefKind.None, newArgumentExpression)
MetadataAsSource\AbstractMetadataAsSourceService.WrappedFieldSymbol.cs (1)
32public RefKind RefKind => _symbol.RefKind;
MetadataAsSource\AbstractMetadataAsSourceService.WrappedMethodSymbol.cs (1)
96public RefKind RefKind => _symbol.RefKind;
MetadataAsSource\AbstractMetadataAsSourceService.WrappedPropertySymbol.cs (1)
50public RefKind RefKind => _symbol.RefKind;
ReplaceMethodWithProperty\ReplaceMethodWithPropertyCodeRefactoringProvider.cs (1)
144setMethod.Parameters is [{ RefKind: RefKind.None } parameter] &&
RQName\RQNodeBuilder.cs (2)
152if (parameter.RefKind == RefKind.Out) 156else if (parameter.RefKind == RefKind.Ref)
SuppressMessageAttributeState.TargetSymbolResolver.cs (1)
796if ((symbol.RefKind == RefKind.None) == parameterInfo.IsRefOrOut)
UseCompoundAssignmentUtilities.cs (1)
133if (property.RefKind == RefKind.None)
UseConditionalExpressionForReturnHelpers.cs (2)
81syntaxFacts, anyReturn.GetRefKind(containingSymbol) != RefKind.None, 122isRef = anyReturn.GetRefKind(containingSymbol) != RefKind.None;
Microsoft.CodeAnalysis.Test.Utilities (10)
Compilation\OperationTreeVerifier.cs (4)
389internal void VisitRefKindArrayElement(RefKind element) 422private void VisitArray(ImmutableArray<RefKind> list, string header, bool logElementCount, bool logNullForDefault = false) 884private static void VerifyGetArgumentRefKindPublicApi(HasDynamicArgumentsExpression operation, ImmutableArray<RefKind> argumentRefKinds) 898Assert.Equal(RefKind.None, operation.GetArgumentRefKind(i));
Diagnostics\CouldHaveMoreSpecificTypeAnalyzer.cs (2)
90if (argument.Parameter.RefKind == RefKind.Out || argument.Parameter.RefKind == RefKind.Ref)
Diagnostics\FieldCouldBeReadOnlyAnalyzer.cs (2)
78if (argument.Parameter.RefKind == RefKind.Out || argument.Parameter.RefKind == RefKind.Ref)
Diagnostics\LocalCouldBeConstAnalyzer.cs (2)
71if (argument.Parameter.RefKind == RefKind.Out || argument.Parameter.RefKind == RefKind.Ref)
Microsoft.CodeAnalysis.UnitTests (9)
Diagnostics\OperationTests.cs (9)
26private static void TestCore(Func<ImmutableArray<IOperation>, ImmutableArray<string>, ImmutableArray<RefKind>, HasDynamicArgumentsExpression> createDynamicExpression) 31ImmutableArray<RefKind> argumentRefKinds = default; 47argumentRefKinds = ImmutableArray<RefKind>.Empty; 50Assert.Equal(RefKind.None, dynamicExpression.GetArgumentRefKind(0)); 54RefKind refKind = RefKind.Ref; 80Func<ImmutableArray<IOperation>, ImmutableArray<string>, ImmutableArray<RefKind>, HasDynamicArgumentsExpression> createDynamicExpression = 95Func<ImmutableArray<IOperation>, ImmutableArray<string>, ImmutableArray<RefKind>, HasDynamicArgumentsExpression> createDynamicExpression = 110Func<ImmutableArray<IOperation>, ImmutableArray<string>, ImmutableArray<RefKind>, HasDynamicArgumentsExpression> createDynamicExpression =
Microsoft.CodeAnalysis.VisualBasic (24)
Compilation\ClsComplianceChecker.vb (7)
877Dim xRefKinds As ImmutableArray(Of RefKind) = GetParameterRefKinds(x) 878Dim yRefKinds As ImmutableArray(Of RefKind) = GetParameterRefKinds(y) 941Private Shared Function GetParameterRefKinds(symbol As Symbol) As ImmutableArray(Of RefKind) 953Return ImmutableArray(Of RefKind).Empty 956Dim builder = ArrayBuilder(Of RefKind).GetInstance(parameters.Length) 958builder.Add(If(parameter.IsByRef, RefKind.Ref, RefKind.None))
Compilation\VisualBasicCompilation.vb (2)
2875refKind As RefKind, 2877parameterRefKinds As ImmutableArray(Of RefKind),
Operations\VisualBasicOperationFactory.vb (1)
811Dim argumentRefKinds As ImmutableArray(Of RefKind) = Nothing
SymbolDisplay\SymbolDisplayVisitor.Members.vb (1)
527If symbol.RefKind <> RefKind.None AndAlso IsExplicitByRefParameter(symbol) Then
Symbols\FieldSymbol.vb (2)
441Private ReadOnly Property IFieldSymbol_RefKind As RefKind Implements IFieldSymbol.RefKind 443Return RefKind.None
Symbols\MethodSymbol.vb (3)
1025Private ReadOnly Property IMethodSymbol_RefKind As RefKind Implements IMethodSymbol.RefKind 1027Return If(Me.ReturnsByRef, RefKind.Ref, RefKind.None)
Symbols\ParameterSymbol.vb (3)
298Private ReadOnly Property IParameterSymbol_RefKind As RefKind Implements IParameterSymbol.RefKind 302Return If(Me.IsByRef, RefKind.Ref, RefKind.None)
Symbols\PropertySymbol.vb (3)
592Private ReadOnly Property IPropertySymbol_RefKind As RefKind Implements IPropertySymbol.RefKind 594Return If(Me.ReturnsByRef, RefKind.Ref, RefKind.None)
Symbols\Source\LocalSymbol.vb (2)
298Public ReadOnly Property RefKind As RefKind Implements ILocalSymbol.RefKind 300Return RefKind.None
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (7)
ExpressionSyntaxExtensions.vb (4)
287Return parameter IsNot Nothing AndAlso parameter.RefKind <> RefKind.None 302Return method.Parameters(index).RefKind <> RefKind.None 307Return prop.Parameters(index).RefKind <> RefKind.None 399method.ReducedFrom.Parameters.First().RefKind = RefKind.Ref Then
ParenthesizedExpressionSyntaxExtensions.vb (1)
288parameter.RefKind <> RefKind.None Then
VisualBasicSyntaxFacts.vb (2)
596Public Function GetRefKindOfArgument(node As SyntaxNode) As RefKind Implements ISyntaxFacts.GetRefKindOfArgument 598Return RefKind.None
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (1)
NavigationBar\VisualBasicEditorNavigationBarItemService_CodeGeneration.vb (1)
240refKind:=RefKind.None,
Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator.ExpressionCompiler.UnitTests (1)
ExpressionCompilerTests.vb (1)
1135Assert.Equal(RefKind.Ref, parameter.RefKind)
Microsoft.CodeAnalysis.VisualBasic.Features (16)
CodeFixes\GenerateEvent\GenerateEventCodeFixProvider.vb (3)
145refKind:=RefKind.None, name:=eventHandlerName, 294modifiers:=Nothing, returnType:=returnType, refKind:=RefKind.None, 394refKind:=RefKind.None, name:=actualEventName + "Handler",
CodeRefactorings\InlineTemporary\VisualBasicInlineTemporaryCodeRefactoringProvider.vb (1)
108Return parameter.RefKind <> RefKind.None
Completion\CompletionProviders\CrefCompletionProvider.vb (1)
233If parameter.RefKind = RefKind.Ref Then
ExtractMethod\Extensions.vb (1)
149If parameter.RefKind <> RefKind.None Then
ExtractMethod\VisualBasicMethodExtractor.VisualBasicCodeGenerator.vb (1)
78refKind:=RefKind.None,
GenerateConstructor\VisualBasicGenerateConstructorService.vb (1)
162Return arguments.SelectAsArray(Function(a) New Argument(RefKind.None, TryCast(a, SimpleArgumentSyntax)?.NameColonEquals?.Name.Identifier.ValueText, a.GetArgumentExpression()))
GenerateMember\GenerateParameterizedMember\VisualBasicGenerateConversionService.vb (1)
155refKind:=RefKind.None,
GenerateMember\GenerateParameterizedMember\VisualBasicGenerateParameterizedMemberService.vb (5)
37Protected Overrides Function DetermineRefKind(cancellationToken As CancellationToken) As RefKind 38Return RefKind.None 131Protected Overrides Function DetermineParameterModifiers(cancellationToken As CancellationToken) As ImmutableArray(Of RefKind) 133Me.InvocationExpression.ArgumentList.Arguments.Select(Function(a) RefKind.None).ToImmutableArray(), 134ImmutableArray(Of RefKind).Empty)
GenerateType\VisualBasicGenerateTypeService.vb (1)
704refKind:=RefKind.None,
ImplementInterface\VisualBasicImplementInterfaceService.vb (1)
118g.Argument(DisposingName, RefKind.None, g.FalseLiteralExpression()))))
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (1)
Semantics\RefFieldTests.vb (1)
120Assert.Equal(CodeAnalysis.RefKind.None, DirectCast(field, IFieldSymbol).RefKind)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (1)
Extensions.vb (1)
341Friend Function RefKind(this As ParameterSymbol) As RefKind
Microsoft.CodeAnalysis.VisualBasic.Workspaces (14)
CodeGeneration\VisualBasicSyntaxGenerator.vb (6)
116Public Overloads Overrides Function Argument(name As String, refKind As RefKind, expression As SyntaxNode) As SyntaxNode 407Private Protected Overrides Function TypeExpression(typeSymbol As ITypeSymbol, refKind As RefKind) As SyntaxNode 899refKind As RefKind, 918Private Shared Function GetParameterModifiers(refKind As RefKind, initializer As SyntaxNode) As SyntaxTokenList 924If refKind <> RefKind.None Then 1636Return Argument(name, RefKind.None, expression)
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\ExpressionSyntaxExtensions.vb\ExpressionSyntaxExtensions.vb (4)
287Return parameter IsNot Nothing AndAlso parameter.RefKind <> RefKind.None 302Return method.Parameters(index).RefKind <> RefKind.None 307Return prop.Parameters(index).RefKind <> RefKind.None 399method.ReducedFrom.Parameters.First().RefKind = RefKind.Ref Then
ParenthesizedExpressionSyntaxExtensions.vb (1)
288parameter.RefKind <> RefKind.None Then
Simplification\VisualBasicSimplificationService.Expander.vb (1)
325parameter.RefKind <> RefKind.None Then
VisualBasicSyntaxFacts.vb (2)
596Public Function GetRefKindOfArgument(node As SyntaxNode) As RefKind Implements ISyntaxFacts.GetRefKindOfArgument 598Return RefKind.None
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (4)
CodeGeneration\SyntaxGeneratorTests.vb (4)
426VerifySyntax(Of InvocationExpressionSyntax)(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.Argument(RefKind.Ref, Generator.IdentifierName("y"))), "x(y)") 427VerifySyntax(Of InvocationExpressionSyntax)(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.Argument(RefKind.Out, Generator.IdentifierName("y"))), "x(y)") 472{Generator.Argument("goo", RefKind.None, Generator.IdentifierName("x")), 473Generator.Argument("bar", RefKind.None, Generator.IdentifierName("y"))}), "(goo:=x, bar:=y)")
Microsoft.CodeAnalysis.Workspaces (71)
CodeGenerationAbstractMethodSymbol.cs (1)
45public abstract RefKind RefKind { get; }
CodeGenerationConstructedMethodSymbol.cs (1)
37public override RefKind RefKind => _constructedFrom.RefKind;
CodeGenerationConstructorSymbol.cs (1)
30refKind: RefKind.None,
CodeGenerationConversionSymbol.cs (1)
34refKind: RefKind.None,
CodeGenerationDestructorSymbol.cs (1)
21refKind: RefKind.None,
CodeGenerationFieldSymbol.cs (2)
92public RefKind RefKind => RefKind.None;
CodeGenerationMethodSymbol.cs (4)
33RefKind refKind, 86return RefKind == RefKind.Ref; 94return RefKind == RefKind.RefReadOnly; 98public override RefKind RefKind { get; }
CodeGenerationOperatorSymbol.cs (1)
35refKind: RefKind.None,
CodeGenerationParameterSymbol.cs (2)
19public RefKind RefKind { get; } 32RefKind refKind,
CodeGenerationPropertySymbol.cs (5)
19private readonly RefKind _refKind; 36RefKind refKind, 88public RefKind RefKind => _refKind; 90public bool ReturnsByRef => _refKind == RefKind.Ref; 92public bool ReturnsByRefReadonly => _refKind == RefKind.RefReadOnly;
CodeGenerationSymbolFactory.cs (10)
53RefKind refKind, 84ITypeSymbol type, RefKind refKind, ImmutableArray<IPropertySymbol> explicitInterfaceImplementations, string name, 157RefKind refKind, 179RefKind refKind, 269=> CreateParameterSymbol(RefKind.None, type, name); 271public static IParameterSymbol CreateParameterSymbol(RefKind refKind, ITypeSymbol type, string name) 281ImmutableArray<AttributeData> attributes, RefKind refKind, bool isParams, ITypeSymbol type, string name, bool isOptional = false, bool hasDefaultValue = false, object? defaultValue = null) 292RefKind? refKind = null, 394refKind: RefKind.None, 466RefKind refKind,
Editing\SyntaxGenerator.cs (8)
317RefKind refKind = RefKind.None) 327RefKind refKind, 1920=> TypeExpression(typeSymbol, RefKind.None); 1922private protected abstract SyntaxNode TypeExpression(ITypeSymbol typeSymbol, RefKind refKind); 2223public abstract SyntaxNode Argument(string? name, RefKind refKind, SyntaxNode expression); 2228public SyntaxNode Argument(RefKind refKind, SyntaxNode expression) 2235=> Argument(name: null, RefKind.None, expression);
IParameterSymbolExtensions.cs (2)
15case RefKind.Ref: 16case RefKind.Out:
ISyntaxFacts.cs (1)
312RefKind GetRefKindOfArgument(SyntaxNode node);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs\ISymbolExtensions.cs (1)
434if (symbol is IMethodSymbol method && method.Parameters.All(p => p.RefKind == RefKind.None))
OperationExtensions.cs (9)
157case RefKind.RefReadOnly: 160case RefKind.Out: 163case RefKind.Ref: 174RefKind.RefReadOnly => ValueUsageInfo.ReadableReference, 175RefKind.Ref => ValueUsageInfo.ReadableWritableReference, 212case RefKind.Ref: 215case RefKind.RefReadOnly: 224public static RefKind GetRefKind(this IReturnOperation? operation, ISymbol containingSymbol) 227return containingMethod?.RefKind ?? RefKind.None;
ReassignedVariable\AbstractReassignedVariableService.cs (1)
176symbolIsDefinitelyAssigned: parameter.RefKind != RefKind.Out,
Shared\Extensions\SyntaxGeneratorExtensions.cs (5)
108if (parameter.RefKind != RefKind.Out && 130if (parameter.RefKind != RefKind.Out && 138refKind: RefKind.None, 226var refKind = parameter.RefKind; 230if (refKind == RefKind.Out)
Shared\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
48refKind: RefKind.None,
SymbolEquivalenceComparer.ParameterSymbolEqualityComparer.cs (4)
81public static bool AreRefKindsEquivalent(RefKind rk1, RefKind rk2, bool distinguishRefFromOut) 85: (rk1 == RefKind.None) == (rk2 == RefKind.None);
SymbolKey.cs (1)
280PooledArrayBuilder<RefKind> refKinds)
SymbolKey.FunctionPointerTypeSymbolKey.cs (1)
55var returnRefKind = reader.ReadRefKind();
SymbolKey.SymbolKeyReader.cs (5)
31private readonly ReadFunction<RefKind> _readRefKind; 190public PooledArrayBuilder<RefKind> ReadRefKindArray() 229public RefKind ReadRefKind() 232public RefKind ReadRefKind(out string? failureReason) 235return (RefKind)ReadInteger();
SymbolKey.SymbolKeyWriter.cs (1)
318internal void WriteRefKind(RefKind refKind) => WriteInteger((int)refKind);
SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (2)
441if (parameter.RefKind is RefKind.Ref or RefKind.Out)
Microsoft.VisualStudio.LanguageServices (6)
ChangeSignature\ChangeSignatureDialogViewModel.ParameterViewModels.cs (3)
192case RefKind.Out: 194case RefKind.Ref: 196case RefKind.In:
Progression\GraphBuilder.cs (2)
302node.SetValue<bool>(Properties.IsByReference, parameterSymbol.RefKind == RefKind.Ref); 303node.SetValue<bool>(Properties.IsOut, parameterSymbol.RefKind == RefKind.Out);
Venus\ContainedLanguageCodeSupport.cs (1)
196refKind: RefKind.None,
Microsoft.VisualStudio.LanguageServices.CSharp (4)
CodeModel\CSharpCodeModelService_Prototype.cs (2)
527if (parameter.RefKind == RefKind.Ref) 531else if (parameter.RefKind == RefKind.Out)
ObjectBrowser\DescriptionBuilder.cs (2)
424if (current.RefKind == RefKind.Ref) 428else if (current.RefKind == RefKind.Out)
Microsoft.VisualStudio.LanguageServices.Implementation (9)
CodeModel\AbstractCodeModelObject_CodeGen.cs (7)
77refKind: RefKind.None, 99refKind: RefKind.None, 110refKind: RefKind.None, 155refKind: RefKind.None, 193refKind: RefKind.None, 209refKind: RefKind.None, 221refKind: RefKind.None,
CodeModel\ExternalElements\ExternalCodeParameter.cs (2)
90if (ParameterSymbol.RefKind == RefKind.Ref) 94else if (ParameterSymbol.RefKind == RefKind.Out)
Microsoft.VisualStudio.LanguageServices.UnitTests (6)
ChangeSignature\ChangeSignatureViewModelTests.vb (6)
298Dim includedInTest = {RefKind.None, RefKind.Ref, RefKind.Out, RefKind.In, RefKind.RefReadOnly} 299Assert.Equal(includedInTest, EnumUtilities.GetValues(Of RefKind)())
Microsoft.VisualStudio.LanguageServices.VisualBasic (1)
ObjectBrowser\DescriptionBuilder.vb (1)
389If current.RefKind = RefKind.Ref Then