3131 references to RefKind
ConfigurationSchemaGenerator (2)
RuntimeSource\Configuration.Binder\ConfigurationBindingGenerator.Parser.cs (1)
704else if (parameter.RefKind is not RefKind.None)
RuntimeSource\Configuration.Binder\Specs\Members\ParameterSpec.cs (1)
30public RefKind RefKind { get; }
ILLink.RoslynAnalyzer (18)
DynamicallyAccessedMembersAnalyzer.cs (3)
153 if (member is IFieldSymbol field && field.GetDynamicallyAccessedMemberTypes () != DynamicallyAccessedMemberTypes.None && !field.Type.IsTypeInterestingForDataflow (isByRef: field.RefKind is not RefKind.None)) 161 if (parameter.GetDynamicallyAccessedMemberTypes () != DynamicallyAccessedMemberTypes.None && !parameter.Type.IsTypeInterestingForDataflow (isByRef: parameter.RefKind is not RefKind.None)) 283 || !propertySymbol.Type.IsTypeInterestingForDataflow (isByRef: propertySymbol.RefKind is not RefKind.None)
IOperationExtensions.cs (9)
126 case RefKind.RefReadOnly: 129 case RefKind.Out: 132 case RefKind.Ref: 140 RefKind.RefReadOnly => ValueUsageInfo.ReadableReference, 141 RefKind.Ref => ValueUsageInfo.ReadableWritableReference, 163 case RefKind.Ref: 166 case RefKind.RefReadOnly: 175 public static RefKind GetRefKind (this IReturnOperation operation, ISymbol containingSymbol) 178 return containingMethod?.RefKind ?? RefKind.None;
TrimAnalysis\FlowAnnotations.cs (2)
112 if (!field.OriginalDefinition.Type.IsTypeInterestingForDataflow (isByRef: field.RefKind is not RefKind.None)) 146 bool isByRef = parameter.RefKind is not RefKind.None;
TrimAnalysis\ParameterProxy.cs (4)
26 case RefKind.Ref: return ReferenceKind.Ref; 27 case RefKind.In: return ReferenceKind.In; 28 case RefKind.Out: return ReferenceKind.Out; 29 case RefKind.None: return ReferenceKind.None;
Microsoft.AspNetCore.App.Analyzers (2)
src\Shared\RoslynUtils\ParsabilityHelper.cs (2)
101methodSymbol.Parameters[1].RefKind == RefKind.Out; 112methodSymbol.Parameters[2].RefKind == RefKind.Out;
Microsoft.AspNetCore.Http.RequestDelegateGenerator (2)
src\Shared\RoslynUtils\ParsabilityHelper.cs (2)
101methodSymbol.Parameters[1].RefKind == RefKind.Out; 112methodSymbol.Parameters[2].RefKind == RefKind.Out;
Microsoft.CodeAnalysis (54)
Compilation\Compilation.cs (5)
1105/// * <see cref="RefKind.Out"/> is passed as the returnRefKind. 1113RefKind returnRefKind, 1115ImmutableArray<RefKind> parameterRefKinds, 1124RefKind returnRefKind, 1126ImmutableArray<RefKind> parameterRefKinds,
DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (1)
796if ((symbol.RefKind == RefKind.None) == parameterInfo.IsRefOrOut)
DocumentationCommentId.cs (2)
495if (p.RefKind != RefKind.None) 1400if ((symbol.RefKind == RefKind.None) == parameterInfo.IsRefOrOut)
Emit\EditAndContinue\DefinitionMap.cs (1)
469if (p.RefKind == RefKind.Ref &&
Operations\ControlFlowGraphBuilder.cs (2)
4657return new SimpleAssignmentOperation(isRef: local.RefKind != RefKind.None, 6819Debug.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\IParameterSymbolInternal.cs (1)
10RefKind RefKind { get; }
Symbols\IPropertySymbol.cs (1)
58RefKind RefKind { get; }
Symbols\ISymbolExtensions.cs (1)
146if (enterScopeMethod is not { ReturnsVoid: false, RefKind: RefKind.None })
Symbols\RefKind.cs (17)
52internal static string ToParameterDisplayString(this RefKind kind) 56case RefKind.Out: return "out"; 57case RefKind.Ref: return "ref"; 58case RefKind.In: return "in"; 59case RefKind.RefReadOnlyParameter: return "ref readonly"; 64internal static string ToArgumentDisplayString(this RefKind kind) 68case RefKind.Out: return "out"; 69case RefKind.Ref: return "ref"; 70case RefKind.In: return "in"; 75internal static string ToParameterPrefix(this RefKind kind) 79case RefKind.Out: return "out "; 80case RefKind.Ref: return "ref "; 81case RefKind.In: return "in "; 82case RefKind.RefReadOnlyParameter: return "ref readonly "; 83case RefKind.None: return string.Empty; 93internal const RefKind StrictIn = RefKind.RefReadOnlyParameter + 1;
Microsoft.CodeAnalysis.CodeStyle (36)
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
743methodSymbol.Parameters[0].RefKind == RefKind.None &&
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (2)
544case RefKind.Out: 551case RefKind.Ref:
src\Analyzers\Core\Analyzers\UseCompoundAssignment\UseCompoundAssignmentUtilities.cs (1)
133if (property.RefKind == RefKind.None)
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForReturn\UseConditionalExpressionForReturnHelpers.cs (2)
81syntaxFacts, anyReturn.GetRefKind(containingSymbol) != RefKind.None, 122isRef = anyReturn.GetRefKind(containingSymbol) != RefKind.None;
src\Compilers\Core\Portable\DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (1)
796if ((symbol.RefKind == RefKind.None) == parameterInfo.IsRefOrOut)
src\Workspaces\Core\Portable\Editing\DeclarationModifiers.cs (2)
88isRef: field?.RefKind is RefKind.Ref or RefKind.RefReadOnly || type?.IsRefLikeType == true,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\IParameterSymbolExtensions.cs (2)
15case RefKind.Ref: 16case RefKind.Out:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (1)
435if (symbol is IMethodSymbol method && method.Parameters.All(p => p.RefKind == RefKind.None))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (9)
163case RefKind.RefReadOnly: 166case RefKind.Out: 169case RefKind.Ref: 180RefKind.RefReadOnly => ValueUsageInfo.ReadableReference, 181RefKind.Ref => ValueUsageInfo.ReadableWritableReference, 218case RefKind.Ref: 221case RefKind.RefReadOnly: 230public static RefKind GetRefKind(this IReturnOperation? operation, ISymbol containingSymbol) 233return containingMethod?.RefKind ?? RefKind.None;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (2)
441if (parameter.RefKind is RefKind.Ref or RefKind.Out)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (1)
305RefKind GetRefKindOfArgument(SyntaxNode node);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
273PooledArrayBuilder<RefKind> refKinds)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.FunctionPointerTypeSymbolKey.cs (1)
55var returnRefKind = reader.ReadRefKind();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\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();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (1)
318internal void WriteRefKind(RefKind refKind) => WriteInteger((int)refKind);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.ParameterSymbolEqualityComparer.cs (4)
72public static bool AreRefKindsEquivalent(RefKind rk1, RefKind rk2, bool distinguishRefFromOut) 76: (rk1 == RefKind.None) == (rk2 == RefKind.None);
Microsoft.CodeAnalysis.CodeStyle.Fixes (60)
src\Analyzers\Core\CodeFixes\AddParameter\AbstractAddParameterCodeFixProvider.cs (1)
393private async Task<(ITypeSymbol, RefKind)> GetArgumentTypeAndRefKindAsync(Document invocationDocument, TArgumentSyntax argument, CancellationToken cancellationToken)
src\Analyzers\Core\CodeFixes\AddParameter\AddParameterService.cs (2)
77RefKind refKind, 162RefKind refKind,
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.State.cs (1)
48private ImmutableArray<RefKind> _parameterRefKinds;
src\Analyzers\Core\CodeFixes\GenerateConstructor\Argument.cs (2)
9protected readonly struct Argument(RefKind refKind, string? name, TExpressionSyntax? expression) 11public readonly RefKind RefKind = refKind;
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateDeconstructMethodService.State.cs (1)
76refKind: RefKind.None,
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateMethodService.State.cs (1)
255refKind: RefKind.None,
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.MethodSignatureInfo.cs (2)
27protected override RefKind DetermineRefKind(CancellationToken cancellationToken) 33protected override ImmutableArray<RefKind> DetermineParameterModifiers(CancellationToken cancellationToken)
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.SignatureInfo.cs (2)
50protected abstract RefKind DetermineRefKind(CancellationToken cancellationToken); 65protected abstract ImmutableArray<RefKind> DetermineParameterModifiers(CancellationToken cancellationToken);
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.CodeAction.cs (4)
34private readonly RefKind _refKind; 44RefKind refKind) 70var setAccessor = _isReadonly || _refKind != RefKind.None 121return _state.TypeToGenerateIn.TypeKind != TypeKind.Interface && _refKind != RefKind.None
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.cs (8)
153document, state, generateProperty: false, isReadonly: false, isConstant: true, refKind: RefKind.None)); 167document, state, generateProperty: false, isReadonly: true, isConstant: false, refKind: RefKind.None)); 181document, state, generateProperty: false, isReadonly: false, isConstant: false, refKind: RefKind.None)); 229parameter.RefKind is RefKind.Out || 254private static RefKind GetRefKindFromContext(State state) 258return RefKind.Ref; 262return RefKind.RefReadOnly; 266return RefKind.None;
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.GenerateParameterCodeAction.cs (1)
44RefKind.None,
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator_DisposePattern.cs (1)
203g.Argument(DisposingName, RefKind.None, g.TrueLiteralExpression())))));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\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, 396refKind: RefKind.None, 468RefKind refKind,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractMethodSymbol.cs (1)
45public abstract RefKind RefKind { get; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedMethodSymbol.cs (1)
37public override RefKind RefKind => _constructedFrom.RefKind;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructorSymbol.cs (1)
27refKind: RefKind.None,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConversionSymbol.cs (1)
31refKind: RefKind.None,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationDestructorSymbol.cs (1)
18refKind: RefKind.None,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationFieldSymbol.cs (2)
84public RefKind RefKind => RefKind.None;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationMethodSymbol.cs (4)
33RefKind refKind, 86return RefKind == RefKind.Ref; 94return RefKind == RefKind.RefReadOnly; 98public override RefKind RefKind { get; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationOperatorSymbol.cs (1)
32refKind: RefKind.None,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationParameterSymbol.cs (2)
20RefKind refKind, 28public RefKind RefKind { get; } = refKind;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertySymbol.cs (4)
23RefKind refKind, 75public RefKind RefKind => refKind; 77public bool ReturnsByRef => refKind == RefKind.Ref; 79public bool ReturnsByRefReadonly => refKind == RefKind.RefReadOnly;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (5)
270if (parameter.RefKind != RefKind.Out && 292if (parameter.RefKind != RefKind.Out && 300refKind: RefKind.None, 330var refKind = parameter.RefKind; 334if (refKind == RefKind.Out)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
56refKind: RefKind.None,
Microsoft.CodeAnalysis.CSharp (1805)
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) 49public override RefKind RefKind(int index) { return Microsoft.CodeAnalysis.RefKind.None; }
Binder\Binder.ValueChecks.cs (140)
53Method is { RefKind: not RefKind.None, ReturnType: { } returnType } && 154internal RefKind RefKind { get; } 156internal EscapeArgument(ParameterSymbol? parameter, BoundExpression argument, RefKind refKind, bool isArgList = false) 164public void Deconstruct(out ParameterSymbol? parameter, out BoundExpression argument, out RefKind refKind) 386if (indexerAccess.Indexer.RefKind != RefKind.None) 404var useSetAccessor = coreValueKind == BindValueKind.Assignable && indexerAccess.Indexer.RefKind != RefKind.Ref; 413ArrayBuilder<RefKind>? refKindsBuilderOpt; 416refKindsBuilderOpt = ArrayBuilder<RefKind>.GetInstance(accessorForDefaultArguments.ParameterCount); 1033if (localSymbol.RefKind == RefKind.RefReadOnly || 1034(localSymbol.RefKind == RefKind.None && !localSymbol.IsWritableVariable)) 1042if (localSymbol.RefKind == RefKind.None) 1074if (localSymbol.RefKind == RefKind.None) 1115if (parameterSymbol.RefKind is RefKind.In or RefKind.RefReadOnlyParameter && RequiresAssignableVariable(valueKind)) 1120else if (parameterSymbol.RefKind == RefKind.None && RequiresRefAssignableVariable(valueKind)) 1126Debug.Assert(parameterSymbol.RefKind != RefKind.None || !RequiresRefAssignableVariable(valueKind)); 1130if (parameterSymbol.RefKind == RefKind.None && 1134Debug.Assert(backingField.RefKind == RefKind.None); 1139Debug.Assert(backingField.RefKind == RefKind.None); 1229{ RefKind: RefKind.Out, UseUpdatedEscapeRules: true } => ReturnOnlyScope, 1241{ RefKind: RefKind.None } => CurrentMethodScope, 1243{ HasUnscopedRefAttribute: true, RefKind: RefKind.Out } => ReturnOnlyScope, 1276Debug.Assert(parameterSymbol.RefKind == RefKind.None || isRefScoped || refSafeToEscape == ReturnOnlyScope); 1326if ((fieldSymbol.RefKind == RefKind.None ? RequiresAssignableVariable(valueKind) : RequiresRefAssignableVariable(valueKind)) && 1338case RefKind.None: 1340case RefKind.Ref: 1342case RefKind.RefReadOnly: 1363case RefKind.None: 1366case RefKind.Ref: 1367case RefKind.RefReadOnly: 1466if (fieldSymbol.RefKind != RefKind.None) 1490if (fieldSymbol.RefKind != RefKind.None) 1626if (RequiresVariable(valueKind) && methodSymbol.RefKind == RefKind.None) 1641if (RequiresAssignableVariable(valueKind) && methodSymbol.RefKind == RefKind.RefReadOnly) 1672propertySymbol.RefKind == RefKind.None) 1696if (RequiresAssignableVariable(valueKind) && propertySymbol.RefKind == RefKind.RefReadOnly) 1702var requiresSet = RequiresAssignableVariable(valueKind) && propertySymbol.RefKind == RefKind.None; 1771var requiresGet = !RequiresAssignmentOnly(valueKind) || propertySymbol.RefKind != RefKind.None; 1944ImmutableArray<RefKind> argRefKindsOpt, 2033ImmutableArray<RefKind> argRefKindsOpt, 2063(param is { RefKind: not RefKind.None, Type: { } type } && type.IsRefLikeOrAllowsRefLikeType())) && 2098ImmutableArray<RefKind> argRefKindsOpt, 2155var valid = effectiveRefKind != RefKind.None && isRefEscape ? 2191ImmutableArray<RefKind> argRefKindsOpt, 2224(param is { RefKind: not RefKind.None, Type: { } type } && type.IsRefLikeOrAllowsRefLikeType())) && 2264ImmutableArray<RefKind> argRefKindsOpt, 2325var refKind = parameter?.RefKind ?? RefKind.None; 2330if (refKind == RefKind.None && 2331parameter?.RefKind is RefKind.In or RefKind.RefReadOnlyParameter) 2366if (getArgument.RefKind == RefKind.Ref) 2372if (setArgument.RefKind == RefKind.Ref) 2388return new EscapeArgument(parameter: null, receiver, RefKind.None); 2391var refKind = RefKind.None; 2411ImmutableArray<RefKind> argRefKindsOpt, 2418var refKind = argRefKindsOpt.IsDefault ? RefKind.None : argRefKindsOpt[argIndex]; 2421if (refKind == RefKind.Ref && mixableArguments is not null) 2441ImmutableArray<RefKind> argRefKindsOpt, 2511ImmutableArray<RefKind> argRefKindsOpt, 2566ImmutableArray<RefKind> argRefKindsOpt, 2596if (refKind != RefKind.None) 2609if (parameter.Type.IsRefLikeOrAllowsRefLikeType() && parameter.RefKind != RefKind.Out && GetParameterValEscapeLevel(parameter) is { } valEscapeLevel) 2616if (parameter.RefKind != RefKind.None && GetParameterRefEscapeLevel(parameter) is { } refEscapeLevel) 2642ImmutableArray<RefKind> argRefKindsOpt, 2685if (parameter.RefKind != RefKind.None) 2756ImmutableArray<RefKind> argRefKindsOpt, 2856ImmutableArray<RefKind> argRefKindsOpt, 2978Debug.Assert(underlyingParameter.RefKind != RefKind.Out); // Shouldn't get here for a constructor 2988public override RefKind RefKind 2992if (_underlyingParameter.RefKind is not RefKind.None and var underlyingRefKind) 2999return RefKind.None; 3004return RefKind.Ref; 3212Debug.Assert(field.RefKind == RefKind.None ? RequiresAssignableVariable(kind) : RequiresRefAssignableVariable(kind)); 3409if (methodSymbol.RefKind == RefKind.None) 3431if (methodSymbol.RefKind == RefKind.None) 3492if (methodSymbol.RefKind == RefKind.None) 3519Debug.Assert(GetInlineArrayAccessEquivalentSignatureMethod(elementAccess, out _, out _).RefKind == RefKind.None); 3524ImmutableArray<RefKind> refKinds; 3527Debug.Assert(equivalentSignatureMethod.RefKind != RefKind.None); 3571conversion.Conversion.Method.RefKind == RefKind.None)); 3578unaryMethod.RefKind == RefKind.None)); 3585binaryMethod.RefKind == RefKind.None)); 3591logicalOperator.LogicalOperator.RefKind == RefKind.None)); 3598compoundMethod.RefKind == RefKind.None)); 3726if (methodSymbol.RefKind == RefKind.None) 3752if (indexerSymbol.RefKind == RefKind.None) 3783if (indexerSymbol.RefKind == RefKind.None) 3809if (methodSymbol.RefKind == RefKind.None) 3840Debug.Assert(GetInlineArrayAccessEquivalentSignatureMethod(elementAccess, out _, out _).RefKind == RefKind.None); 3845ImmutableArray<RefKind> refKinds; 3848Debug.Assert(equivalentSignatureMethod.RefKind != RefKind.None); 3870if (signature.RefKind == RefKind.None) 3894if (propertySymbol.RefKind == RefKind.None) 3941conversion.Conversion.Method.RefKind == RefKind.None); 3948unaryMethod.RefKind == RefKind.None)); 3955binaryMethod.RefKind == RefKind.None)); 3961logicalOperator.LogicalOperator.RefKind == RefKind.None)); 3968compoundMethod.RefKind == RefKind.None)); 4213ImmutableArray<RefKind> refKinds; 4326ImmutableArray<RefKind> refKinds; 4526if (constructMethod is not { Parameters: [{ RefKind: RefKind.None } parameter] }) 4661var accessorKind = property.RefKind == RefKind.None ? AccessorKind.Set : AccessorKind.Get; 4946ImmutableArray<RefKind> refKinds; 5100ImmutableArray<RefKind> refKinds; 5420private SignatureOnlyMethodSymbol GetInlineArrayAccessEquivalentSignatureMethod(BoundInlineArrayAccess elementAccess, out ImmutableArray<BoundExpression> arguments, out ImmutableArray<RefKind> refKinds) 5422RefKind resultRefKind; 5423RefKind parameterRefKind; 5434resultRefKind = RefKind.None; 5435parameterRefKind = RefKind.None; 5439resultRefKind = elementAccess.GetItemOrSliceHelper is WellKnownMember.System_ReadOnlySpan_T__get_Item ? RefKind.In : RefKind.Ref; 5448resultRefKind = RefKind.None; 5449parameterRefKind = elementAccess.GetItemOrSliceHelper is WellKnownMember.System_ReadOnlySpan_T__Slice_Int_Int ? RefKind.In : RefKind.Ref; 5482private SignatureOnlyMethodSymbol GetInlineArrayConversionEquivalentSignatureMethod(BoundConversion conversion, out ImmutableArray<BoundExpression> arguments, out ImmutableArray<RefKind> refKinds) 5488private SignatureOnlyMethodSymbol GetInlineArrayConversionEquivalentSignatureMethod(BoundExpression inlineArray, TypeSymbol resultType, out ImmutableArray<BoundExpression> arguments, out ImmutableArray<RefKind> refKinds) 5494RefKind parameterRefKind = resultType.OriginalDefinition.Equals(_compilation.GetWellKnownType(WellKnownType.System_ReadOnlySpan_T), TypeCompareKind.AllIgnoreOptions) ? RefKind.In : RefKind.Ref; 5509RefKind.None, 5725((BoundParameter)expression).ParameterSymbol.RefKind is not (RefKind.In or RefKind.RefReadOnlyParameter); 5731return !((CodeGenerator.IsStackLocal(local, stackLocalsOpt) && local.RefKind == RefKind.None) || 5732(!IsAnyReadOnly(addressKind) && local.RefKind == RefKind.RefReadOnly)); 5735var methodRefKind = ((BoundCall)expression).Method.RefKind; 5736return methodRefKind == RefKind.Ref || 5737(IsAnyReadOnly(addressKind) && methodRefKind == RefKind.RefReadOnly); 5741var dupRefKind = ((BoundDup)expression).RefKind; 5742return dupRefKind == RefKind.Ref || 5743(IsAnyReadOnly(addressKind) && dupRefKind == RefKind.RefReadOnly); 5757var lhsRefKind = assignment.Left.GetRefKind(); 5758return lhsRefKind == RefKind.Ref || 5759(IsAnyReadOnly(addressKind) && lhsRefKind is RefKind.RefReadOnly or RefKind.RefReadOnlyParameter); 5825if (field.RefKind is RefKind.Ref) 5848if (field.RefKind == RefKind.RefReadOnly) 5853Debug.Assert(field.RefKind == RefKind.None);
Binder\Binder_AnonymousTypes.cs (1)
96RefKind.None,
Binder\Binder_Attributes.cs (4)
250if (attributeConstructor.Parameters.Any(static p => p.RefKind is RefKind.In or RefKind.RefReadOnlyParameter)) 482BindArgumentExpression(diagnostics, argument.Expression, RefKind.None, allowArglist: false), 484refKind: RefKind.None);
Binder\Binder_Crefs.cs (5)
794refKind: RefKind.None, 811refKind: RefKind.None, 935RefKind refKind = parameter.RefKindKeyword.Kind().GetRefKind(); 936if (refKind == RefKind.Ref && parameter.ReadOnlyKeyword.IsKind(SyntaxKind.ReadOnlyKeyword)) 939refKind = RefKind.RefReadOnlyParameter;
Binder\Binder_Deconstruct.cs (2)
647analyzedArguments.RefKinds.Add(RefKind.Out); 687if (parameters[i].RefKind != RefKind.Out)
Binder\Binder_Expressions.cs (64)
454if (field is { IsStatic: false, RefKind: RefKind.None, ContainingSymbol: SourceMemberContainerTypeSymbol { PrimaryConstructor: { } primaryConstructor } } && 466RefKind refKind, 1892private bool IsBadLocalOrParameterCapture(Symbol symbol, TypeSymbol type, RefKind refKind) 1894if (refKind != RefKind.None || type.IsRestrictedType()) 2018if (localSymbol.RefKind == RefKind.None && type.IsRestrictedType(ignoreSpanLikeTypes: true)) 2058if (parameter.RefKind != RefKind.None) 2078(parameter.RefKind != RefKind.None || parameter.Type.IsRestrictedType()) && 2081if (parameter.RefKind != RefKind.None) 2095else if (primaryCtor is { ThisParameter.RefKind: not RefKind.None } && 2456if (thisSymbol is not null && thisSymbol.ContainingSymbol != ContainingMemberOrLambda && thisSymbol.RefKind != RefKind.None) 3010RefKind origRefKind = argumentSyntax.RefOrOutKeyword.Kind().GetRefKind(); 3014RefKind refKind = origRefKind == RefKind.None || RefMustBeObeyed(isDelegateCreation, argumentSyntax) ? origRefKind : RefKind.None; 3027if (!hadError && isDelegateCreation && origRefKind != RefKind.None && result.Arguments.Count == 1) 3034var requiredValueKind = origRefKind == RefKind.In ? BindValueKind.ReadonlyRef : BindValueKind.RefOrOut; 3046private BoundExpression BindArgumentValue(BindingDiagnosticBag diagnostics, ArgumentSyntax argumentSyntax, bool allowArglist, RefKind refKind) 3245RefKind refKind) 3253if (refKind != RefKind.None) 3263result.RefKinds.Add(RefKind.None); 3311private BoundExpression BindArgumentExpression(BindingDiagnosticBag diagnostics, ExpressionSyntax argumentExpression, RefKind refKind, bool allowArglist) 3314refKind == RefKind.None ? 3316refKind == RefKind.In ? 3367var argRefKind = analyzedArguments.RefKind(arg); 3373if (argRefKind is RefKind.None or RefKind.In && 3374getCorrespondingParameter(in result, parameters, arg).RefKind == RefKind.RefReadOnlyParameter) 3385if (argRefKind == RefKind.Ref) 3387if (getCorrespondingParameter(in result, parameters, arg).RefKind == RefKind.In) 3397else if (argRefKind == RefKind.None && 3398getCorrespondingParameter(in result, parameters, arg).RefKind == RefKind.RefReadOnlyParameter) 3750var argumentRefKindsBuilder = ArrayBuilder<RefKind>.GetInstance(handlerArgumentIndexes.Length); 3760RefKind refKind; 3766refKind = RefKind.None; 3844argumentRefKindsBuilder.Add(refKind == RefKind.RefReadOnlyParameter ? RefKind.In : refKind); 4938if (analyzedArguments.RefKind(i) is (RefKind.Ref or RefKind.Out)) 5455ArrayBuilder<RefKind> refKinds, 5646var rhsExpr = initializer.Right.CheckAndUnwrapRefExpression(diagnostics, out RefKind refKind); 5647bool isRef = refKind == RefKind.Ref; 5764ImmutableArray<RefKind> argumentRefKindsOpt = default; 8113extensionMethodArguments.RefKinds.Add(RefKind.None); 8247RefKind returnRefKind, 8509fieldSymbol.RefKind != RefKind.None) 9471RefKind refKind = analyzedArguments.RefKind(i); 9472if (refKind != RefKind.None) 9571default(ImmutableArray<RefKind>), 9689ImmutableArray<RefKind> argumentRefKinds = analyzedArguments.RefKinds.ToImmutableOrNull(); 9940original.Parameters[0] is { Type.SpecialType: SpecialType.System_Int32, RefKind: RefKind.None }) 10038original.Parameters[0] is { Type.SpecialType: SpecialType.System_Int32, RefKind: RefKind.None } && 10039original.Parameters[1] is { Type.SpecialType: SpecialType.System_Int32, RefKind: RefKind.None }; 10102getMethod.RefKind == RefKind.None && 10145RefKind returnRefKind = default, 10166RefKind returnRefKind = default, 10193RefKind returnRefKind, 10214RefKind returnRefKind = default, 10284RefKind returnRefKind = default, 10602RefKind? returnRefKindOverride = null, 10609var returnRefKind = returnRefKindOverride ?? methodSymbol.RefKind; 10629if (returnsVoid && returnRefKind != RefKind.None) 10643returnRefKind == RefKind.None && 10645(parameterRefKinds.IsDefault || parameterRefKinds.All(refKind => refKind == RefKind.None)) && 10679parameterRefKinds.IsDefault ? RefKind.None : parameterRefKinds[i],
Binder\Binder_InterpolatedString.cs (8)
422ImmutableArray<RefKind> additionalConstructorRefKinds = default) 442ImmutableArray<RefKind> additionalConstructorRefKinds = default) 468ImmutableArray<RefKind> additionalConstructorRefKinds) 501ImmutableArray<RefKind> additionalConstructorRefKinds) 577var refKindsBuilder = ArrayBuilder<RefKind>.GetInstance(constructorArgumentLength); 578refKindsBuilder.Add(RefKind.None); 579refKindsBuilder.Add(RefKind.None); 589refKindsBuilder.Add(RefKind.Out);
Binder\Binder_Invocation.cs (13)
294else if (analyzedArguments.RefKind(i) == RefKind.None) 301case RefKind.None: 302case RefKind.Ref: 313ImmutableArray<RefKind> refKinds = analyzedArguments.RefKinds.ToImmutableOrNull(); 546ImmutableArray<RefKind> refKinds, 565if (refKinds[argIndex] == RefKind.In) 1226if (receiverParameter.RefKind == RefKind.Ref) 1239analyzedArguments.RefKinds[0] = RefKind.Ref; 1242else if (receiverParameter.RefKind == RefKind.In) 1245Debug.Assert(analyzedArguments.RefKind(0) == RefKind.None); 1467ArrayBuilder<RefKind>? argumentRefKindsBuilder, 1552argumentRefKindsBuilder.Add(RefKind.None); 1577argumentRefKindsBuilder.Add(RefKind.None);
Binder\Binder_Lambda.cs (9)
45ImmutableArray<RefKind> refKinds = default; 49RefKind returnRefKind = RefKind.None; 123var refKindsBuilder = ArrayBuilder<RefKind>.GetInstance(); 170var refKind = RefKind.None; 210if (refKindsBuilder.Any(r => r != RefKind.None)) 280private (RefKind, TypeWithAnnotations) BindExplicitLambdaReturnType(TypeSyntax syntax, BindingDiagnosticBag diagnostics) 285syntax = syntax.SkipScoped(out _).SkipRefInLocalOrReturn(diagnostics, out RefKind refKind);
Binder\Binder_Operators.cs (8)
2644if (parameterSymbol.RefKind != RefKind.None) 2675return localSymbol.RefKind != RefKind.None; 4270var whenTrue = node.WhenTrue.CheckAndUnwrapRefExpression(diagnostics, out var whenTrueRefKind); 4271var whenFalse = node.WhenFalse.CheckAndUnwrapRefExpression(diagnostics, out var whenFalseRefKind); 4273var isRef = whenTrueRefKind == RefKind.Ref && whenFalseRefKind == RefKind.Ref; 4276if (whenFalseRefKind == RefKind.Ref) 4281if (whenTrueRefKind == RefKind.Ref)
Binder\Binder_Query.cs (3)
696return lambdaBodyBinder.CreateBlockFromExpression(node, ImmutableArray<LocalSymbol>.Empty, RefKind.None, construction, null, d); 776return this.CreateBlockFromExpression(expression, locals, RefKind.None, result, expression, diagnostics); 818new AnonymousTypeField(fieldName, fieldValue.Syntax.Location, TypeWithAnnotations.Create(TypeOrError(fieldValue)), RefKind.None, ScopedKind.None);
Binder\Binder_Statements.cs (48)
860internal BoundExpression BindInferredVariableInitializer(BindingDiagnosticBag diagnostics, RefKind refKind, EqualsValueClauseSyntax initializer, 909RefKind variableRefKind, 914RefKind expressionRefKind = RefKind.None; 916if (variableRefKind == RefKind.None) 919if (expressionRefKind == RefKind.Ref) 927valueKind = variableRefKind == RefKind.RefReadOnly 936else if (expressionRefKind != RefKind.Ref) 997if (localSymbol.RefKind != RefKind.None) 1063localSymbol.RefKind != RefKind.None ? ConversionForAssignmentFlags.RefAssignment : ConversionForAssignmentFlags.None); 1414var rhsExpr = node.Right.CheckAndUnwrapRefExpression(diagnostics, out var refKind); 1415var isRef = refKind == RefKind.Ref; 1444var lhsRefKind = boundLeft.GetRefKind(); 1445if (lhsRefKind is RefKind.Ref or RefKind.Out) 2108var delegateRefKind = delegateParameters[i].RefKind; 2109if (delegateRefKind != RefKind.None) 2149var lambdaRefKind = anonymousFunction.RefKind(i); 2151var delegateRefKind = delegateParameters[i].RefKind; 2163if (delegateRefKind == RefKind.None) 2870protected virtual TypeSymbol GetCurrentReturnType(out RefKind refKind) 2887refKind = RefKind.None; 2893var refKind = RefKind.None; 2911RefKind sigRefKind; 2922if (refKind != RefKind.None) 2934else if ((object)retType != null && (refKind != RefKind.None) != (sigRefKind != RefKind.None)) 2936var errorCode = refKind != RefKind.None 3034RefKind returnRefKind, 3044Debug.Assert(returnRefKind == RefKind.None); 3066if (returnRefKind != RefKind.None) 3082RefKind unusedRefKind; 3350internal BoundBlock CreateBlockFromExpression(CSharpSyntaxNode node, ImmutableArray<LocalSymbol> locals, RefKind refKind, BoundExpression expression, ExpressionSyntax expressionSyntax, BindingDiagnosticBag diagnostics) 3352RefKind returnRefKind; 3357if (IsInAsyncMethod() && refKind != RefKind.None) 3366if ((refKind != RefKind.None) != (returnRefKind != RefKind.None) && expression.Kind != BoundKind.ThrowExpression) 3368var errorCode = refKind != RefKind.None 3373statement = new BoundReturnStatement(syntax, RefKind.None, expression, @checked: CheckOverflowAtRuntime) { WasCompilerGenerated = true }; 3477RefKind refKind; 3493RefKind refKind; 3506return bodyBinder.CreateBlockFromExpression(body, bodyBinder.GetDeclaredLocalsForScope(body), RefKind.None, expression, body, diagnostics); 3509private BindValueKind GetRequiredReturnValueKind(RefKind refKind) 3512if (refKind != RefKind.None) 3514GetCurrentReturnType(out var sigRefKind); 3515requiredValueKind = sigRefKind == RefKind.Ref ? 3866argumentRefKindsOpt: ImmutableArray<RefKind>.Empty,
Binder\ExecutableCodeBinder.cs (3)
112if (parameter.RefKind != RefKind.None) 136RefKind refKind = iterator.RefKind; 141if (refKind != RefKind.None)
Binder\ForEachLoopBinder.cs (12)
244if (getEnumeratorMethod.ParameterRefKinds is { IsDefault: false } refKinds && refKinds[0] == RefKind.Ref) 323if (local.RefKind != RefKind.None) 336case RefKind.None: 339case RefKind.Ref: 342case RefKind.RefReadOnly: 471if (elementConversionClassification.Kind != ConversionKind.Identity && IterationVariable.RefKind is RefKind.Ref or RefKind.RefReadOnly) 866builder.CurrentPropertyGetter?.RefKind == (wellKnownSpan == WellKnownType.System_ReadOnlySpan_T ? RefKind.RefReadOnly : RefKind.Ref)) || 1203patternDisposeMethod.ParameterRefKinds.All(static refKind => refKind is RefKind.None or RefKind.In or RefKind.RefReadOnlyParameter));
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\LockBinder.cs (1)
80if (enterScopeMethod is not { ReturnsVoid: false, RefKind: RefKind.None })
Binder\RefSafetyAnalysis.cs (5)
501Debug.Assert(localSymbol.RefKind == RefKind.None || 515if (localSymbol.RefKind != RefKind.None) 532ValidateEscape(expr, ReturnOnlyScope, node.RefKind != RefKind.None, _diagnostics); 1058ImmutableArray<RefKind> refKinds; 1086AddLocalScopes(local, refEscapeScope: local.RefKind == RefKind.None ? _localScopeDepth : collectionEscape, valEscapeScope: collectionEscape);
Binder\Semantics\Conversions\ConversionsBase.cs (5)
1469if (anonymousFunction.HasExplicitReturnType(out var refKind, out var returnType)) 1513if (delegateParameters[p].RefKind != RefKind.None) 1555if (delegateParameters[p].RefKind == RefKind.Out) 3392bool hasConversion(RefKind refKind, TypeWithAnnotations sourceType, TypeWithAnnotations destinationType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 3396case RefKind.None:
Binder\Semantics\Operators\BinaryOperatorOverloadResolution.cs (8)
1276if (op1.LeftRefKind == RefKind.None && op2.LeftRefKind == RefKind.In) 1280else if (op2.LeftRefKind == RefKind.None && op1.LeftRefKind == RefKind.In) 1289if (op1.RightRefKind == RefKind.None && op2.RightRefKind == RefKind.In) 1300else 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)
229if (op1.RefKind == RefKind.None && op2.RefKind == RefKind.In) 233else 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)
137private readonly ImmutableArray<RefKind> _formalParameterRefKinds; 271ImmutableArray<RefKind> formalParameterRefKinds, // Optional; assume all value if missing. 320ImmutableArray<RefKind> formalParameterRefKinds, 423private RefKind GetRefKind(int index) 426return _formalParameterRefKinds.IsDefault ? RefKind.None : _formalParameterRefKinds[index]; 1479RefKind delegateRefKind, 2320if ((sourceParam.Type.IsReferenceType || sourceParam.Type.IsFunctionPointer()) && sourceParam.RefKind == RefKind.None) 2330if ((sourceSignature.ReturnType.IsReferenceType || sourceSignature.ReturnType.IsFunctionPointer()) && sourceSignature.RefKind == RefKind.None) 2670if ((sourceParam.Type.IsReferenceType || sourceParam.Type.IsFunctionPointer()) && sourceParam.RefKind == RefKind.None) 2680if ((sourceSignature.ReturnType.IsReferenceType || sourceSignature.ReturnType.IsFunctionPointer()) && sourceSignature.RefKind == RefKind.None)
Binder\Semantics\OverloadResolution\OverloadResolution.cs (78)
143RefKind returnRefKind = default, 191RefKind returnRefKind = default, 263RefKind returnRefKind, 725RefKind? returnRefKind, 750else if (returnRefKind == RefKind.None) 2040var type1 = getParameterTypeAndRefKind(i, m1.Result, m1LeastOverriddenParameters, m1.Result.ParamsElementTypeOpt, out RefKind parameter1RefKind); 2042var type2 = getParameterTypeAndRefKind(i, m2.Result, m2LeastOverriddenParameters, m2.Result.ParamsElementTypeOpt, out RefKind parameter2RefKind); 2434static TypeSymbol getParameterTypeAndRefKind(int i, MemberAnalysisResult result, ImmutableArray<ParameterSymbol> parameters, TypeWithAnnotations paramsElementTypeOpt, out RefKind parameter1RefKind) 2505if (p1.RefKind == RefKind.None && isAcceptableRefMismatch(p2.RefKind, isInterpolatedStringHandlerConversion)) 2516else if (p2.RefKind == RefKind.None && isAcceptableRefMismatch(p1.RefKind, isInterpolatedStringHandlerConversion)) 2532static bool isAcceptableRefMismatch(RefKind refKind, bool isInterpolatedStringHandlerConversion) 2535RefKind.In or RefKind.RefReadOnlyParameter => true, 2536RefKind.Ref when isInterpolatedStringHandlerConversion => true, 2712RefKind refKind1, 2715RefKind refKind2, 2740Debug.Assert(refKind1 == RefKind.None || refKind1 == RefKind.Ref); 2741Debug.Assert(refKind2 == RefKind.None || refKind2 == RefKind.Ref); 2745if (refKind1 == RefKind.None) 2754else if (refKind1 == RefKind.Ref) 3495ArrayBuilder<RefKind> argumentRefKinds, 3501out ImmutableArray<RefKind> parameterRefKinds) 3517internal readonly ImmutableArray<RefKind> ParameterRefKinds; 3520internal EffectiveParameters(ImmutableArray<TypeWithAnnotations> types, ImmutableArray<RefKind> refKinds, int firstParamsElementIndex) 3534ArrayBuilder<RefKind> argumentRefKinds, 3549ImmutableArray<RefKind> parameterRefKinds = member.GetParameterRefKinds(); 3557ArrayBuilder<RefKind> refs = null; 3571RefKind argRefKind = hasAnyRefArg ? argumentRefKinds[arg] : RefKind.None; 3572RefKind paramRefKind = GetEffectiveParameterRefKind(parameter, argRefKind, options, binder, ref hasAnyRefOmittedArgument); 3576if (paramRefKind != RefKind.None) 3578refs = ArrayBuilder<RefKind>.GetInstance(arg, RefKind.None); 3588var refKinds = refs != null ? refs.ToImmutableAndFree() : default(ImmutableArray<RefKind>); 3592private static RefKind GetEffectiveParameterRefKind( 3594RefKind argRefKind, 3599var paramRefKind = parameter.RefKind; 3608if (paramRefKind == RefKind.In) 3610if (argRefKind == RefKind.None) 3612return RefKind.None; 3615if (argRefKind == RefKind.Ref && binder.Compilation.IsFeatureEnabled(MessageID.IDS_FeatureRefReadonlyParameters)) 3617return RefKind.Ref; 3620else if (paramRefKind == RefKind.RefReadOnlyParameter && argRefKind is RefKind.None or RefKind.Ref or RefKind.In) 3633if ((options & Options.AllowRefOmittedArguments) != 0 && paramRefKind == RefKind.Ref && argRefKind == RefKind.None && !binder.InAttributeArgument) 3636return RefKind.None; 3645internal static bool AreRefsCompatibleForMethodConversion(RefKind candidateMethodParameterRefKind, RefKind delegateParameterRefKind, CSharpCompilation compilation) 3655(RefKind.RefReadOnlyParameter, RefKind.Ref) or 3656(RefKind.RefReadOnlyParameter, RefKind.In) or 3657(RefKind.In, RefKind.RefReadOnlyParameter)) 3663(candidateMethodParameterRefKind, delegateParameterRefKind) is (RefKind.In, RefKind.Ref)) 3675ArrayBuilder<RefKind> argumentRefKinds, 3686ArrayBuilder<RefKind> argumentRefKinds, 3694var refs = ArrayBuilder<RefKind>.GetInstance(); 3724var argRefKind = hasAnyRefArg ? argumentRefKinds[arg] : RefKind.None; 3725var paramRefKind = GetEffectiveParameterRefKind(parameter, argRefKind, options, binder, ref hasAnyRefOmittedArgument); 3728if (paramRefKind != RefKind.None) 3734var refKinds = anyRef ? refs.ToImmutable() : default(ImmutableArray<RefKind>); 4149RefKind argumentRefKind = arguments.RefKind(argumentPosition); 4150RefKind parameterRefKind = parameters.ParameterRefKinds.IsDefault ? RefKind.None : parameters.ParameterRefKinds[argumentPosition]; 4155Debug.Assert(argumentRefKind == RefKind.None); 4156if (parameterRefKind == RefKind.Ref) 4170&& parameterRefKind == RefKind.Ref 4265RefKind argRefKind, 4267RefKind parRefKind, 4303Debug.Assert(argRefKind != RefKind.None); 4309if (argRefKind == RefKind.None || hasInterpolatedStringRefMismatch)
Binder\Semantics\OverloadResolution\OverloadResolutionResult.cs (21)
202RefKind? returnRefKind = null, 1122if (parameters[i].RefKind != RefKind.None) 1189RefKind refArg = arguments.RefKind(arg); 1190RefKind refParameter = parameter.RefKind; 1194Debug.Assert(refArg == RefKind.None); 1195if (refParameter == RefKind.Ref || refParameter == RefKind.In) 1253!(refArg == RefKind.None && refParameter == RefKind.In) && 1254!(refArg == RefKind.Ref && refParameter == RefKind.In && binder.Compilation.IsFeatureEnabled(MessageID.IDS_FeatureRefReadonlyParameters)) && 1255!(refParameter == RefKind.RefReadOnlyParameter && refArg is RefKind.None or RefKind.Ref or RefKind.In)) 1260refParameter != RefKind.Out) 1265else if (refArg == RefKind.Ref && refParameter == RefKind.In && !binder.Compilation.IsFeatureEnabled(MessageID.IDS_FeatureRefReadonlyParameters)) 1276else if (refParameter is RefKind.None or RefKind.In or RefKind.RefReadOnlyParameter)
Binder\WithLambdaParametersBinder.cs (1)
47protected override TypeSymbol GetCurrentReturnType(out RefKind refKind)
BoundTree\BoundExpression.cs (1)
539ImmutableArray<RefKind> newRefKinds,
BoundTree\BoundExpressionExtensions.cs (7)
20public static RefKind GetRefKind(this BoundExpression node) 54return RefKind.Ref; 56return RefKind.RefReadOnly; 60return RefKind.None; 66return RefKind.None; 72EventSymbol => RefKind.None, 77return 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 (28)
63fieldSymbol.RefKind != RefKind.None || 93ImmutableArray<RefKind> argumentRefKindsOpt, 111ImmutableArray<RefKind> argumentRefKindsOpt, 127ImmutableArray<RefKind> refKinds, 183public static BoundCall Synthesized(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, MethodSymbol method, ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> argumentRefKindsOpt = default) 192var parameterRefKind = method.ParameterRefKinds.IsDefault ? RefKind.None : method.ParameterRefKinds[i]; 193var argumentRefKind = argumentRefKindsOpt.IsDefault ? RefKind.None : argumentRefKindsOpt[i]; 194Debug.Assert(argumentRefKind is RefKind.None or RefKind.Ref or RefKind.In or RefKind.Out or RefKindExtensions.StrictIn && 198RefKind.In => argumentRefKind == RefKindExtensions.StrictIn, 199RefKind.RefReadOnlyParameter => argumentRefKind is RefKind.In or RefKindExtensions.StrictIn, 230static ImmutableArray<RefKind> getArgumentRefKinds(MethodSymbol method) 234if (!result.IsDefaultOrEmpty && result.Contains(RefKind.RefReadOnlyParameter)) 236var builder = ArrayBuilder<RefKind>.GetInstance(result.Length); 238foreach (var refKind in result) 240builder.Add(refKind == RefKind.RefReadOnlyParameter ? RefKind.In : refKind); 254: this(syntax, constructor, ImmutableArray.Create<BoundExpression>(arguments), default(ImmutableArray<string?>), default(ImmutableArray<RefKind>), false, default(ImmutableArray<int>), default(BitVector), null, null, constructor.ContainingType) 258: this(syntax, constructor, arguments, default(ImmutableArray<string?>), default(ImmutableArray<RefKind>), false, default(ImmutableArray<int>), default(BitVector), null, null, constructor.ContainingType) 271ImmutableArray<RefKind> refKinds, 297ImmutableArray<RefKind> argumentRefKindsOpt, 312ImmutableArray<RefKind> argumentRefKindsOpt, 631public 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, 462public bool HasExplicitReturnType(out RefKind refKind, out TypeWithAnnotations returnType) 471public RefKind RefKind(int index) { return Data.RefKind(index); } 556public abstract bool HasExplicitReturnType(out RefKind refKind, out TypeWithAnnotations returnType); 563public abstract RefKind RefKind(int index); 638private static TypeWithAnnotations DelegateReturnTypeWithAnnotations(MethodSymbol? invokeMethod, out RefKind refKind) 642refKind = CodeAnalysis.RefKind.None; 649internal (ImmutableArray<RefKind>, ArrayBuilder<ScopedKind>, ImmutableArray<TypeWithAnnotations>, bool) CollectParameterProperties() 651var parameterRefKindsBuilder = ArrayBuilder<RefKind>.GetInstance(ParameterCount); 658var refKind = RefKind(i); 715if (!HasExplicitReturnType(out var returnRefKind, out var returnType)) 778var returnType = DelegateReturnTypeWithAnnotations(invokeMethod, out RefKind refKind); 797refKind == CodeAnalysis.RefKind.None && 817if (lambdaSymbol.RefKind == CodeAnalysis.RefKind.RefReadOnly) 884ImmutableArray<RefKind> parameterRefKinds, 885RefKind refKind) 899var returnType = DelegateReturnTypeWithAnnotations(invokeMethod, out RefKind refKind); 932ImmutableArray<RefKind> parameterRefKinds) 934bool hasExplicitReturnType = HasExplicitReturnType(out var refKind, out var returnType); 989ImmutableArray<RefKind> parameterRefKinds, 991RefKind refKind) 1025public readonly ImmutableArray<RefKind> ParameterRefKinds; 1028public static readonly ReturnInferenceCacheKey Empty = new ReturnInferenceCacheKey(ImmutableArray<TypeWithAnnotations>.Empty, ImmutableArray<RefKind>.Empty, null); 1030private ReturnInferenceCacheKey(ImmutableArray<TypeWithAnnotations> parameterTypes, ImmutableArray<RefKind> parameterRefKinds, NamedTypeSymbol? taskLikeReturnTypeOpt) 1091out ImmutableArray<RefKind> parameterRefKinds, 1097parameterRefKinds = ImmutableArray<RefKind>.Empty; 1106var refKindsBuilder = ArrayBuilder<RefKind>.GetInstance(parameterCount); 1182?? rebind(ReallyInferReturnType(delegateType: null, ImmutableArray<TypeWithAnnotations>.Empty, ImmutableArray<RefKind>.Empty)); 1199ImmutableArray<RefKind> parameterRefKinds) 1202var refKind = inferredReturnType.RefKind; 1214refKind = CodeAnalysis.RefKind.None; 1427private readonly RefKind _returnRefKind; 1433private readonly ImmutableArray<RefKind> _parameterRefKinds; 1442RefKind returnRefKind, 1448ImmutableArray<RefKind> parameterRefKinds, 1473public override bool HasExplicitReturnType(out RefKind refKind, out TypeWithAnnotations returnType) 1532public override RefKind RefKind(int index) 1535return _parameterRefKinds.IsDefault ? Microsoft.CodeAnalysis.RefKind.None : _parameterRefKinds[index]; 1570statements[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?"); 125var funcPtrRefKind = funcPtrInvocation.FunctionPointer.Signature.RefKind; 126if (funcPtrRefKind == RefKind.Ref || 127(IsAnyReadOnly(addressKind) && funcPtrRefKind == RefKind.RefReadOnly)) 181var methodRefKind = call.Method.RefKind; 182return methodRefKind == RefKind.Ref || 183(IsAnyReadOnly(addressKind) && methodRefKind == RefKind.RefReadOnly); 276if (local.RefKind != RefKind.None) 482if (parameterSymbol.RefKind == RefKind.None) 556field.RefKind == RefKind.None ? 560_builder.EmitOpCode(field.RefKind == RefKind.None ? ILOpCode.Ldflda : ILOpCode.Ldfld);
CodeGen\EmitExpression.cs (53)
710RefKind refKind = expression.ArgumentRefKindsOpt.IsDefaultOrEmpty ? RefKind.None : expression.ArgumentRefKindsOpt[i]; 715private void EmitArgument(BoundExpression argument, RefKind refKind) 719case RefKind.None: 723case RefKind.In: 729Debug.Assert(refKind is RefKind.Ref or RefKind.Out or RefKindExtensions.StrictIn); 737Debug.Assert(argument.Type.IsDynamic() || argument is BoundFieldAccess { FieldSymbol.RefKind: not RefKind.None }, "passing args byref should not clone them into temps"); 779if (expression.RefKind == RefKind.None) 946private void EmitArguments(ImmutableArray<BoundExpression> arguments, ImmutableArray<ParameterSymbol> parameters, ImmutableArray<RefKind> argRefKindsOpt) 951Debug.Assert(parameters.All(p => p.RefKind == RefKind.None) || !argRefKindsOpt.IsDefault, "there are nontrivial parameters, so we must have argRefKinds"); 958RefKind argRefKind = GetArgumentRefKind(arguments, parameters, argRefKindsOpt, i); 967internal static RefKind GetArgumentRefKind(ImmutableArray<BoundExpression> arguments, ImmutableArray<ParameterSymbol> parameters, ImmutableArray<RefKind> argRefKindsOpt, int i) 969RefKind argRefKind; 980RefKind.In => argRefKind == RefKindExtensions.StrictIn, 981RefKind.RefReadOnlyParameter => argRefKind is RefKind.In or RefKindExtensions.StrictIn, 988Debug.Assert(parameters[i].RefKind != RefKind.RefReadOnlyParameter, 994RefKind.RefReadOnlyParameter => RefKind.In, // should not happen, asserted above 1003argRefKind = RefKind.None; 1132if (!field.IsVolatile && !field.IsStatic && fieldAccess.ReceiverOpt.Type.IsVerifierValue() && field.RefKind == RefKind.None) 1144if (field.RefKind != RefKind.None) 1288return ((BoundParameter)receiver).ParameterSymbol.RefKind != RefKind.None; 1292return ((BoundLocal)receiver).LocalSymbol.RefKind != RefKind.None; 1301if (field.IsStatic || field.RefKind != RefKind.None) 1392bool isRefLocal = local.LocalSymbol.RefKind != RefKind.None; 1424if (parameter.ParameterSymbol.RefKind != RefKind.None) 1739var methodRefKind = call.Method.RefKind; 2214return ((BoundLocal)receiver).LocalSymbol.RefKind != RefKind.None; 2217return ((BoundParameter)receiver).ParameterSymbol.RefKind != RefKind.None; 2220return ((BoundCall)receiver).Method.RefKind != RefKind.None; 2223return ((BoundFunctionPointerInvocation)receiver).FunctionPointer.Signature.RefKind != RefKind.None; 2226return ((BoundDup)receiver).RefKind != RefKind.None; 2633if (System.Linq.ImmutableArrayExtensions.All(ctor.Parameters, p => p.RefKind == RefKind.None) && 2757return ((BoundParameter)left).ParameterSymbol.RefKind == RefKind.None; 2762return ((BoundLocal)left).LocalSymbol.RefKind == RefKind.None; 2782if (left.FieldSymbol.RefKind != RefKind.None && 2800if (left.ParameterSymbol.RefKind != RefKind.None && 2832if (left.LocalSymbol.RefKind != RefKind.None && !assignmentOperator.IsRef) 2931Debug.Assert(left.Method.RefKind != RefKind.None); 2942Debug.Assert(left.FunctionPointer.Signature.RefKind != RefKind.None); 2994LocalDefinition temp = EmitAddress(assignmentOperator.Right, lhs.GetRefKind() is RefKind.RefReadOnly or RefKindExtensions.StrictIn or RefKind.RefReadOnlyParameter ? AddressKind.ReadOnlyStrict : AddressKind.Writeable); 3077if (local.LocalSymbol.RefKind != RefKind.None && !assignment.IsRef) 3110Debug.Assert(((BoundDup)expression).RefKind != RefKind.None); 3133Debug.Assert(((BoundCall)expression).Method.RefKind != RefKind.None); 3138Debug.Assert(((BoundFunctionPointerInvocation)expression).FunctionPointer.Signature.RefKind != RefKind.None); 3282if (field.RefKind != RefKind.None && !refAssign) 3297if (parameter.ParameterSymbol.RefKind != RefKind.None && !refAssign) 4088if (useKind == UseKind.UsedAsValue && method.RefKind != RefKind.None) 4094Debug.Assert(method.RefKind != RefKind.None);
CodeGen\EmitStatement.cs (10)
749Debug.Assert(local.RefKind == RefKind.None || local.SynthesizedKind.IsLongLived(), 865if (boundReturnStatement.RefKind == RefKind.None) 873var unexpectedTemp = this.EmitAddress(expressionOpt, this._method.RefKind == RefKind.RefReadOnly ? AddressKind.ReadOnlyStrict : AddressKind.Writeable); 1147Debug.Assert(exceptionSourceLocal.LocalSymbol.RefKind == RefKind.None); 1159Debug.Assert(left.FieldSymbol.RefKind == RefKind.None); 1283if (local.RefKind == RefKind.None && !IsStackLocal(local)) 1292if (parameter.ParameterSymbol.RefKind == RefKind.None) 1759CSharpCompilation.DynamicTransformsEncoder.Encode(local.Type, RefKind.None, 0) : 1789Debug.Assert(local.RefKind == RefKind.None); 1805(local.RefKind != RefKind.None ? LocalSlotConstraints.ByRef : LocalSlotConstraints.None);
CodeGen\Optimizer.cs (23)
858if (node.LocalSymbol.RefKind != RefKind.None) 878if (node.LocalSymbol.RefKind != RefKind.None) 986if (localSymbol.RefKind is RefKind.RefReadOnly or RefKindExtensions.StrictIn && 1031(lhs.Kind is BoundKind.Local or BoundKind.Parameter or BoundKind.FieldAccess && lhs.GetRefKind() != RefKind.None), 1041if (((BoundParameter)lhs).ParameterSymbol.RefKind != RefKind.None) 1049if (((BoundLocal)lhs).LocalSymbol.RefKind != RefKind.None) 1057Debug.Assert(((BoundCall)lhs).Method.RefKind == RefKind.Ref, "only ref returning methods are assignable"); 1061Debug.Assert(((BoundFunctionPointerInvocation)lhs).FunctionPointer.Signature.RefKind == RefKind.Ref, "only ref returning function pointers are assignable"); 1221if (unwrappedSequence is BoundLocal { LocalSymbol: { RefKind: not RefKind.None } localSymbol }) 1255private ImmutableArray<BoundExpression> VisitArguments(ImmutableArray<BoundExpression> arguments, ImmutableArray<ParameterSymbol> parameters, ImmutableArray<RefKind> argRefKindsOpt) 1265RefKind argRefKind = CodeGenerator.GetArgumentRefKind(arguments, parameters, argRefKindsOpt, i); 1272private void VisitArgument(ImmutableArray<BoundExpression> arguments, ref ArrayBuilder<BoundExpression> rewrittenArguments, int i, RefKind argRefKind) 1274ExprContext context = (argRefKind == RefKind.None) ? ExprContext.Value : ExprContext.Address; 1296ImmutableArray<RefKind> argRefKindsOpt = node.ArgumentRefKindsOpt; 1300RefKind refKind = argRefKindsOpt.IsDefaultOrEmpty ? RefKind.None : argRefKindsOpt[i]; 1428if (localSym.RefKind == RefKind.None) 1874Debug.Assert(local.RefKind == RefKind.None, "cannot take a ref of a ref"); 1935return top.Item2 == (local.RefKind == RefKind.None ? ExprContext.Value : ExprContext.Address) && 2162var isIndirectLocalStore = left.LocalSymbol.RefKind != RefKind.None && !node.IsRef; 2191left.LocalSymbol.RefKind == RefKind.Ref && 2428public override RefKind RefKind 2430get { return RefKind.None; }
Compilation\CSharpCompilation.cs (5)
2228if (method.RefKind != RefKind.None) 4020RefKind returnRefKind, 4022ImmutableArray<RefKind> parameterRefKinds, 4055if (returnRefKind == RefKind.Out) 4195fields.Add(new AnonymousTypeField(name, location, TypeWithAnnotations.Create(type, nullableAnnotation), RefKind.None, ScopedKind.None));
Compiler\ClsComplianceChecker.cs (2)
1327ImmutableArray<RefKind> xRefKinds; 1328ImmutableArray<RefKind> yRefKinds;
Compiler\MethodBodySynthesizer.cs (5)
50argumentRefKindsOpt: ImmutableArray<RefKind>.Empty, 193statement = new BoundReturnStatement(accessor.SyntaxNode, RefKind.None, fieldAccess, @checked: false); 311BoundStatement returnStatement = BoundReturnStatement.Synthesized(syntax, RefKind.None, processHandlerCall); 321BoundStatement returnStatement = new BoundReturnStatement(syntax, RefKind.None, expressionOpt: null, @checked: false); 358refKind: RefKind.None,
DocumentationComments\DocumentationCommentIDVisitor.PartVisitor.cs (1)
248if (symbol.RefKind != RefKind.None)
Emitter\EditAndContinue\CSharpSymbolMatcher.cs (8)
657return parameter.RefKind is RefKind.None == other.RefKind is RefKind.None && 694private static void ValidateFunctionPointerParamOrReturn(TypeWithAnnotations type, RefKind refKind, ImmutableArray<CustomModifier> refCustomModifiers, bool allowOut) 699static bool verifyRefModifiers(ImmutableArray<CustomModifier> modifiers, RefKind refKind, bool allowOut) 701Debug.Assert(RefKind.RefReadOnly == RefKind.In); 704case RefKind.RefReadOnly: 705case RefKind.Out when allowOut:
Emitter\Model\FieldSymbolAdapter.cs (1)
56bool Cci.IFieldReference.IsByReference => AdaptedFieldSymbol.RefKind != RefKind.None;
Emitter\Model\ParameterSymbolAdapter.cs (1)
41return AdaptedParameterSymbol.RefKind != RefKind.None;
Emitter\Model\ParameterTypeInformation.cs (1)
39return _underlyingParameter.RefKind != RefKind.None;
Emitter\Model\PEModuleBuilder.cs (1)
1228!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)
1084VisitArguments(node.Arguments, default(ImmutableArray<RefKind>), null); 1245VisitRvalue(node.InitializerOpt, isKnownToBeAnLvalue: node.LocalSymbol.RefKind != RefKind.None); 1248if (node.LocalSymbol.RefKind != RefKind.None) 1388WriteArgument(receiverOpt, RefKind.Ref, method: null); 1394var thisRefKind = thisParameter.RefKind; 1468protected virtual void VisitArguments(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt, MethodSymbol method) 1475private void VisitArgumentsBeforeCall(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt) 1480RefKind refKind = GetRefKind(refKindsOpt, i); 1481if (refKind != RefKind.Out) 1483VisitRvalue(arguments[i], isKnownToBeAnLvalue: refKind != RefKind.None); 1495private void VisitArgumentsAfterCall(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt, MethodSymbol method) 1499RefKind refKind = GetRefKind(refKindsOpt, i); 1501if (refKind != RefKind.None) 1508protected static RefKind GetRefKind(ImmutableArray<RefKind> refKindsOpt, int index) 1510return refKindsOpt.IsDefault || refKindsOpt.Length <= index ? RefKind.None : refKindsOpt[index]; 1513protected virtual void WriteArgument(BoundExpression arg, RefKind refKind, MethodSymbol method) 1936VisitRvalue(node.ExpressionOpt, isKnownToBeAnLvalue: node.RefKind != RefKind.None); 1939if (node.RefKind != RefKind.None) 2049if (property.RefKind == RefKind.None) 2067var refKind = node.Left.Kind == BoundKind.BadExpression 2068? RefKind.Ref 2104if (property.RefKind == RefKind.None) 2123if (property.RefKind == RefKind.None) 2715if (property.RefKind == RefKind.None) 3212WriteArgument(operand, RefKind.Ref, method: null); 3398this.WriteArgument(operand, RefKind.Out, null); //Out because we know it will definitely be assigned. 3439VisitArguments(node.Arguments, default(ImmutableArray<RefKind>), node.Constructor); 3523VisitArguments(node.Arguments, default(ImmutableArray<RefKind>), node.AddMethod); 3529VisitArguments(node.Arguments, default(ImmutableArray<RefKind>), node.AddMethod); 3537VisitArguments(node.Arguments, default(ImmutableArray<RefKind>), method: null); 3619property.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.GetFirstLocation().SourceSpan)) ||
FlowAnalysis\DefiniteAssignment.cs (14)
1226((ParameterSymbol)symbol).RefKind == RefKind.Out) 1326if (fieldSymbol.RefKind != RefKind.None) 1510if (!isRef && node is BoundFieldAccess { FieldSymbol.RefKind: not RefKind.None } fieldAccess) 1563if (local.LocalSymbol.RefKind != RefKind.None && !isRef) 1614if (isRef && param.RefKind == RefKind.Out) 1794if (parameter.RefKind != RefKind.Out) 1806if (thisParameter.RefKind != RefKind.Out) 1829if (current is not MethodSymbol && parameter.RefKind == RefKind.Out) 1859if (parameter.RefKind == RefKind.Out && !(this.CurrentSymbol is MethodSymbol currentMethod && currentMethod.IsAsync)) // out parameters not allowed in async 1925if (!parameter.IsThis && parameter.RefKind != RefKind.Out && parameter.ContainingSymbol is SynthesizedPrimaryConstructor primaryCtor) 1937if (parameter.RefKind != RefKind.None) 2522protected override void WriteArgument(BoundExpression arg, RefKind refKind, MethodSymbol method) 2524if (refKind == RefKind.Ref) 2538if (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)); 138if (field.RefKind == RefKind.None) 202: BoundReturnStatement.Synthesized(syntax, RefKind.None, null);
FlowAnalysis\NullableWalker.cs (53)
1242var refKind = parameter.RefKind; 1243if (refKind != RefKind.Out && refKind != RefKind.Ref) 2333RefKind refKind, 2343if (refKind == RefKind.Ref) 2346return AreParameterAnnotationsCompatible(RefKind.None, overriddenType, overriddenAnnotations, overridingType, overridingAnnotations, forRef: true) && 2347AreParameterAnnotationsCompatible(RefKind.Out, overriddenType, overriddenAnnotations, overridingType, overridingAnnotations); 2350if (refKind is RefKind.None or RefKind.In or RefKind.RefReadOnlyParameter) 2380if (refKind == RefKind.Out) 2785if (parameter.RefKind != RefKind.Out) 2858if (node.RefKind == RefKind.None && 2867if (node.RefKind == RefKind.None) 6104var refKind = GetRefKind(node.ArgumentRefKindsOpt, 0); 6162ImmutableArray<RefKind> refKindsOpt = node.ArgumentRefKindsOpt; 6592protected override void VisitArguments(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt, MethodSymbol method) 6601ImmutableArray<RefKind> refKindsOpt, 6614ImmutableArray<RefKind> refKindsOpt, 6629ImmutableArray<RefKind> refKindsOpt, 6650ImmutableArray<RefKind> refKindsOpt, 6691ImmutableArray<RefKind> refKindsOpt, 6861ImmutableArray<RefKind> refKindsOpt, 6879static void expandParamsCollection(ref ImmutableArray<BoundExpression> arguments, ref ImmutableArray<RefKind> refKindsOpt, ImmutableArray<ParameterSymbol> parametersOpt, ref ImmutableArray<int> argsToParamsOpt, ref BitVector defaultArguments) 6939var refKindsBuilder = ArrayBuilder<RefKind>.GetInstance(refKindsOpt.Length + elements.Length - 1); 6941refKindsBuilder.AddMany(RefKind.None, elements.Length); 7064ImmutableArray<RefKind> refKindsOpt, 7125private VisitResult VisitArgumentEvaluate(BoundExpression argument, RefKind refKind, FlowAnalysisAnnotations annotations) 7137private VisitResult VisitArgumentEvaluateEpilogue(BoundExpression argument, RefKind refKind, FlowAnalysisAnnotations annotations) 7143case RefKind.Ref: 7146case RefKind.None: 7147case RefKind.In: 7169case RefKind.Out: 7192RefKind refKind, 7207case RefKind.None: 7208case RefKind.In: 7246case RefKind.Ref: 7266case RefKind.Out: 7329RefKind refKind, 7342case RefKind.None: 7343case RefKind.In: 7349case RefKind.Ref: 7376case RefKind.Out: 7582ImmutableArray<RefKind> refKindsOpt) 7593RefKind refKind = GetRefKind(refKindsOpt, i); 7596if (refKind == RefKind.None) 7664ImmutableArray<RefKind> argumentRefKindsOpt, 7673var refKinds = ArrayBuilder<RefKind>.GetInstance(); 7694parameterRefKinds: out ImmutableArray<RefKind> parameterRefKinds); 9933case BoundLocal { LocalSymbol.RefKind: RefKind.None }: 9934case BoundParameter { ParameterSymbol: { RefKind: RefKind.None } parameter } when 11811TypeWithAnnotations elementType = InMethodBinder.GetIteratorElementTypeFromReturnType(compilation, RefKind.None, 11851VisitArguments(node, node.ConstructorArguments, ImmutableArray<RefKind>.Empty, node.Constructor, argsToParamsOpt: node.ConstructorArgumentsToParamsOpt, defaultArguments: node.ConstructorDefaultArguments,
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)
920public BoundDup(SyntaxNode syntax, RefKind refKind, TypeSymbol? type, bool hasErrors) 926public BoundDup(SyntaxNode syntax, RefKind refKind, TypeSymbol? type) 932public RefKind RefKind { get; } 937public BoundDup Update(RefKind refKind, TypeSymbol? type) 1445public BoundFunctionPointerInvocation(SyntaxNode syntax, BoundExpression invokedExpression, ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> argumentRefKindsOpt, LookupResultKind resultKind, TypeSymbol type, bool hasErrors = false) 1462public ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 1468public BoundFunctionPointerInvocation Update(BoundExpression invokedExpression, ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> argumentRefKindsOpt, LookupResultKind resultKind, TypeSymbol type) 3063public BoundArgListOperator(SyntaxNode syntax, ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> argumentRefKindsOpt, TypeSymbol? type, bool hasErrors = false) 3075public ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 3080public BoundArgListOperator Update(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> argumentRefKindsOpt, TypeSymbol? type) 3569public BoundReturnStatement(SyntaxNode syntax, RefKind refKind, BoundExpression? expressionOpt, bool @checked, bool hasErrors = false) 3577public RefKind RefKind { get; } 3584public BoundReturnStatement Update(RefKind refKind, BoundExpression? expressionOpt, bool @checked) 5893public BoundDynamicInvocation(SyntaxNode syntax, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type, bool hasErrors = false) 5909public ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 5915public BoundDynamicInvocation Update(ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type) 6143public BoundCall(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, 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) 6172public ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 6184public BoundCall Update(BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, 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) 6282public BoundUnconvertedObjectCreationExpression(SyntaxNode syntax, ImmutableArray<BoundExpression> arguments, ImmutableArray<(string Name, Location Location)?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, InitializerExpressionSyntax? initializerOpt, Binder binder, bool hasErrors = false) 6299public ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 6306public BoundUnconvertedObjectCreationExpression Update(ImmutableArray<BoundExpression> arguments, ImmutableArray<(string Name, Location Location)?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, InitializerExpressionSyntax? initializerOpt, Binder binder) 6341public 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) 6367public override ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 6378public 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) 6621public 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) 6642public override ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 6650public BoundDynamicObjectCreationExpression Update(string name, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, BoundObjectInitializerExpressionBase? initializerExpressionOpt, ImmutableArray<MethodSymbol> applicableMethods, bool wasTargetTyped, TypeSymbol type) 6743public BoundObjectInitializerMember(SyntaxNode syntax, Symbol? memberSymbol, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool expanded, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, LookupResultKind resultKind, AccessorKind accessorKind, TypeSymbol receiverType, TypeSymbol type, bool hasErrors = false) 6767public ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 6778public BoundObjectInitializerMember Update(Symbol? memberSymbol, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool expanded, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, LookupResultKind resultKind, AccessorKind accessorKind, TypeSymbol receiverType, TypeSymbol type) 7409public BoundIndexerAccess(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, PropertySymbol indexer, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool expanded, AccessorKind accessorKind, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, ImmutableArray<PropertySymbol> originalIndexersOpt, TypeSymbol type, bool hasErrors = false) 7436public ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 7446public BoundIndexerAccess Update(BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, PropertySymbol indexer, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool expanded, AccessorKind accessorKind, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, ImmutableArray<PropertySymbol> originalIndexersOpt, TypeSymbol type) 7550public BoundDynamicIndexerAccess(SyntaxNode syntax, BoundExpression receiver, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<PropertySymbol> applicableIndexers, TypeSymbol type, bool hasErrors = false) 7570public ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 7576public BoundDynamicIndexerAccess Update(BoundExpression receiver, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<PropertySymbol> applicableIndexers, TypeSymbol type)
Lowering\AsyncRewriter\AsyncExceptionHandlerRewriter.cs (1)
335unpendReturn = new BoundReturnStatement(_F.Syntax, RefKind.None, pendingValue, @checked: false);
Lowering\AsyncRewriter\AsyncMethodBuilderMemberCollection.cs (1)
488method.RefKind == RefKind.None &&
Lowering\AsyncRewriter\AsyncMethodToStateMachineRewriter.cs (1)
423refKinds: ImmutableArray<RefKind>.Empty,
Lowering\ClosureConversion\ClosureConversion.cs (7)
562new BoundReturnStatement(syntax, RefKind.None, null, @checked: false)); 874ref ImmutableArray<RefKind> argRefKinds) 915var refkindsBuilder = ArrayBuilder<RefKind>.GetInstance(argumentsBuilder.Count); 922refkindsBuilder.AddMany(RefKind.None, arguments.Length); 925refkindsBuilder.AddMany(RefKind.Ref, frameCount); 1341var argRefKinds = default(ImmutableArray<RefKind>); 1368ImmutableArray<RefKind> argRefKinds = default;
Lowering\ClosureConversion\LambdaCapturedVariable.cs (2)
120public override RefKind RefKind => RefKind.None;
Lowering\ClosureConversion\SynthesizedClosureMethod.cs (1)
121if (RefKind == RefKind.RefReadOnly)
Lowering\DiagnosticsPass_ExpressionTrees.cs (5)
308ImmutableArray<RefKind> argumentRefKindsOpt, 347else if (method.RefKind != RefKind.None) 516VisitCall(node.AddMethod, null, node.Arguments, default(ImmutableArray<RefKind>), default(ImmutableArray<string>), node.DefaultArguments, node); 540if (_inExpressionLambda && property.RefKind != RefKind.None) 575if (p.RefKind != RefKind.None && p.TryGetFirstLocation() is Location location)
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\CompoundInstrumenter.cs (1)
168ref ImmutableArray<RefKind> argumentRefKindsOpt)
Lowering\Instrumentation\Instrumenter.cs (1)
242ref ImmutableArray<RefKind> argumentRefKindsOpt)
Lowering\Instrumentation\LocalStateTracingInstrumenter.cs (5)
307if (parameter.RefKind == RefKind.Out || parameter.IsDiscard) 448Debug.Assert(parameter.RefKind == RefKind.None); 552private BoundExpression InstrumentCall(BoundExpression invocation, ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKinds) 577if (refKinds[i] is not (RefKind.Ref or RefKind.Out))
Lowering\Instrumentation\ModuleCancellationInstrumenter.cs (4)
122ref ImmutableArray<RefKind> argumentRefKindsOpt) 131(argumentRefKindsOpt.IsDefault || argumentRefKindsOpt is [.., RefKind.None]) && 145argumentRefKindsOpt = argumentRefKindsOpt.IsDefault ? default : [.. argumentRefKindsOpt, RefKind.None]; 186member is MethodSymbol { Parameters: [.., { RefKind: RefKind.None, Type: { } lastParamType }] parametersWithCancellationToken } overload &&
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)
1087return ((BoundCall)expr).Method.RefKind != RefKind.None; 1090return ((BoundPropertyAccess)expr).PropertySymbol.RefKind != RefKind.None; 1093return ((BoundIndexerAccess)expr).Indexer.RefKind != RefKind.None; 1128symbol.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, 191default(ImmutableArray<RefKind>), 222Debug.Assert(!isRef || rewrittenLeft.GetRefKind() != RefKind.None); 272ImmutableArray<RefKind> argumentRefKindsOpt,
Lowering\LocalRewriter\LocalRewriter_Call.cs (81)
140ref ImmutableArray<RefKind> argumentRefKindsOpt, 285var thisRefKind = methodThisParameter.RefKind; 288if (thisRefKind != RefKind.None 291thisRefKind == RefKind.Ref ? Binder.AddressKind.Writeable : Binder.AddressKind.ReadOnlyStrict, 305if (argumentRefKindsOpt.IsDefault && thisRefKind != RefKind.None) 386ImmutableArray<RefKind> argRefKindsOpt = node.ArgumentRefKindsOpt; 444ImmutableArray<RefKind> argumentRefKinds, 531argumentRefKinds: default(ImmutableArray<RefKind>), 536private static bool IsSafeForReordering(BoundExpression expression, RefKind kind) 562return kind != RefKind.None; 660ImmutableArray<RefKind> argumentRefKindsOpt, 680RefKind refKind; 692refKind = rewrittenReceiver.Type.IsValueType || rewrittenReceiver.Type.Kind == SymbolKind.TypeParameter ? RefKind.Ref : RefKind.None; 698refKind = RefKind.None; 704if (refKind == RefKind.None && 711refKind = RefKind.Ref; 880RefKind argRefKind = argumentRefKindsOpt.RefKinds(argIndex); 881RefKind paramRefKind = parameters[paramIndex].RefKind; 883local = _factory.StoreToTemp(visitedArgument, out var store, refKind: paramRefKind is RefKind.In or RefKind.RefReadOnlyParameter ? RefKind.In : argRefKind); 952var intermediateRef = _factory.Local(_factory.SynthesizedLocal(receiverType, refKind: RefKind.Ref)); 1003ref ImmutableArray<RefKind> argumentRefKindsOpt, 1086ArrayBuilder<RefKind> refKinds = ArrayBuilder<RefKind>.GetInstance(parameters.Length, RefKind.None); 1156private static ImmutableArray<RefKind> GetEffectiveArgumentRefKinds(ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<ParameterSymbol> parameters) 1158ArrayBuilder<RefKind>? refKindsBuilder = null; 1161var paramRefKind = parameters[i].RefKind; 1162if (paramRefKind is RefKind.In or RefKind.RefReadOnlyParameter) 1164var argRefKind = argumentRefKindsOpt.IsDefault ? RefKind.None : argumentRefKindsOpt[i]; 1166refKindsBuilder[i] = argRefKind == RefKind.None ? RefKind.In : RefKindExtensions.StrictIn; 1168else if (paramRefKind == RefKind.Ref) 1170var argRefKind = argumentRefKindsOpt.IsDefault ? RefKind.None : argumentRefKindsOpt[i]; 1171if (argRefKind == RefKind.None) 1177refKindsBuilder[i] = RefKind.Ref; 1191static void fillRefKindsBuilder(ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<ParameterSymbol> parameters, [NotNull] ref ArrayBuilder<RefKind>? refKindsBuilder) 1198refKindsBuilder = ArrayBuilder<RefKind>.GetInstance(parameters.Length); 1203refKindsBuilder = ArrayBuilder<RefKind>.GetInstance(parameters.Length, fillWithValue: RefKind.None); 1244private static ImmutableArray<RefKind> GetRefKindsOrNull(ArrayBuilder<RefKind> refKinds) 1248if (refKind != RefKind.None) 1253return default(ImmutableArray<RefKind>); 1306ImmutableArray<RefKind> argumentRefKinds, 1310/* out */ ArrayBuilder<RefKind> refKinds, 1322RefKind argRefKind = argumentRefKinds.RefKinds(a); 1323RefKind paramRefKind = parameters[p].RefKind; 1331Debug.Assert(argRefKind == RefKind.None); 1347arg.rewriter.StoreArgumentToTempIfNecessary(arg.forceLambdaSpilling, arg.storesToTemps, element, RefKind.None, RefKind.None), 1364if (paramRefKind is RefKind.In or RefKind.RefReadOnlyParameter) 1366Debug.Assert(argRefKind is RefKind.None or RefKind.In or RefKind.Ref); 1367argRefKind = argRefKind == RefKind.None ? RefKind.In : RefKindExtensions.StrictIn; 1376private BoundExpression StoreArgumentToTempIfNecessary(bool forceLambdaSpilling, ArrayBuilder<BoundAssignmentOperator> storesToTemps, BoundExpression argument, RefKind argRefKind, RefKind paramRefKind) 1388refKind: paramRefKind is RefKind.In or RefKind.RefReadOnlyParameter 1389? (argRefKind == RefKind.None ? RefKind.In : RefKindExtensions.StrictIn) 1443default(ImmutableArray<RefKind>), 1603ArrayBuilder<RefKind> argsRefKindsBuilder, 1616RefKind paramRefKind = parameters[argIndex].RefKind; 1617RefKind argRefKind = argsRefKindsBuilder[argIndex]; 1621if (argRefKind != RefKind.None || paramRefKind != RefKind.Ref) 1629var localRefKind = ((BoundLocal)argument).LocalSymbol.RefKind; 1630if (localRefKind == RefKind.Ref) 1636Debug.Assert(localRefKind == RefKind.None); 1648argsRefKindsBuilder[argIndex] = RefKind.Ref;
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (1)
552var call = _factory.New(constructor, arguments: [temp], argumentRefKinds: [asReadOnlySpan ? RefKindExtensions.StrictIn : RefKind.Ref]);
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (20)
205var receiverTemp = _factory.StoreToTemp(rewrittenReceiver, out assignmentToTemp, refKind: variableRepresentsLocation ? RefKind.Ref : RefKind.None); 324ImmutableArray<RefKind> argumentRefKinds = indexerAccess.ArgumentRefKindsOpt; 332ArrayBuilder<RefKind> refKinds = ArrayBuilder<RefKind>.GetInstance(parameters.Length, RefKind.None); 425Debug.Assert(implicitIndexerAccess.IndexerOrSliceAccess.GetRefKind() == RefKind.None); 448var variableTemp = _factory.StoreToTemp(arrayAccess, out assignmentToTemp, refKind: RefKind.Ref); 526var temp = _factory.StoreToTemp(VisitExpression(arguments[i]), out assignmentToTemp, indexerAccess.ArgumentRefKindsOpt.RefKinds(i) != RefKind.None ? RefKind.Ref : RefKind.None); 597if (propertyAccess.PropertySymbol.RefKind == RefKind.None) 612if (indexerAccess.GetRefKind() == RefKind.None) 625if (implicitIndexerAccess.GetRefKind() == RefKind.None) 678Debug.Assert(originalLHS.GetRefKind() == RefKind.Ref); 699Debug.Assert(((BoundCall)originalLHS).Method.RefKind != RefKind.None); 703Debug.Assert(((BoundFunctionPointerInvocation)originalLHS).FunctionPointer.Signature.RefKind != RefKind.None); 754var variableTemp = _factory.StoreToTemp(rewrittenVariable, out assignmentToTemp2, refKind: RefKind.Ref); 854((BoundParameter)expression).ParameterSymbol.RefKind != RefKind.None || 858return 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_ForEachStatement.cs (5)
621RefKind collectionTempRefKind = RefKind.None; 709private delegate BoundStatement? GetForEachStatementAsForPreamble(LocalRewriter rewriter, SyntaxNode syntax, ForEachEnumeratorInfo enumeratorInfo, ref BoundExpression rewrittenExpression, out LocalSymbol? preambleLocal, out RefKind collectionTempRefKind); 748return static (LocalRewriter rewriter, SyntaxNode syntax, ForEachEnumeratorInfo enumeratorInfo, ref BoundExpression rewrittenExpression, out LocalSymbol? preambleLocal, out RefKind collectionTempRefKind) => 762collectionTempRefKind = enumeratorInfo.InlineArraySpanType == WellKnownType.System_Span_T ? RefKind.Ref : RefKindExtensions.StrictIn;
Lowering\LocalRewriter\LocalRewriter_IndexerAccess.cs (11)
54ImmutableArray<RefKind> refKinds) 107ImmutableArray<RefKind> argumentRefKindsOpt, 116if (isLeftOfAssignment && indexer.RefKind == RefKind.None) 273possiblyRefCapturedReceiver = _factory.StoreToTemp(possiblyRefCapturedReceiver, out var refCapture, createSpan.Parameters[0].RefKind == RefKind.In ? RefKindExtensions.StrictIn : RefKind.Ref); 448Debug.Assert(!isLeftOfAssignment || node.IndexerOrSliceAccess.GetRefKind() == RefKind.Ref); 505receiver.Type.IsReferenceType ? RefKind.None : RefKind.Ref); 570if (isLeftOfAssignment && indexerAccess.GetRefKind() == RefKind.None) 807receiver.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_NullCoalescingOperator.cs (1)
146if (unwrappedRight is { ConstantValueOpt: not null } or BoundLocal { LocalSymbol.IsRef: false } or BoundParameter { ParameterSymbol.RefKind: RefKind.None } &&
Lowering\LocalRewriter\LocalRewriter_ObjectCreationExpression.cs (2)
43ImmutableArray<RefKind> argumentRefKindsOpt = node.ArgumentRefKindsOpt; 352default(ImmutableArray<RefKind>),
Lowering\LocalRewriter\LocalRewriter_ObjectOrCollectionInitializerExpression.cs (13)
132default(ImmutableArray<RefKind>), 147.All(p => p.RefKind is RefKind.None or RefKind.In or RefKind.RefReadOnlyParameter)); 163var argumentRefKindsOpt = default(ImmutableArray<RefKind>); 164if (addMethod.Parameters[0].RefKind == RefKind.Ref) 169var builder = ArrayBuilder<RefKind>.GetInstance(addMethod.Parameters.Length, RefKind.None); 170builder[0] = RefKind.Ref; 307memberInit.MemberSymbol?.GetParameterRefKinds() ?? default(ImmutableArray<RefKind>), 589ImmutableArray<RefKind> paramRefKindsOpt, 609elementArg.rewriter.EvaluateSideEffects(element, RefKind.None, elementArg.sideeffects, ref elementArg.temps), 637private BoundExpression EvaluateSideEffects(BoundExpression arg, RefKind refKind, ArrayBuilder<BoundExpression> sideeffects, ref ArrayBuilder<LocalSymbol>? temps)
Lowering\LocalRewriter\LocalRewriter_PropertyAccess.cs (2)
52if (isLeftOfAssignment && propertySymbol.RefKind == RefKind.None) 78ImmutableArray<RefKind> argumentRefKindsOpt,
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (4)
506readOnlySpanCtorRefParamGeneric.Parameters[0].RefKind != RefKind.Out) 544Debug.Assert(readOnlySpanCtorRefParamChar.Parameters[0].RefKind != RefKind.Out); 551argumentRefKindsOpt: [readOnlySpanCtorRefParamChar.Parameters[0].RefKind == RefKind.Ref ? RefKind.Ref : RefKindExtensions.StrictIn],
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)
489return ((BoundLocal)expression).LocalSymbol.RefKind != RefKind.None; 493return ((BoundParameter)expression).ParameterSymbol.RefKind != RefKind.None;
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (7)
501Debug.Assert(method.Parameters.AsSpan()[1..].All(static (p) => (p.IsOptional || p.IsParams) && p.RefKind is RefKind.None or RefKind.In or RefKind.RefReadOnlyParameter)); 508Debug.Assert(method.ParameterRefKinds.IsDefaultOrEmpty || method.ParameterRefKinds.All(static refKind => refKind is RefKind.In or RefKind.RefReadOnlyParameter or RefKind.None)); 513ImmutableArray<RefKind> argumentRefKindsOpt = default;
Lowering\LocalRewriter\LoweredDynamicOperationFactory.cs (54)
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 RefKind GetReceiverRefKind(BoundExpression loweredReceiver) 547return RefKind.None; 555return hasHome ? RefKind.Ref : RefKind.None; 562ImmutableArray<RefKind> refKinds = default(ImmutableArray<RefKind>), 564RefKind receiverRefKind = RefKind.None, 571Debug.Assert(!receiverIsStaticType || receiverRefKind == RefKind.None); 586refKinds.IsDefault ? RefKind.None : refKinds[i], 592infos[j++] = GetArgumentInfo(argumentInfoFactory, loweredRight, NoName, RefKind.None, isStaticType: false); 601RefKind receiverRefKind, 603ImmutableArray<RefKind> refKinds, 720RefKind receiverRefKind, 722ImmutableArray<RefKind> refKinds, 736bool hasByRefs = receiverRefKind != RefKind.None || !refKinds.IsDefaultOrEmpty; 776byRefs[j++] = RefKind.None; 791static RefKind getRefKind(RefKind refKind) 793Debug.Assert(refKind != RefKind.RefReadOnlyParameter); 794return refKind == RefKind.None ? RefKind.None : RefKind.Ref; 802RefKind refKind, 817Debug.Assert(refKind == RefKind.None || refKind == RefKind.Ref || refKind == RefKind.Out, "unexpected refKind in dynamic"); 820if (refKind == RefKind.Out) 824else if (refKind == RefKind.Ref)
Lowering\MethodToClassRewriter.cs (1)
493if (leftLocal.LocalSymbol.RefKind != RefKind.None &&
Lowering\SpillSequenceSpiller.cs (42)
305RefKind refKind = RefKind.None, 317Debug.Assert(refKind == RefKind.None); 324Debug.Assert(refKind == RefKind.None); 337if (refKind != RefKind.None || expression.Type?.IsRefLikeOrAllowsRefLikeType() == true) 370var left = Spill(builder, assignment.Left, RefKind.Ref); 371var right = Spill(builder, assignment.Right, RefKind.Ref); 380if (refKind != RefKind.None || expression.Type.IsReferenceType) 388if (refKind != RefKind.None) 397if (local.LocalSymbol.SynthesizedKind == SynthesizedLocalKind.Spill || refKind != RefKind.None) 410if (refKind != RefKind.None || fieldSymbol.IsReadOnly) 417if (refKind == RefKind.None) goto default; 419var receiver = Spill(builder, field.ReceiverOpt, fieldSymbol.ContainingType.IsValueType ? refKind : RefKind.None); 437if (refKind != RefKind.None) 482if (refKind == RefKind.None && 489[Spill(builder, objectCreationExpression.Arguments[0], argRefKinds.IsDefault ? RefKind.None : argRefKinds[0])], 538Left: BoundLocal { LocalSymbol: { SynthesizedKind: SynthesizedLocalKind.LoweringTemp, RefKind: RefKind.Ref } receiverRefLocal }, 541ValueTypeReceiver: BoundLocal { LocalSymbol: { SynthesizedKind: SynthesizedLocalKind.LoweringTemp, RefKind: RefKind.Ref } } valueTypeReceiver, 550Left: BoundLocal { LocalSymbol: { SynthesizedKind: SynthesizedLocalKind.LoweringTemp, RefKind: RefKind.None } referenceTypeClone }, 551Right: BoundLocal { LocalSymbol: { SynthesizedKind: SynthesizedLocalKind.LoweringTemp, RefKind: RefKind.Ref } originalReceiverReference } 554Value: BoundLocal { LocalSymbol: { SynthesizedKind: SynthesizedLocalKind.LoweringTemp, RefKind: RefKind.None } } referenceTypeReceiver 586ImmutableArray<RefKind> refKinds = default(ImmutableArray<RefKind>), 634var refKind = refKinds.IsDefault ? RefKind.None : refKinds[i]; 892expression = Spill(leftBuilder, expression, RefKind.None); 907left = Spill(leftBuilder, VisitExpression(ref leftBuilder, left), RefKind.Ref); 939expression = Spill(leftBuilder, expression, RefKind.None); 954receiver = Spill(leftBuilder, VisitExpression(ref leftBuilder, field.ReceiverOpt), RefKind.Ref); 1032RefKind refKind = ReceiverSpillRefKind(receiver); 1034Debug.Assert(refKind == RefKind.None || !receiver.Type.IsReferenceType); 1038if (refKind != RefKind.None && 1071private static RefKind ReceiverSpillRefKind(BoundExpression receiver) 1073var result = RefKind.None; 1076result = receiver.Type.IsReadOnly ? RefKind.In : RefKind.Ref; 1265var receiverRefKind = ReceiverSpillRefKind(node.Receiver); 1286if (receiver.Type.IsReferenceType || receiver.Type.IsValueType || receiverRefKind == RefKind.None) 1289receiver = Spill(receiverBuilder, receiver, RefKind.None); 1304receiver = Spill(receiverBuilder, receiver, RefKind.Ref); 1306var clone = _F.SynthesizedLocal(receiver.Type, _F.Syntax, refKind: RefKind.None, kind: SynthesizedLocalKind.Spill);
Lowering\StateMachineRewriter\IteratorAndAsyncCaptureWalker.cs (3)
91Debug.Assert(local.RefKind != RefKind.None); 213(variable is LocalSymbol { RefKind: not RefKind.None } refLocal && !canRefLocalBeHoisted(refLocal))) 251Debug.Assert(parameter.IsThis || parameter.RefKind == RefKind.None);
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (20)
307if (local.RefKind != RefKind.None) 540var sacrificialTemp = F.SynthesizedLocal(type, refKind: RefKind.Ref); 560RefKind refKind, 570BoundExpression expression = HoistExpression(array.Expression, awaitSyntaxOpt, syntaxOffset, RefKind.None, sideEffects, hoistedFields, ref needsSacrificialEvaluation); 574indices.Add(HoistExpression(index, awaitSyntaxOpt, syntaxOffset, RefKind.None, sideEffects, hoistedFields, ref needsSacrificialEvaluation)); 587if (refKind != RefKind.None || field.FieldSymbol.IsReadOnly) return expr; 591if (refKind == RefKind.None) 599isFieldOfStruct ? refKind : RefKind.None, sideEffects, hoistedFields, ref needsSacrificialEvaluation); 621if (refKind != RefKind.None && refKind != RefKind.In) 623Debug.Assert(refKind is RefKindExtensions.StrictIn or RefKind.Ref or RefKind.Out); 624Debug.Assert(call.Method.RefKind != RefKind.None); 628refKind = RefKind.None; 639if (refKind != RefKind.None && refKind != RefKind.RefReadOnly) 641Debug.Assert(refKind is RefKindExtensions.StrictIn or RefKind.Ref or RefKind.In); 646refKind = RefKind.None; 655if (refKind != RefKind.None)
Lowering\StateMachineRewriter\StateMachineFieldSymbol.cs (2)
62public override RefKind RefKind => RefKind.None;
Lowering\StateMachineRewriter\StateMachineRewriter.cs (2)
169if (local.RefKind != RefKind.None) 177Debug.Assert(local.RefKind == RefKind.None);
Lowering\StateMachineRewriter\SynthesizedStateMachineProperty.cs (2)
41public override RefKind RefKind 43get { return RefKind.None; }
Lowering\SynthesizedMethodBaseSymbol.cs (1)
154builder.Add(SynthesizedParameterSymbol.Create(this, this.TypeMap.SubstituteType(extra), ordinal++, RefKind.Ref));
Lowering\SyntheticBoundNodeFactory.cs (25)
612Debug.Assert(CurrentFunction.RefKind == RefKind.None); 637RefKind refKind = RefKind.None, 677return SynthesizedParameterSymbol.Create(container, TypeWithAnnotations.Create(type), ordinal, RefKind.None, name); 800public BoundObjectCreationExpression New(MethodSymbol constructor, ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> argumentRefKinds) 914static ImmutableArray<RefKind> getArgumentRefKinds(MethodSymbol method, bool useStrictArgumentRefKinds) 918if (!result.IsDefaultOrEmpty && (result.Contains(RefKind.RefReadOnlyParameter) || 919(useStrictArgumentRefKinds && result.Contains(RefKind.In)))) 921var builder = ArrayBuilder<RefKind>.GetInstance(result.Length); 923foreach (var refKind in result) 927RefKind.In or RefKind.RefReadOnlyParameter when useStrictArgumentRefKinds => RefKindExtensions.StrictIn, 928RefKind.RefReadOnlyParameter => RefKind.In, 940public BoundCall Call(BoundExpression? receiver, MethodSymbol method, ImmutableArray<RefKind> refKinds, ImmutableArray<BoundExpression> args) 1689RefKind refKind = RefKind.None, 1706case RefKind.Out: 1707refKind = RefKind.Ref; 1710case RefKind.In: 1719Debug.Assert(argument.GetRefKind() != RefKind.In); 1720refKind = RefKind.None; 1724case RefKind.None: 1725case RefKind.Ref: 1756isRef: refKind != RefKind.None);
Operations\CSharpOperationFactory.cs (6)
752ImmutableArray<RefKind> argumentRefKinds = boundDynamicObjectCreationExpression.ArgumentRefKindsOpt.NullToEmpty(); 781ImmutableArray<RefKind> argumentRefKinds = boundDynamicInvocation.ArgumentRefKindsOpt.NullToEmpty(); 824ImmutableArray<RefKind> argumentRefKinds = boundDynamicIndexerAccess.ArgumentRefKindsOpt.NullToEmpty(); 863ImmutableArray<RefKind> argumentRefKinds = boundObjectInitializerMember.ArgumentRefKindsOpt.NullToEmpty(); 884MethodSymbol? accessor = isObjectOrCollectionInitializer || property.RefKind != RefKind.None 981return new DynamicInvocationOperation(operation, arguments, argumentNames: ImmutableArray<string?>.Empty, argumentRefKinds: ImmutableArray<RefKind>.Empty, _semanticModel, syntax, type, isImplicit);
SymbolDisplay\SymbolDisplayVisitor.cs (1)
254if (symbol.RefKind == RefKind.RefReadOnly)
SymbolDisplay\SymbolDisplayVisitor.Members.cs (9)
39case RefKind.Ref: 42case RefKind.RefReadOnly: 810symbol.RefKind != RefKind.Out && 831symbol.RefKind == RefKind.None && 1120private void AddParameterRefKind(RefKind refKind) 1124case RefKind.Out: 1128case RefKind.Ref: 1132case RefKind.In: 1136case RefKind.RefReadOnlyParameter:
Symbols\AnonymousTypes\AnonymousTypeField.cs (2)
23public readonly RefKind RefKind; 40RefKind refKind,
Symbols\AnonymousTypes\AnonymousTypeManager.Templates.cs (2)
259if (fields.Any(static f => f.RefKind != RefKind.None)) 463var 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]; 146var returnRefKind = returnParameter.RefKind; 207var 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)
775internal SynthesizedAttributeData? SynthesizeDynamicAttribute(TypeSymbol type, int customModifiersCount, RefKind refKindOpt = RefKind.None) 780if (type.IsDynamic() && refKindOpt == RefKind.None && customModifiersCount == 0) 889internal static ImmutableArray<TypedConstant> Encode(TypeSymbol type, RefKind refKind, int customModifiersCount, TypeSymbol booleanType) 901internal static ImmutableArray<bool> Encode(TypeSymbol type, RefKind refKind, int customModifiersCount) 908internal static ImmutableArray<bool> EncodeWithoutCustomModifierFlags(TypeSymbol type, RefKind refKind) 915internal static void Encode(TypeSymbol type, int customModifiersCount, RefKind refKind, ArrayBuilder<bool> transformFlagsBuilder, bool addCustomModifierFlags) 919if (refKind != RefKind.None) 1010void handle(RefKind refKind, ImmutableArray<CustomModifier> customModifiers, TypeWithAnnotations twa) 1017if (refKind != RefKind.None) 1172return parameter.RefKind != RefKind.None; 1177return method.RefKind != RefKind.None; 1182return 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 (48)
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) 312Debug.Assert(refKind is RefKind.None or RefKind.In or RefKind.Ref or RefKind.Out); 316RefKind.In => compilation.GetWellKnownType(WellKnownType.System_Runtime_InteropServices_InAttribute), 317RefKind.Out => compilation.GetWellKnownType(WellKnownType.System_Runtime_InteropServices_OutAttribute), 323Debug.Assert(refKind != RefKind.Out && refKind != RefKind.In); 351var returnVariance = RefKind == RefKind.None ? variance : VarianceKind.None; 366(VarianceKind.In, RefKind.None) => VarianceKind.Out, 367(VarianceKind.Out, RefKind.None) => VarianceKind.In, 443RefKind refKind, 488RefKind refKind, 493ImmutableArray<RefKind> parameterRefKinds, 496Debug.Assert(refKind != RefKind.Out); 497Debug.Assert(refCustomModifiers.IsDefaultOrEmpty || refKind != RefKind.None); 509Debug.Assert(refCustomModifiers.IsEmpty || refKind != RefKind.None); 513static ImmutableArray<CustomModifier> getCustomModifierArrayForRefKind(RefKind refKind, CSharpCompilation compilation) 519RefKind refKind, 553RefKind = getRefKind(retInfo, RefCustomModifiers, RefKind.RefReadOnly, RefKind.Ref, requiresLocationAllowed: false); 554Debug.Assert(RefKind != RefKind.Out); 569RefKind paramRefKind = getRefKind(param, paramRefCustomMods, RefKind.In, RefKind.Out, requiresLocationAllowed: true); 581static RefKind getRefKind(ParamInfo<TypeSymbol> param, ImmutableArray<CustomModifier> paramRefCustomMods, RefKind hasInRefKind, RefKind hasOutRefKind, bool requiresLocationAllowed) 585false => RefKind.None, 588true when requiresLocationAllowed && CustomModifierUtils.HasRequiresLocationAttributeModifier(paramRefCustomMods) => RefKind.RefReadOnlyParameter, 589true => RefKind.Ref, 648var modifiersToSearch = RefKind != RefKind.None ? RefCustomModifiers : ReturnTypeWithAnnotations.CustomModifiers; 671var modifiersToSearch = RefKind != RefKind.None ? RefCustomModifiers : ReturnTypeWithAnnotations.CustomModifiers; 767public override RefKind RefKind { get; }
Symbols\FunctionPointers\FunctionPointerParameterSymbol.cs (5)
16public FunctionPointerParameterSymbol(TypeWithAnnotations typeWithAnnotations, RefKind refKind, int ordinal, FunctionPointerMethodSymbol containingSymbol, ImmutableArray<CustomModifier> refCustomModifiers) 27public override RefKind RefKind { get; } 78internal override bool IsMetadataIn => RefKind is RefKind.In or RefKind.RefReadOnlyParameter; 79internal 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)
365public bool IsRef => RefKind != RefKind.None; 367public abstract RefKind RefKind
Symbols\MemberSignatureComparer.cs (14)
254/// the difference between <see cref="RefKind.Out"/> and <see cref="RefKind.Ref"/>. 559RefKind refKind1; 564RefKind refKind2; 783var refKind1 = param1.RefKind; 784var refKind2 = param2.RefKind; 796if ((refKind1 == RefKind.None) != (refKind2 == RefKind.None)) 805static bool areRefKindsCompatible(RefKindCompareMode refKindCompareMode, RefKind refKind1, RefKind refKind2) 814return (refKind1, refKind2) is (RefKind.RefReadOnlyParameter, RefKind.In) or (RefKind.In, RefKind.RefReadOnlyParameter);
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); 325RefKind refKind = fieldInfo.IsByRef ? 326moduleSymbol.Module.HasIsReadOnlyAttribute(_handle) ? RefKind.RefReadOnly : RefKind.Ref : 327RefKind.None; 377public override RefKind RefKind 636if (RefKind != RefKind.None &&
Symbols\Metadata\PE\PEMethodSymbol.cs (11)
662public override RefKind RefKind => Signature.ReturnParam.RefKind; 1127case RefKind.None: 1128case RefKind.Ref: 1129case RefKind.In: 1130case RefKind.RefReadOnlyParameter: 1149foreach (var kind in this.ParameterRefKinds) 1153case RefKind.None: 1154case RefKind.In: 1156case RefKind.Out: 1157case RefKind.Ref: 1158case RefKind.RefReadOnlyParameter:
Symbols\Metadata\PE\PEParameterSymbol.cs (20)
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) 258RefKind refKind = RefKind.None; 264refKind = isByRef ? RefKind.Ref : RefKind.None; 292refKind = RefKind.Out; 296refKind = RefKind.RefReadOnlyParameter; 300refKind = RefKind.In; 304refKind = RefKind.Ref; 333Debug.Assert(refKind != RefKind.None); 401Debug.Assert(parameter.RefKind != RefKind.RefReadOnlyParameter); 402isBad |= (parameter.RefKind == RefKind.RefReadOnly) != hasInAttributeModifier; 404else if (parameter.RefKind is RefKind.In or RefKind.RefReadOnlyParameter) 451public override RefKind RefKind 1082bool filterIsReadOnlyAttribute = this.RefKind == RefKind.In; 1083bool filterRequiresLocationAttribute = this.RefKind == RefKind.RefReadOnlyParameter;
Symbols\Metadata\PE\PEPropertySymbol.cs (8)
34private readonly RefKind _refKind; 210var isBad = (result.RefKind == RefKind.In) != result.RefCustomModifiers.HasInAttributeModifier(); 281_refKind = RefKind.RefReadOnly; 285_refKind = RefKind.Ref; 290_refKind = RefKind.None; 376if (this.RefKind != RefKind.None && _setMethod != null) 680public override RefKind RefKind 739this.RefKind == RefKind.RefReadOnly ? AttributeDescription.IsReadOnlyAttribute : default,
Symbols\MethodSymbol.cs (5)
218return this.RefKind == RefKind.Ref; 229Debug.Assert(this.RefKind != RefKind.Out); 230return this.RefKind == RefKind.RefReadOnly; 237public abstract RefKind RefKind { get; } 911internal ImmutableArray<RefKind> ParameterRefKinds
Symbols\NamedTypeSymbol.cs (3)
363if ((thisParam.RefKind == RefKind.Ref && !thisParam.Type.IsValueType) || 364(thisParam.RefKind is RefKind.In or RefKind.RefReadOnlyParameter && 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 (7)
59public abstract RefKind RefKind { get; } 160RefKind refKind; 162((refKind = RefKind) == RefKind.None || 163(refKind is RefKind.In or RefKind.RefReadOnlyParameter) || 164(refKind == RefKind.Ref && ContainingSymbol.ContainingType.IsComImport)); 452RefKind IParameterSymbolInternal.RefKind => RefKind;
Symbols\PropertySymbol.cs (4)
71public bool ReturnsByRef { get { return this.RefKind == RefKind.Ref; } } 76public bool ReturnsByRefReadonly { get { return this.RefKind == RefKind.RefReadOnly; } } 81public abstract RefKind RefKind { get; } 126internal ImmutableArray<RefKind> ParameterRefKinds
Symbols\PropertySymbolExtensions.cs (2)
73if (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)
327RefKind 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 (3)
487public override RefKind RefKind 539internal override bool IsEffectivelyReadOnly => _reducedFrom.Parameters[0].RefKind is RefKind.In or RefKind.RefReadOnlyParameter;
Symbols\RefKindExtensions.cs (14)
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: 47case RefKind.RefReadOnlyParameter:
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)
21private readonly RefKind _refKind; 28RefKind refKind) 48public 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)
68public sealed override RefKind RefKind => RefKind.None;
Symbols\Source\LambdaParameterSymbol.cs (1)
22RefKind refKind,
Symbols\Source\LambdaSymbol.cs (9)
22private RefKind _refKind; 47ImmutableArray<RefKind> parameterRefKinds, 48RefKind refKind, 145public override RefKind RefKind 159internal void SetInferredReturnType(RefKind refKind, TypeWithAnnotations inferredReturnType) 325ImmutableArray<RefKind> parameterRefKinds) 355RefKind refKind; 368refKind = RefKind.None; 374refKind = RefKind.None;
Symbols\Source\LocalFunctionSymbol.cs (4)
22private readonly RefKind _refKind; 237public override RefKind RefKind => _refKind; 261if (_refKind == RefKind.RefReadOnly) 286Debug.Assert(_refKind == RefKind.None
Symbols\Source\ParameterHelpers.cs (35)
42ParameterSyntax syntax, RefKind refKind, int ordinal, 82FunctionPointerParameterSyntax syntax, RefKind refKind, int ordinal, 92RefKind.In => CreateInModifiers(binder, diagnostics, syntax), 93RefKind.RefReadOnlyParameter => CreateRefReadonlyParameterModifiers(binder, diagnostics, syntax), 94RefKind.Out => CreateOutModifiers(binder, diagnostics, syntax), 124Func<Binder, TOwningSymbol, TypeWithAnnotations, TParameterSyntax, RefKind, int, SyntaxToken, SyntaxToken, bool, ScopedKind, BindingDiagnosticBag, TParameterSymbol> parameterCreationFunc, 144var refKind = GetModifiers(parameterSyntax.Modifiers, out SyntaxToken refnessKeyword, out SyntaxToken paramsKeyword, out SyntaxToken thisKeyword, out ScopedKind scope); 183if (!allowRefOrOut && (refKind == RefKind.Ref || refKind == RefKind.Out)) 243if (parameter.RefKind == RefKind.In) 254else if (parameter.RefKind == RefKind.RefReadOnlyParameter) 339internal static bool IsRefScopedByDefault(bool useUpdatedEscapeRules, RefKind refKind) 341return useUpdatedEscapeRules && refKind == RefKind.Out; 653RefKind refKind, 691else if (refKind != RefKind.None && 740var refKind = GetModifiers(parameterSyntax.Modifiers, out SyntaxToken refnessKeyword, out SyntaxToken paramsKeyword, out SyntaxToken thisKeyword, out _); 746if (refKind == RefKind.Ref || refKind == RefKind.Out) 855if (refKind == RefKind.RefReadOnlyParameter) 921internal static RefKind GetModifiers(SyntaxTokenList modifiers, out SyntaxToken refnessKeyword, out SyntaxToken paramsKeyword, out SyntaxToken thisKeyword, out ScopedKind scope) 923var refKind = RefKind.None; 935if (refKind == RefKind.None) 938refKind = RefKind.Out; 942if (refKind == RefKind.None) 945refKind = RefKind.Ref; 949if (refKind == RefKind.None) 952refKind = RefKind.In; 962Debug.Assert(refKind == RefKind.None); 966if (refKind == RefKind.Ref && refnessKeyword.GetNextToken() == modifier) 968refKind = RefKind.RefReadOnlyParameter; 976scope = (refKind == RefKind.None) ? ScopedKind.ScopedValue : ScopedKind.ScopedRef; 986internal static ImmutableArray<CustomModifier> ConditionallyCreateInModifiers(RefKind refKind, bool addRefReadOnlyModifier, Binder binder, BindingDiagnosticBag diagnostics, SyntaxNode syntax) 988if (addRefReadOnlyModifier && refKind is RefKind.In or RefKind.RefReadOnlyParameter)
Symbols\Source\SourceClonedParameterSymbol.cs (1)
93public override RefKind RefKind
Symbols\Source\SourceComplexParameterSymbol.cs (10)
43RefKind refKind, 881return UseUpdatedEscapeRules && (RefKind != RefKind.None || (HasParamsModifier && Type.IsRefLikeOrAllowsRefLikeType())); 906if (this.RefKind == RefKind.RefReadOnlyParameter && this.IsOptional && this.ParameterSyntax.Default is null) 1402case RefKind.Ref: 1409case RefKind.Out: 1416case RefKind.In: 1423case RefKind.RefReadOnlyParameter: 1695RefKind refKind, 1721RefKind refKind, 1737Debug.Assert(refKind != RefKind.None || _refCustomModifiers.IsEmpty);
Symbols\Source\SourceConstructorSymbol.cs (1)
93methodKind, RefKind.None, declarationModifiers, returnsVoid: true, returnsVoidIsSet: true,
Symbols\Source\SourceDelegateMethodSymbol.cs (13)
27RefKind refKind, 55returnTypeSyntax = returnTypeSyntax.SkipScoped(out _).SkipRefInLocalOrReturn(diagnostics, out RefKind refKind); 217: base(delegateType, voidType, syntax, MethodKind.Constructor, RefKind.None, DeclarationModifiers.Public) 220SynthesizedParameterSymbol.Create(this, objectType, 0, RefKind.None, "object"), 221SynthesizedParameterSymbol.Create(this, intPtrType, 1, RefKind.None, "method"))); 257RefKind refKind, 280if (this.RefKind == RefKind.RefReadOnly) 319if (this.RefKind == RefKind.RefReadOnly) 355: base((SourceNamedTypeSymbol)invoke.ContainingType, iAsyncResultType, syntax, MethodKind.Ordinary, RefKind.None, DeclarationModifiers.Virtual | DeclarationModifiers.Public) 365parameters.Add(SynthesizedParameterSymbol.Create(this, asyncCallbackType, paramCount, RefKind.None, GetUniqueParameterName(parameters, "callback"))); 366parameters.Add(SynthesizedParameterSymbol.Create(this, objectType, paramCount + 1, RefKind.None, GetUniqueParameterName(parameters, "object"))); 402if (p.RefKind != RefKind.None) 409parameters.Add(SynthesizedParameterSymbol.Create(this, iAsyncResultType, ordinal++, RefKind.None, GetUniqueParameterName(parameters, "result")));
Symbols\Source\SourceDestructorSymbol.cs (1)
68MethodKind.Destructor, RefKind.None, declarationModifiers, returnsVoid: true, returnsVoidIsSet: true,
Symbols\Source\SourceEnumConstantSymbol.cs (2)
58public sealed override RefKind RefKind => RefKind.None;
Symbols\Source\SourceEventAccessorSymbol.cs (1)
37RefKind.None,
Symbols\Source\SourceFieldSymbol.cs (1)
139if (RefKind == RefKind.RefReadOnly)
Symbols\Source\SourceLocalSymbol.cs (3)
35private readonly RefKind _refKind; 69_scope = _refKind != RefKind.None 480public override RefKind RefKind
Symbols\Source\SourceMemberContainerSymbol.cs (18)
2152var refKind1 = method1.Parameters[i].RefKind; 2153var refKind2 = method2.Parameters[i].RefKind; 3902if (methodParam.RefKind != RefKind.None) 3925methodParams[0].RefKind == RefKind.None && 4250RefKind.Out 4252RefKind.None, 4298RefKind.None 4300RefKind.None, 4347RefKind.None)), 4348RefKind.None, 4403RefKind.None, 4482RefKind.None, 4575RefKind.None, 4606RefKind.None, 4672RefKind.None 4674RefKind.None, 4873_ = fieldSyntax.Declaration.Type.SkipScoped(out _).SkipRefInField(out var refKind); 4882var modifiers = SourceMemberFieldSymbol.MakeModifiers(this, fieldSyntax.Declaration.Variables[0].Identifier, fieldSyntax.Modifiers, isRefField: refKind != RefKind.None, diagnostics, out modifierErrors);
Symbols\Source\SourceMemberContainerSymbol_ImplementationChecks.cs (15)
1278overrideMethod.RefKind == RefKind.Ref ? RefKind.Ref : RefKind.Out, 1344RefKind refKind, 1350case RefKind.Ref: 1356case RefKind.Out: 1391(method.RefKind is RefKind.Ref or RefKind.RefReadOnly)) 1395else if (parameters.Any(p => (p.RefKind is RefKind.Ref or RefKind.Out) && p.Type.IsRefLikeOrAllowsRefLikeType())) 1406int nRefParameters = parameters.Count(p => p.RefKind is RefKind.Ref or RefKind.In or RefKind.RefReadOnlyParameter or RefKind.Out); 1411else if (parameters.Any(p => p.RefKind == RefKind.None && p.Type.IsRefLikeOrAllowsRefLikeType()))
Symbols\Source\SourceMemberFieldSymbol.cs (13)
326internal readonly RefKind RefKind; 329internal TypeAndRefKind(RefKind refKind, TypeWithAnnotations type) 421public sealed override RefKind RefKind => GetTypeAndRefKind(ConsList<FieldSymbol>.Empty).RefKind; 451RefKind refKind = RefKind.None; 489Debug.Assert(refKind is RefKind.None or RefKind.Ref or RefKind.RefReadOnly); 491if (refKind != RefKind.None) 507type = binder.BindTypeOrVarKeyword(typeSyntax.SkipScoped(out _).SkipRefInField(out RefKind refKindToAssert), diagnostics, out isVar); 508Debug.Assert(refKindToAssert == RefKind.None); // Otherwise we might need to report an error 539var initializerOpt = executableBinder.BindInferredVariableInitializer(diagnostics, RefKind.None, syntaxNode, declarator); 568if (refKind != RefKind.None)
Symbols\Source\SourceMemberMethodSymbol.cs (7)
126public RefKind RefKind 128get { return (RefKind)((_flags >> RefKindOffset) & RefKindMask); } 169Debug.Assert(EnumUtilities.ContainsAllValues<RefKind>(RefKindMask)); 181RefKind refKind, 224RefKind refKind, 395RefKind refKind, 1127public sealed override RefKind RefKind => this.flags.RefKind;
Symbols\Source\SourceMethodSymbol.cs (1)
65if (parameter.RefKind != RefKind.None)
Symbols\Source\SourceMethodSymbolWithAttributes.cs (4)
764if (param.RefKind == RefKind.Out) 1399static void checkAndReportManagedTypes(TypeSymbol type, RefKind refKind, SyntaxNode syntax, bool isParam, BindingDiagnosticBag diagnostics) 1401if (refKind != RefKind.None) 1524if (this.RefKind != RefKind.None)
Symbols\Source\SourceOrdinaryMethodOrUserDefinedOperatorSymbol.cs (2)
118else if (RefKind == RefKind.RefReadOnly) 242if (RefKind == RefKind.RefReadOnly)
Symbols\Source\SourceOrdinaryMethodSymbol.cs (6)
153Debug.Assert(this.RefKind == RefKind.None || !returnType.IsVoidType() || returnTypeSyntax.HasErrors); 209var parameter0RefKind = this.Parameters[0].RefKind; 218else if (parameter0RefKind == RefKind.Ref && !parameter0Type.Type.IsValueType) 222else if (parameter0RefKind is RefKind.In or RefKind.RefReadOnlyParameter && parameter0Type.TypeKind != TypeKind.Struct) 819else if (IsPartial && !HasExplicitAccessModifier && Parameters.Any(static p => p.RefKind == RefKind.Out))
Symbols\Source\SourceParameterSymbol.cs (7)
26private readonly RefKind _refKind; 35RefKind refKind, 105RefKind refKind, 215public sealed override RefKind RefKind 295internal override bool IsMetadataIn => RefKind is RefKind.In or RefKind.RefReadOnlyParameter; 297internal override bool IsMetadataOut => RefKind == RefKind.Out;
Symbols\Source\SourceParameterSymbolBase.cs (2)
118case RefKind.In: 121case RefKind.RefReadOnlyParameter:
Symbols\Source\SourcePropertySymbolBase.cs (10)
56private readonly RefKind _refKind; 90RefKind refKind, 233_lazyRefCustomModifiers = _refKind != RefKind.None ? overriddenOrImplementedProperty.RefCustomModifiers : ImmutableArray<CustomModifier>.Empty; 252else if (_refKind == RefKind.RefReadOnly) 299public sealed override RefKind RefKind 697if (RefKind != RefKind.None && IsRequired) 723if (this.RefKind != RefKind.None) 745if (_refKind != RefKind.None) 772else if (RefKind != RefKind.None) 841if (_refKind == RefKind.RefReadOnly)
Symbols\Source\SourceSimpleParameterSymbol.cs (2)
24RefKind refKind, 36RefKind refKind,
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (3)
39methodKind, RefKind.None, declarationModifiers, 334if (p.RefKind != RefKind.None && p.RefKind != RefKind.In)
Symbols\Source\ThisParameterSymbol.cs (5)
143public override RefKind RefKind 149return RefKind.None; 154return RefKind.Out; 159return RefKind.In; 162return RefKind.Ref;
Symbols\SubstitutedFieldSymbol.cs (1)
106public override RefKind RefKind => _underlyingField.RefKind;
Symbols\SymbolExtensions.cs (4)
487internal static void GetTypeOrReturnType(this Symbol symbol, out RefKind refKind, out TypeWithAnnotations returnType, 494refKind = RefKind.None; 512refKind = RefKind.None; 529refKind = RefKind.None;
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListConstructor.cs (1)
15SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(parameterType), ordinal: 0, RefKind.None, parameterName));
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListEnumeratorConstructor.cs (1)
15SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(parameterType), ordinal: 0, RefKind.None, "item"));
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListProperty.cs (2)
33public override RefKind RefKind => RefKind.None;
Symbols\Synthesized\Records\SynthesizedPrimaryConstructor.cs (1)
43RefKind.None,
Symbols\Synthesized\Records\SynthesizedPrimaryConstructorParameterBackingFieldSymbol.cs (2)
45public override RefKind RefKind => RefKind.None;
Symbols\Synthesized\Records\SynthesizedRecordBaseEquals.cs (1)
33ordinal: 0, RefKind.None, "other", Locations)));
Symbols\Synthesized\Records\SynthesizedRecordClone.cs (1)
124if (ctor.ParameterCount == 1 && ctor.Parameters[0].RefKind == RefKind.None &&
Symbols\Synthesized\Records\SynthesizedRecordCopyCtor.cs (2)
30RefKind.None, 148method.Parameters[0].RefKind == RefKind.None;
Symbols\Synthesized\Records\SynthesizedRecordDeconstruct.cs (1)
41RefKind.Out,
Symbols\Synthesized\Records\SynthesizedRecordEqualityContractProperty.cs (1)
39RefKind.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, "left", Locations), 76ordinal: 1, RefKind.None, "right", Locations)));
Symbols\Synthesized\Records\SynthesizedRecordEquals.cs (1)
41ordinal: 0, RefKind.None, "other", Locations)));
Symbols\Synthesized\Records\SynthesizedRecordObjEquals.cs (1)
36ordinal: 0, RefKind.None, "obj", Locations)));
Symbols\Synthesized\Records\SynthesizedRecordOrdinaryMethod.cs (1)
27MethodKind.Ordinary, RefKind.None, declarationModifiers, returnsVoid: false, returnsVoidIsSet: false,
Symbols\Synthesized\Records\SynthesizedRecordPrintMembers.cs (1)
98ordinal: 0, RefKind.None, "builder", Locations)));
Symbols\Synthesized\Records\SynthesizedRecordPropertySymbol.cs (1)
37RefKind.None,
Symbols\Synthesized\RefKindVector.cs (11)
39internal RefKind this[int index] 46(false, false, false) => RefKind.None, 47(false, false, true) => RefKind.Ref, 48(false, true, false) => RefKind.Out, 49(false, true, true) => RefKind.RefReadOnly, 50(true, false, false) => RefKind.RefReadOnlyParameter, 59RefKind.None => (false, false, false), 60RefKind.Ref => (false, false, true), 61RefKind.Out => (false, true, false), 62RefKind.RefReadOnly => (false, true, true), 63RefKind.RefReadOnlyParameter => (true, false, false),
Symbols\Synthesized\SynthesizedAccessorValueParameterSymbol.cs (1)
23: base(accessor, ordinal, RefKind.None, ParameterSymbol.ValueParameterName, accessor.TryGetFirstLocation(),
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; } 300default(ImmutableArray<RefKind>), 363argumentRefKindsOpt: default(ImmutableArray<RefKind>), 411refKind: RefKind.None, 429refKind: RefKind.None, 522RefKind.None, 541TypeWithAnnotations.Create(submissionArrayType), 0, RefKind.None, "submissionArray")); 592argumentRefKindsOpt: default(ImmutableArray<RefKind>), 613RefKind.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)
204public override RefKind RefKind 206get { return RefKind.None; }
Symbols\Synthesized\SynthesizedImplementationMethod.cs (1)
96public sealed override RefKind RefKind
Symbols\Synthesized\SynthesizedInlineArrayAsReadOnlySpanMethod.cs (2)
17this.SetParameters(ImmutableArray.Create<ParameterSymbol>(SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(TypeParameters[0]), 0, RefKind.In, "buffer"), 18SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(intType), 1, RefKind.None, "length")));
Symbols\Synthesized\SynthesizedInlineArrayAsSpanMethod.cs (2)
17this.SetParameters(ImmutableArray.Create<ParameterSymbol>(SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(TypeParameters[0]), 0, RefKind.Ref, "buffer"), 18SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(intType), 1, RefKind.None, "length")));
Symbols\Synthesized\SynthesizedInlineArrayElementRefMethod.cs (4)
17this.SetParameters(ImmutableArray.Create<ParameterSymbol>(SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(TypeParameters[0]), 0, RefKind.Ref, "buffer"), 18SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(intType), 1, RefKind.None, "index"))); 21public override RefKind RefKind => RefKind.Ref;
Symbols\Synthesized\SynthesizedInlineArrayElementRefReadOnlyMethod.cs (4)
17this.SetParameters(ImmutableArray.Create<ParameterSymbol>(SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(TypeParameters[0]), 0, RefKind.In, "buffer"), 18SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(intType), 1, RefKind.None, "index"))); 21public override RefKind RefKind => RefKind.RefReadOnly;
Symbols\Synthesized\SynthesizedInlineArrayFirstElementRefMethod.cs (3)
17this.SetParameters(ImmutableArray.Create<ParameterSymbol>(SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(TypeParameters[0]), 0, RefKind.Ref, "buffer"))); 20public override RefKind RefKind => RefKind.Ref;
Symbols\Synthesized\SynthesizedInlineArrayFirstElementRefReadOnlyMethod.cs (3)
17this.SetParameters(ImmutableArray.Create<ParameterSymbol>(SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(TypeParameters[0]), 0, RefKind.In, "buffer"))); 20public override RefKind RefKind => RefKind.RefReadOnly;
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 (6)
216public override RefKind RefKind 220return RefKind.None; 468) : base(container, TypeWithAnnotations.Create(type), ordinal, RefKind.None, ScopedKind.None, name) 472internal override bool IsMetadataIn => RefKind is RefKind.In or RefKind.RefReadOnlyParameter; 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 (14)
22private readonly RefKind _refKind; 29RefKind refKind, 47public override RefKind RefKind => _refKind; 186case RefKind.In: 189case RefKind.RefReadOnlyParameter: 244RefKind refKind, 251internal sealed override bool IsMetadataIn => RefKind is RefKind.In or RefKind.RefReadOnlyParameter; 253internal sealed override bool IsMetadataOut => RefKind == RefKind.Out; 259RefKind refKind, 348RefKind refKind, 406internal override bool IsMetadataIn => RefKind is RefKind.In or RefKind.RefReadOnlyParameter || _baseParameterForAttributes?.GetDecodedWellKnownAttributeData()?.HasInAttribute == true; 408internal override bool IsMetadataOut => RefKind == RefKind.Out || _baseParameterForAttributes?.GetDecodedWellKnownAttributeData()?.HasOutAttribute == true;
Symbols\Synthesized\SynthesizedSealedPropertyAccessor.cs (1)
181public override RefKind RefKind
Symbols\Synthesized\SynthesizedSimpleProgramEntryPointSymbol.cs (2)
59TypeWithAnnotations.Create(Binder.GetSpecialType(compilation, SpecialType.System_String, NoLocation.Singleton, diagnostics)))), 0, RefKind.None, "args")); 73RefKind.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\SynthesizedThrowSwitchExpressionExceptionMethod.cs (1)
19this.SetParameters(ImmutableArray.Create(SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(paramType), 0, RefKind.None, "unmatchedValue")));
Symbols\Synthesized\TypeSubstitutedLocalSymbol.cs (1)
105public override RefKind RefKind
Symbols\Tuples\TupleErrorFieldSymbol.cs (2)
157public override RefKind RefKind => RefKind.None;
Symbols\Tuples\TupleFieldSymbol.cs (1)
125public sealed override RefKind RefKind => _underlyingField.RefKind;
Symbols\TypeSymbol.cs (3)
2002RefKind interfaceMemberRefKind = RefKind.None; 2554return elementField is { RefKind: RefKind.None, IsFixedSizeBuffer: false };
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; 330refKind = RefKind.Ref;
Microsoft.CodeAnalysis.CSharp.CodeStyle (14)
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (2)
318if (primaryConstructor.Parameters.Any(static p => p.RefKind is RefKind.Ref or RefKind.Out))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\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)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
379ReducedFrom.Parameters: [{ RefKind: RefKind.Ref }, ..],
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
592public RefKind GetRefKindOfArgument(SyntaxNode node)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (3)
669if (castedSymbol is not IFieldSymbol and not ILocalSymbol and not IParameterSymbol and not IParameterSymbol { RefKind: RefKind.Ref }) 1351if (operation is IPropertyReferenceOperation { Property.RefKind: not RefKind.Ref }) 1355if (operation is IInvocationOperation { TargetMethod.RefKind: not RefKind.Ref })
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (21)
src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AbstractAssignOutParametersCodeFixProvider.cs (1)
115.Where(p => p.RefKind == RefKind.Out)
src\Analyzers\CSharp\CodeFixes\GenerateConstructor\CSharpGenerateConstructorService.cs (1)
77refKind: RefKind.None,
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateConversionService.cs (1)
210refKind: RefKind.None,
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateDeconstructMethodService.cs (2)
53refKind: RefKind.Out, 65attributes: default, RefKind.Out, isParams: false, element.Type, element.Name));
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateParameterizedMemberService.cs (4)
38protected override RefKind DetermineRefKind(CancellationToken cancellationToken) 39=> _invocationExpression.IsParentKind(SyntaxKind.RefExpression) ? RefKind.Ref : RefKind.None; 128protected override ImmutableArray<RefKind> DetermineParameterModifiers(CancellationToken cancellationToken)
src\Analyzers\CSharp\CodeFixes\ImplementInterface\CSharpImplementInterfaceService.cs (1)
101g.Argument(DisposingName, RefKind.None, g.FalseLiteralExpression()))));
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (1)
216refKind: RefKind.None,
src\Analyzers\CSharp\CodeFixes\RemoveInKeyword\RemoveInKeywordCodeFixProvider.cs (1)
43if (argumentSyntax == null || argumentSyntax.GetRefKind() != RefKind.In)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (7)
135internal static SyntaxTokenList GetParameterModifiers(RefKind refKind, bool forFunctionPointerReturnParameter = false) 138RefKind.None => [], 139RefKind.Out => [OutKeyword], 140RefKind.Ref => [RefKeyword], 144RefKind.In when !forFunctionPointerReturnParameter => [InKeyword], 145RefKind.RefReadOnly when forFunctionPointerReturnParameter => [RefKeyword, ReadOnlyKeyword], 146RefKind.RefReadOnlyParameter => [RefKeyword, ReadOnlyKeyword],
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (2)
715return InferTypeInArgument(index, parameterizedSymbols, name, RefKind.None); 757RefKind refKind)
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (148)
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())); 7674returnRefKind: RefKind.None, parameterTypes: ImmutableArray<TypeWithAnnotations>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, 7678parameterRefCustomModifiers: default, returnRefKind: RefKind.Ref, parameterTypes: ImmutableArray<TypeWithAnnotations>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, 7683parameterRefCustomModifiers: default, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<TypeWithAnnotations>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, 7687parameterRefCustomModifiers: default, returnRefKind: RefKind.Ref, parameterTypes: ImmutableArray<TypeWithAnnotations>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, 7759returnRefKind: RefKind.None, parameterTypes: ImmutableArray<TypeWithAnnotations>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, 7763returnRefKind: RefKind.Ref, parameterTypes: ImmutableArray<TypeWithAnnotations>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, 7768returnRefKind: RefKind.None, parameterTypes: ImmutableArray<TypeWithAnnotations>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, 7772returnRefKind: 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)
606Assert.Equal(RefKind.Ref, parameter.RefKind); 662Assert.Equal(RefKind.Ref, baseParameter.RefKind); 670Assert.Equal(RefKind.Ref, derivedParameter.RefKind);
Emit\EmitMetadataTests.cs (5)
448Assert.Equal(RefKind.Ref, parameter1.RefKind); 2026Assert.Equal(RefKind.None, m.Parameters[0].RefKind); 2027Assert.Equal(RefKind.Ref, m.Parameters[1].RefKind); 2028Assert.Equal(RefKind.Out, m.Parameters[2].RefKind); 2092if (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);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (59)
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);
RefReadonlyParameterTests.cs (13)
64Assert.Equal(refKind, RefKind.RefReadOnlyParameter == parameter.RefKind); 483Assert.Equal(RefKind.Ref, m.RefKind); 978Assert.Equal(RefKind.In, p.RefKind); 1075Assert.Equal(RefKind.Ref, p.RefKind); 1127Assert.Equal(RefKind.In, p.RefKind); 1229Assert.Equal(RefKind.Ref, p.RefKind); 1669Assert.Equal(RefKind.Ref, p.RefKind); 1688Assert.Equal(RefKind.In, p.RefKind); 7081"ref" => RefKind.Ref, 7082"in" => RefKind.In, 7134Assert.Equal(RefKind.RefReadOnlyParameter, methodFromCref!.Parameters.Single().RefKind); 7135var methodFromClass = comp.GetMembers("C.M").Cast<MethodSymbol>().Single(m => m.Parameters.Single().RefKind == RefKind.RefReadOnlyParameter); 7178Assert.Equal(RefKind.Ref, parameter.RefKind);
Semantics\RecordTests.cs (2)
14121Assert.Equal(RefKind.Out, deconstruct.Parameters[0].RefKind); 14124Assert.Equal(RefKind.Out, deconstruct.Parameters[1].RefKind);
Microsoft.CodeAnalysis.CSharp.Features (38)
CodeRefactorings\ConvertLocalFunctionToMethod\CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs (2)
92refKind: dataFlow.WrittenInside.Contains(capture) ? RefKind.Ref : RefKind.None,
Completion\CompletionProviders\CrefCompletionProvider.cs (4)
313RefKind.Ref => "ref ", 314RefKind.Out => "out ", 315RefKind.In => "in ", 316RefKind.RefReadOnlyParameter => "ref readonly ",
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)
35if (context.Parameter.RefKind != RefKind.Out)
ConvertLinq\CSharpConvertLinqQueryToForEachProvider.cs (2)
305methodSymbol.RefKind == RefKind.None) 342methodSymbol.RefKind == RefKind.None &&
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (2)
105refKind: AnalyzerResult.ReturnsByRef ? RefKind.Ref : RefKind.None,
GenerateType\CSharpGenerateTypeService.cs (1)
821refKind: RefKind.None,
InitializeParameter\CSharpInitializeMemberFromPrimaryConstructorParameterCodeRefactoringProvider.cs (1)
254RefKind.None,
SignatureHelp\LightweightOverloadResolution.cs (4)
112var parameterRefKind = parameter.RefKind; 113if (parameterRefKind == RefKind.None) 139if (parameterRefKind == RefKind.In && argumentRefKind == RefKind.None)
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (2)
318if (primaryConstructor.Parameters.Any(static p => p.RefKind is RefKind.Ref or RefKind.Out))
src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AbstractAssignOutParametersCodeFixProvider.cs (1)
115.Where(p => p.RefKind == RefKind.Out)
src\Analyzers\CSharp\CodeFixes\GenerateConstructor\CSharpGenerateConstructorService.cs (1)
77refKind: RefKind.None,
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateConversionService.cs (1)
210refKind: RefKind.None,
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateDeconstructMethodService.cs (2)
53refKind: RefKind.Out, 65attributes: default, RefKind.Out, isParams: false, element.Type, element.Name));
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateParameterizedMemberService.cs (4)
38protected override RefKind DetermineRefKind(CancellationToken cancellationToken) 39=> _invocationExpression.IsParentKind(SyntaxKind.RefExpression) ? RefKind.Ref : RefKind.None; 128protected override ImmutableArray<RefKind> DetermineParameterModifiers(CancellationToken cancellationToken)
src\Analyzers\CSharp\CodeFixes\ImplementInterface\CSharpImplementInterfaceService.cs (1)
101g.Argument(DisposingName, RefKind.None, g.FalseLiteralExpression()))));
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (1)
216refKind: RefKind.None,
src\Analyzers\CSharp\CodeFixes\RemoveInKeyword\RemoveInKeywordCodeFixProvider.cs (1)
43if (argumentSyntax == null || argumentSyntax.GetRefKind() != RefKind.In)
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 (347)
Semantics\FunctionPointerTests.cs (2)
3942(RefKind.None, IsVoidType()), 3943(RefKind.None, IsErrorType()));
Semantics\LambdaTests.cs (5)
6905Assert.Equal(RefKind.Ref, lambdas[0].Parameters[0].RefKind); 6906Assert.Equal(RefKind.In, lambdas[1].Parameters[0].RefKind); 6907Assert.Equal(RefKind.Out, lambdas[2].Parameters[0].RefKind); 7119Assert.Equal(RefKind.None, lambdaParameter1.RefKind); 7124Assert.Equal(RefKind.None, lambdaParameter2.RefKind);
Semantics\RecordStructTests.cs (2)
3441Assert.Equal(RefKind.Out, deconstruct.Parameters[0].RefKind); 3444Assert.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)
147VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F1"), "ref T S<T>.F1", RefKind.Ref, new string[0]); 148VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F2"), "ref readonly T S<T>.F2", RefKind.RefReadOnly, new string[0]); 153VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F1"), "ref T S<T>.F1", RefKind.Ref, new string[0]); 154VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F2"), "ref readonly T S<T>.F2", RefKind.RefReadOnly, new string[0]); 173VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F"), "ref T S<T>.F", RefKind.Ref, new string[0]); 178VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F"), "ref T S<T>.F", RefKind.Ref, new string[0]); 209VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F"), "ref T S<T>.F", RefKind.Ref, new string[0]); 219VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F"), "ref T S<T>.F", RefKind.Ref, new string[0]); 242VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F"), "ref readonly T S<T>.F", RefKind.RefReadOnly, new string[0]); 247VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F"), "ref readonly T S<T>.F", RefKind.RefReadOnly, new string[0]); 283VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F"), "ref readonly T S<T>.F", RefKind.RefReadOnly, new string[0]); 293VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F"), "ref readonly T S<T>.F", RefKind.RefReadOnly, new string[0]); 317VerifyFieldSymbol(field, "ref modopt(System.SByte) modopt(System.Object) System.Int32 A<System.Int32>.F", RefKind.Ref, new[] { "System.SByte", "System.Object" }); 345VerifyFieldSymbol(field, "ref readonly System.Int32 A.F", RefKind.RefReadOnly, new string[0]); 510VerifyFieldSymbol(tupleType.GetField("Item1"), "ref System.Int32 (System.Int32, System.Object).Item1", RefKind.Ref, new string[0] { }); 511VerifyFieldSymbol(tupleType.GetField("Item2"), "ref modopt(System.Object) modopt(System.SByte) System.Object (System.Int32, System.Object).Item2", RefKind.Ref, new[] { "System.Object", "System.SByte" }); 2105private static void VerifyFieldSymbol(FieldSymbol field, string expectedDisplayString, RefKind expectedRefKind, string[] expectedRefCustomModifiers) 10487VerifyParameterSymbol(parameters[0], "R x1", RefKind.None, ScopedKind.None); 10488VerifyParameterSymbol(parameters[1], "scoped R y1", RefKind.None, ScopedKind.ScopedValue); 10491VerifyParameterSymbol(parameters[0], "ref R x2", RefKind.Ref, ScopedKind.None); 10492VerifyParameterSymbol(parameters[1], "scoped ref R y2", RefKind.Ref, ScopedKind.ScopedRef); 10495VerifyParameterSymbol(parameters[0], "in R x3", RefKind.In, ScopedKind.None); 10496VerifyParameterSymbol(parameters[1], "scoped in R y3", RefKind.In, ScopedKind.ScopedRef); 10499VerifyParameterSymbol(parameters[0], "out R x4", RefKind.Out, useUpdatedEscapeRules ? ScopedKind.ScopedRef : ScopedKind.None); 10500VerifyParameterSymbol(parameters[1], "out R y4", RefKind.Out, ScopedKind.ScopedRef); 10536VerifyParameterSymbol(comp.GetMember<NamedTypeSymbol>("A").Constructors.Single(c => !c.IsImplicitlyDeclared).Parameters[0], "scoped ref T t", RefKind.Ref, ScopedKind.ScopedRef); 10537VerifyParameterSymbol(comp.GetMember<PropertySymbol>("A.this[]").GetMethod.Parameters[0], "scoped in System.Object o", RefKind.In, ScopedKind.ScopedRef); 10596VerifyParameterSymbol(localFunctions[0].Parameters[0], "R x1", RefKind.None, ScopedKind.None); 10597VerifyParameterSymbol(localFunctions[0].Parameters[1], "scoped R y1", RefKind.None, ScopedKind.ScopedValue); 10598VerifyParameterSymbol(localFunctions[1].Parameters[0], "ref System.Int32 x2", RefKind.Ref, ScopedKind.None); 10599VerifyParameterSymbol(localFunctions[1].Parameters[1], "scoped ref System.Int32 y2", RefKind.Ref, ScopedKind.ScopedRef); 10600VerifyParameterSymbol(localFunctions[2].Parameters[0], "in System.Int32 x3", RefKind.In, ScopedKind.None); 10601VerifyParameterSymbol(localFunctions[2].Parameters[1], "scoped in System.Int32 y3", RefKind.In, ScopedKind.ScopedRef); 10602VerifyParameterSymbol(localFunctions[3].Parameters[0], "out System.Int32 x4", RefKind.Out, useUpdatedEscapeRules ? ScopedKind.ScopedRef : ScopedKind.None); 10603VerifyParameterSymbol(localFunctions[3].Parameters[1], "out System.Int32 y4", RefKind.Out, ScopedKind.ScopedRef); 10604VerifyParameterSymbol(localFunctions[4].Parameters[0], "ref R x5", RefKind.Ref, ScopedKind.None); 10605VerifyParameterSymbol(localFunctions[4].Parameters[1], "scoped ref R y5", RefKind.Ref, ScopedKind.ScopedRef); 10606VerifyParameterSymbol(localFunctions[5].Parameters[0], "in R x6", RefKind.In, ScopedKind.None); 10607VerifyParameterSymbol(localFunctions[5].Parameters[1], "scoped in R y6", RefKind.In, ScopedKind.ScopedRef); 10608VerifyParameterSymbol(localFunctions[6].Parameters[0], "out R x7", RefKind.Out, useUpdatedEscapeRules ? ScopedKind.ScopedRef : ScopedKind.None); 10609VerifyParameterSymbol(localFunctions[6].Parameters[1], "out R y7", RefKind.Out, ScopedKind.ScopedRef); 10669verifyParameter(delegateTypesAndLambdas[0], 0, "R", "x1", RefKind.None, ScopedKind.None, false); 10670verifyParameter(delegateTypesAndLambdas[0], 1, "scoped R", "y1", RefKind.None, ScopedKind.ScopedValue, false); 10671verifyParameter(delegateTypesAndLambdas[1], 0, "ref System.Int32", "x2", RefKind.Ref, ScopedKind.None, false); 10672verifyParameter(delegateTypesAndLambdas[1], 1, "scoped ref System.Int32", "y2", RefKind.Ref, ScopedKind.ScopedRef, false); 10673verifyParameter(delegateTypesAndLambdas[2], 0, "in System.Int32", "x3", RefKind.In, ScopedKind.None, false); 10674verifyParameter(delegateTypesAndLambdas[2], 1, "scoped in System.Int32", "y3", RefKind.In, ScopedKind.ScopedRef, false); 10675verifyParameter(delegateTypesAndLambdas[3], 0, "out System.Int32", "x4", RefKind.Out, useUpdatedEscapeRules ? ScopedKind.ScopedRef : ScopedKind.None, false); 10676verifyParameter(delegateTypesAndLambdas[3], 1, "out System.Int32", "y4", RefKind.Out, ScopedKind.ScopedRef, false); 10677verifyParameter(delegateTypesAndLambdas[3], 2, "out System.Int32", "z4", RefKind.Out, ScopedKind.None, true); 10678verifyParameter(delegateTypesAndLambdas[4], 0, "ref R", "x5", RefKind.Ref, ScopedKind.None, false); 10679verifyParameter(delegateTypesAndLambdas[4], 1, "scoped ref R", "y5", RefKind.Ref, ScopedKind.ScopedRef, false); 10680verifyParameter(delegateTypesAndLambdas[5], 0, "in R", "x6", RefKind.In, ScopedKind.None, false); 10681verifyParameter(delegateTypesAndLambdas[5], 1, "scoped in R", "y6", RefKind.In, ScopedKind.ScopedRef, false); 10682verifyParameter(delegateTypesAndLambdas[6], 0, "out R", "x7", RefKind.Out, useUpdatedEscapeRules ? ScopedKind.ScopedRef : ScopedKind.None, false); 10683verifyParameter(delegateTypesAndLambdas[6], 1, "out R", "y7", RefKind.Out, ScopedKind.ScopedRef, false); 10686static void verifyParameter((NamedTypeSymbol, LambdaSymbol) delegateTypeAndLambda, int parameterIndex, string expectedDisplayType, string expectedDisplayName, RefKind expectedRefKind, ScopedKind expectedScope, bool expectedHasUnscopedRefAttribute) 10726VerifyParameterSymbol(comp.GetMember<NamedTypeSymbol>("D1").DelegateInvokeMethod.Parameters[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 10727VerifyParameterSymbol(comp.GetMember<NamedTypeSymbol>("D2").DelegateInvokeMethod.Parameters[0], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 10792VerifyParameterSymbol(methods[0].Parameters[0], "R", RefKind.None, ScopedKind.None); 10793VerifyParameterSymbol(methods[1].Parameters[0], "ref R", RefKind.Ref, ScopedKind.None); 10794VerifyParameterSymbol(methods[1].Parameters[1], "ref System.Int32", RefKind.Ref, ScopedKind.None); 10795VerifyParameterSymbol(methods[2].Parameters[0], "ref R", RefKind.Ref, ScopedKind.None); 10814VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F0").Parameters[0], "scoped R r", RefKind.None, ScopedKind.ScopedValue); 10815VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F3").Parameters[0], "scoped ref R r", RefKind.Ref, ScopedKind.ScopedRef); 10816VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F6").Parameters[0], "scoped in R r", RefKind.In, ScopedKind.ScopedRef); 10817VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F9").Parameters[0], "out R r", RefKind.Out, ScopedKind.ScopedRef); 10923VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F0").Parameters[0], "scoped s", RefKind.None, ScopedKind.None); 10924VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F1").Parameters[0], "scoped scoped s", RefKind.None, ScopedKind.ScopedValue); 10925VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F2").Parameters[0], "ref scoped s", RefKind.Ref, ScopedKind.None); 10926VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F4").Parameters[0], "scoped ref scoped s", RefKind.Ref, ScopedKind.ScopedRef); 10927VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F5").Parameters[0], "in scoped s", RefKind.In, ScopedKind.None); 10928VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F7").Parameters[0], "scoped in scoped s", RefKind.In, ScopedKind.ScopedRef); 10929VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F8").Parameters[0], "out scoped s", RefKind.Out, ScopedKind.ScopedRef); 10930VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.FA").Parameters[0], "out scoped s", RefKind.Out, ScopedKind.ScopedRef); 10959VerifyParameterSymbol(lambdas[0].Parameters[0], "R r1", RefKind.None, ScopedKind.None); 10960VerifyParameterSymbol(lambdas[1].Parameters[0], "R r2", RefKind.None, ScopedKind.None); 11005VerifyParameterSymbol(comp.GetMember<PEMethodSymbol>("A.F1").Parameters[0], "out System.Int32 i", RefKind.Out, ScopedKind.ScopedRef); 11039VerifyParameterSymbol(parameters[0], "R a", RefKind.None, ScopedKind.None); 11040VerifyParameterSymbol(parameters[1], "ref R b", RefKind.Ref, ScopedKind.None); 11041VerifyParameterSymbol(parameters[2], "in R c", RefKind.In, ScopedKind.None); 11042VerifyParameterSymbol(parameters[3], "out R d", RefKind.Out, ScopedKind.ScopedRef); 11076VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.ReturnRef").Parameters[0], "scoped ref R r", RefKind.Ref, ScopedKind.ScopedRef); 11117VerifyParameterSymbol(comp.GetMember<MethodSymbol>("C..ctor").ThisParameter, "C this", RefKind.None, ScopedKind.None); 11118VerifyParameterSymbol(comp.GetMember<MethodSymbol>("C.F1").ThisParameter, "C this", RefKind.None, ScopedKind.None); 11119VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1..ctor").ThisParameter, "out S1 this", RefKind.Out, ScopedKind.ScopedRef); 11120VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F1").ThisParameter, "ref S1 this", RefKind.Ref, ScopedKind.ScopedRef); 11121VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F2").ThisParameter, "in S1 this", RefKind.In, ScopedKind.ScopedRef); 11122VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R1..ctor").ThisParameter, "out R1 this", RefKind.Out, ScopedKind.ScopedRef); 11123VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R1.F1").ThisParameter, "ref R1 this", RefKind.Ref, ScopedKind.ScopedRef); 11124VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R1.F2").ThisParameter, "in R1 this", RefKind.In, ScopedKind.ScopedRef); 11125VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2..ctor").ThisParameter, "out S2 this", RefKind.Out, ScopedKind.ScopedRef); 11126VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F1").ThisParameter, "in S2 this", RefKind.In, ScopedKind.ScopedRef); 11127VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F2").ThisParameter, "in S2 this", RefKind.In, ScopedKind.ScopedRef); 11128VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R2..ctor").ThisParameter, "out R2 this", RefKind.Out, ScopedKind.ScopedRef); 11129VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R2.F1").ThisParameter, "in R2 this", RefKind.In, ScopedKind.ScopedRef); 11130VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R2.F2").ThisParameter, "in R2 this", RefKind.In, ScopedKind.ScopedRef); 11134VerifyParameterSymbol(thisParameter, "ref S1 this", RefKind.Ref, ScopedKind.ScopedRef); 11170VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Extensions.F0").Parameters[0], "R<System.Object> r", RefKind.None, ScopedKind.None); 11171VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Extensions.F1").Parameters[0], "scoped R<System.Object> r", RefKind.None, ScopedKind.ScopedValue); 11172VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Extensions.F2").Parameters[0], "scoped", RefKind.None, ScopedKind.None); 11173VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Extensions.F3").Parameters[0], "scoped ref T t", RefKind.Ref, ScopedKind.ScopedRef); 11191VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F2").Parameters[0], "params scoped System.Object[] args", RefKind.None, ScopedKind.ScopedValue); 11491verifyValueParameter(comp.GetMember<PropertySymbol>("R2.P2"), "R1 value", RefKind.None, ScopedKind.None); 11492verifyValueParameter(comp.GetMember<PropertySymbol>("R2.P3"), "R1 value", RefKind.None, ScopedKind.None); 11495static void verifyValueParameter(PropertySymbol property, string expectedDisplayString, RefKind expectedRefKind, ScopedKind expectedScope) 11518VerifyParameterSymbol(method.Parameters[0], "scoped R<System.Int32> x", RefKind.None, ScopedKind.ScopedValue); 11519VerifyParameterSymbol(method.Parameters[1], "scoped in System.Int32 y", RefKind.In, ScopedKind.ScopedRef); 11552VerifyParameterSymbol(method.Parameters[0], "scoped R x", RefKind.None, ScopedKind.ScopedValue); 11553VerifyParameterSymbol(method.Parameters[1], "scoped in System.Int32 y", RefKind.In, ScopedKind.ScopedRef); 11560private static void VerifyParameterSymbol(ParameterSymbol parameter, string expectedDisplayString, RefKind expectedRefKind, ScopedKind expectedScope, bool expectedHasUnscopedRefAttribute = false) 11573private static void VerifyParameterSymbol(IParameterSymbol parameter, string expectedDisplayString, RefKind expectedRefKind, ScopedKind expectedScope) 11632VerifyLocalSymbol(locals[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 11633VerifyLocalSymbol(locals[1], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 11634VerifyLocalSymbol(locals[2], "scoped ref readonly R r5", RefKind.RefReadOnly, ScopedKind.ScopedRef); 11635VerifyLocalSymbol(locals[3], "scoped R r11", RefKind.None, ScopedKind.ScopedValue); 11636VerifyLocalSymbol(locals[4], "scoped ref R r21", RefKind.Ref, ScopedKind.ScopedRef); 11637VerifyLocalSymbol(locals[5], "scoped ref readonly R r51", RefKind.RefReadOnly, ScopedKind.ScopedRef); 11706Assert.Equal(RefKind.None, f.RefKind); 11769VerifyLocalSymbol(locals[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 11770VerifyLocalSymbol(locals[1], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 11771VerifyLocalSymbol(locals[2], "scoped ref readonly R r5", RefKind.RefReadOnly, ScopedKind.ScopedRef); 11955VerifyLocalSymbol(locals[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 11956VerifyLocalSymbol(locals[1], "scoped R r2", RefKind.None, ScopedKind.ScopedValue); 11957VerifyLocalSymbol(locals[2], "scoped R r5", RefKind.None, ScopedKind.ScopedValue); 11958VerifyLocalSymbol(locals[3], "scoped R r11", RefKind.None, ScopedKind.ScopedValue); 11959VerifyLocalSymbol(locals[4], "scoped R r21", RefKind.None, ScopedKind.ScopedValue); 11960VerifyLocalSymbol(locals[5], "scoped R r51", RefKind.None, ScopedKind.ScopedValue); 12145Assert.Equal(RefKind.None, f.RefKind); 12366VerifyLocalSymbol(locals[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 12367VerifyLocalSymbol(locals[1], "scoped R r2", RefKind.None, ScopedKind.ScopedValue); 12368VerifyLocalSymbol(locals[2], "scoped R r5", RefKind.None, ScopedKind.ScopedValue); 12369VerifyLocalSymbol(locals[3], "scoped R r11", RefKind.None, ScopedKind.ScopedValue); 12370VerifyLocalSymbol(locals[4], "scoped R r21", RefKind.None, ScopedKind.ScopedValue); 12371VerifyLocalSymbol(locals[5], "scoped R r51", RefKind.None, ScopedKind.ScopedValue); 12552Assert.Equal(RefKind.None, f.RefKind); 12722VerifyLocalSymbol(locals[0], "scoped s1", RefKind.None, ScopedKind.None); 12723VerifyLocalSymbol(locals[1], "ref scoped s2", RefKind.Ref, ScopedKind.None); 12724VerifyLocalSymbol(locals[2], "ref scoped s3", RefKind.Ref, ScopedKind.None); 12725VerifyLocalSymbol(locals[3], "scoped scoped s4", RefKind.None, ScopedKind.ScopedValue); 12726VerifyLocalSymbol(locals[4], "scoped ref scoped s5", RefKind.Ref, ScopedKind.ScopedRef); 12727VerifyLocalSymbol(locals[5], "scoped ref scoped s6", RefKind.Ref, ScopedKind.ScopedRef); 12777VerifyLocalSymbol(locals[0], "scoped s1", RefKind.None, ScopedKind.None); 12778VerifyLocalSymbol(locals[1], "ref scoped s2", RefKind.Ref, ScopedKind.None); 12779VerifyLocalSymbol(locals[2], "ref scoped s3", RefKind.Ref, ScopedKind.None); 12780VerifyLocalSymbol(locals[3], "scoped scoped s4", RefKind.None, ScopedKind.ScopedValue); 12781VerifyLocalSymbol(locals[4], "scoped ref scoped s5", RefKind.Ref, ScopedKind.ScopedRef); 12782VerifyLocalSymbol(locals[5], "scoped ref scoped s6", RefKind.Ref, ScopedKind.ScopedRef); 12836VerifyLocalSymbol(locals[0], "scoped s1", RefKind.None, ScopedKind.None); 12837VerifyLocalSymbol(locals[2], "scoped s3", RefKind.None, ScopedKind.None); 12838VerifyLocalSymbol(locals[4], "scoped scoped s4", RefKind.None, ScopedKind.ScopedValue); 12839VerifyLocalSymbol(locals[6], "scoped scoped s6", RefKind.None, ScopedKind.ScopedValue); 12881VerifyLocalSymbol(locals[0], "scoped s1", RefKind.None, ScopedKind.None); 12882VerifyLocalSymbol(locals[1], "scoped s3", RefKind.None, ScopedKind.None); 12883VerifyLocalSymbol(locals[2], "scoped scoped s4", RefKind.None, ScopedKind.ScopedValue); 12884VerifyLocalSymbol(locals[3], "scoped scoped s6", RefKind.None, ScopedKind.ScopedValue); 12908VerifyLocalSymbol(locals[0], "System.Boolean scoped", RefKind.None, ScopedKind.None); 12933VerifyLocalSymbol(locals[0], "System.Boolean scoped", RefKind.None, ScopedKind.None); 12953VerifyLocalSymbol(locals[0], "System.Boolean scoped", RefKind.None, ScopedKind.None); 12975VerifyLocalSymbol(locals[0], "System.Boolean scoped", RefKind.None, ScopedKind.None); 13016VerifyLocalSymbol(locals[0], "scoped R<System.Int32> r1", RefKind.None, ScopedKind.ScopedValue); 13017VerifyLocalSymbol(locals[1], "scoped ref R<System.Int32> r3", RefKind.Ref, ScopedKind.ScopedRef); 13080VerifyLocalSymbol(locals[0], "scoped R<System.Int32> r1", RefKind.None, ScopedKind.ScopedValue); 13081VerifyLocalSymbol(locals[1], "scoped ref R<System.Int32> r3", RefKind.Ref, ScopedKind.ScopedRef); 13156VerifyLocalSymbol(locals[0], "scoped R<System.Int32> r1", RefKind.None, ScopedKind.ScopedValue); 13157VerifyLocalSymbol(locals[2], "scoped R<System.Int32> r3", RefKind.None, ScopedKind.ScopedValue); 13227VerifyLocalSymbol(locals[0], "scoped R<System.Int32> r1", RefKind.None, ScopedKind.ScopedValue); 13228VerifyLocalSymbol(locals[1], "scoped R<System.Int32> r3", RefKind.None, ScopedKind.ScopedValue); 13286VerifyLocalSymbol(locals[0], "ref System.Int32 a", RefKind.Ref, ScopedKind.None); 13287VerifyLocalSymbol(locals[1], "ref System.Int32 b", RefKind.Ref, ScopedKind.None); 13926VerifyLocalSymbol(locals[0], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 13927VerifyLocalSymbol(locals[1], "scoped ref R r5", RefKind.Ref, ScopedKind.ScopedRef); 13968VerifyLocalSymbol(locals[0], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 13969VerifyLocalSymbol(locals[1], "scoped ref R r5", RefKind.Ref, ScopedKind.ScopedRef); 14093VerifyLocalSymbol(locals[0], "R r11", RefKind.None, ScopedKind.None); 14094VerifyLocalSymbol(locals[1], "R r12", RefKind.None, ScopedKind.None); 14095VerifyLocalSymbol(locals[2], "scoped R r21", RefKind.None, ScopedKind.ScopedValue); 14096VerifyLocalSymbol(locals[3], "scoped R r22", RefKind.None, ScopedKind.ScopedValue); 14098VerifyLocalSymbol(locals[4], "ref R r31", RefKind.Ref, ScopedKind.None); 14099VerifyLocalSymbol(locals[5], "ref R r32", RefKind.Ref, ScopedKind.None); 14100VerifyLocalSymbol(locals[6], "scoped ref R r41", RefKind.Ref, ScopedKind.ScopedRef); 14101VerifyLocalSymbol(locals[7], "scoped ref R r42", RefKind.Ref, ScopedKind.ScopedRef); 14169VerifyLocalSymbol(locals[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 14170VerifyLocalSymbol(locals[1], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 14171VerifyLocalSymbol(locals[2], "scoped ref readonly R r5", RefKind.RefReadOnly, ScopedKind.ScopedRef); 14414VerifyLocalSymbol(locals[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 14415VerifyLocalSymbol(locals[1], "scoped R r2", RefKind.None, ScopedKind.ScopedValue); 14416VerifyLocalSymbol(locals[2], "scoped R r5", RefKind.None, ScopedKind.ScopedValue); 14417VerifyLocalSymbol(locals[3], "scoped R r11", RefKind.None, ScopedKind.ScopedValue); 14418VerifyLocalSymbol(locals[4], "scoped R r21", RefKind.None, ScopedKind.ScopedValue); 14419VerifyLocalSymbol(locals[5], "scoped R r51", RefKind.None, ScopedKind.ScopedValue); 14622VerifyLocalSymbol(locals[0], "scoped s1", RefKind.None, ScopedKind.None); 14623VerifyLocalSymbol(locals[1], "ref scoped s2", RefKind.Ref, ScopedKind.None); 14624VerifyLocalSymbol(locals[2], "ref scoped s3", RefKind.Ref, ScopedKind.None); 14625VerifyLocalSymbol(locals[3], "scoped scoped s4", RefKind.None, ScopedKind.ScopedValue); 14626VerifyLocalSymbol(locals[4], "scoped ref scoped s5", RefKind.Ref, ScopedKind.ScopedRef); 14627VerifyLocalSymbol(locals[5], "scoped ref scoped s6", RefKind.Ref, ScopedKind.ScopedRef); 14648VerifyLocalSymbol(locals[0], "System.Boolean scoped", RefKind.None, ScopedKind.None); 14709VerifyLocalSymbol(locals[0], "scoped R<System.Int32> r1", RefKind.None, ScopedKind.ScopedValue); 14710VerifyLocalSymbol(locals[1], "scoped ref R<System.Int32> r3", RefKind.Ref, ScopedKind.ScopedRef); 15280private static void VerifyLocalSymbol(LocalSymbol local, string expectedDisplayString, RefKind expectedRefKind, ScopedKind expectedScope) 15289private static void VerifyLocalSymbol(ILocalSymbol local, string expectedDisplayString, RefKind expectedRefKind, ScopedKind expectedScope) 15329VerifyParameterSymbol(method.Parameters[0], "ref System.Int32 i", RefKind.Ref, ScopedKind.None); 17517VerifyParameterSymbol(delegateInvokeMethods[0].Parameters[0], "R arg1", RefKind.None, ScopedKind.None); 17518VerifyParameterSymbol(delegateInvokeMethods[0].Parameters[1], "scoped R arg2", RefKind.None, ScopedKind.ScopedValue); 17519VerifyParameterSymbol(delegateInvokeMethods[1].Parameters[1], "scoped ref System.Int32 arg2", RefKind.Ref, ScopedKind.ScopedRef); 22398VerifyParameterSymbol(type.GetMethod("Get").ThisParameter, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 22399VerifyParameterSymbol(type.GetMethod("get_Item").ThisParameter, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 22403VerifyParameterSymbol(type.GetMethod("Get").ThisParameter, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22404VerifyParameterSymbol(type.GetMethod("get_Item").ThisParameter, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22467VerifyParameterSymbol(type.GetMethod("Get").ThisParameter, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 22468VerifyParameterSymbol(type.GetMethod("get_Item").ThisParameter, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 22473VerifyParameterSymbol(type.GetMethod("Get").ThisParameter, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22474VerifyParameterSymbol(type.GetMethod("get_Item").ThisParameter, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22621VerifyParameterSymbol(parameters[1], "scoped ref R x", RefKind.Ref, ScopedKind.ScopedRef); 22622VerifyParameterSymbol(parameters[2], "ref R y", RefKind.Ref, ScopedKind.None); 22684VerifyParameterSymbol(baseType.GetMethod("F1A").Parameters[0], "ref R<System.Int32> r1", RefKind.Ref, ScopedKind.None); 22685VerifyParameterSymbol(baseType.GetMethod("F2A").Parameters[0], "scoped ref R<System.Int32> r2", RefKind.Ref, ScopedKind.ScopedRef); 22773VerifyParameterSymbol(type.GetMethod("F1").Parameters[0], "ref R<T> r1", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22774VerifyParameterSymbol(type.GetMethod("F2").Parameters[0], "out T t2", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22775VerifyParameterSymbol(type.GetMethod("F3").Parameters[0], "in R<T> t3", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22776VerifyParameterSymbol(type.GetMethod("F4").Parameters[0], "R<T> t4", RefKind.None, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22857VerifyParameterSymbol(baseType.GetMethod("F4A").Parameters[0], "ref R<System.Int32> r4", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22880VerifyParameterSymbol(parameters[0], "System.Int32 x", RefKind.None, default, expectedHasUnscopedRefAttribute: true); 22881VerifyParameterSymbol(parameters[1], "System.Object y", RefKind.None, default, expectedHasUnscopedRefAttribute: true); 22908VerifyParameterSymbol(parameters[1], "out System.Int32 x", RefKind.Out, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 22909VerifyParameterSymbol(parameters[2], "out System.Int32 y", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22967VerifyParameterSymbol(baseType.GetMethod("F1A").Parameters[0], "out System.Int32 t1", RefKind.Out, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 22968VerifyParameterSymbol(baseType.GetMethod("F2A").Parameters[0], "out System.Int32 t2", RefKind.Out, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 22969VerifyParameterSymbol(baseType.GetMethod("F3A").Parameters[0], "out System.Int32 t3", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23032VerifyParameterSymbol(baseType.GetMethod("F1A").Parameters[0], "ref System.Int32 t1", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 23033VerifyParameterSymbol(baseType.GetMethod("F2A").Parameters[0], "scoped ref System.Int32 t2", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23034VerifyParameterSymbol(baseType.GetMethod("F3A").Parameters[0], "ref System.Int32 t3", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23035VerifyParameterSymbol(baseType.GetMethod("F4A").Parameters[0], "ref System.Int32 t4", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23098VerifyParameterSymbol(baseType.GetMethod("F1A").Parameters[0], "in System.Int32 t1", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 23099VerifyParameterSymbol(baseType.GetMethod("F2A").Parameters[0], "scoped in System.Int32 t2", RefKind.In, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23100VerifyParameterSymbol(baseType.GetMethod("F3A").Parameters[0], "in System.Int32 t3", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23101VerifyParameterSymbol(baseType.GetMethod("F4A").Parameters[0], "in System.Int32 t4", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23188VerifyParameterSymbol(baseType.GetMethod("F1A").Parameters[0], "R<System.Int32> r1", RefKind.None, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 23189VerifyParameterSymbol(baseType.GetMethod("F2A").Parameters[0], "scoped R<System.Int32> r2", RefKind.None, ScopedKind.ScopedValue, expectedHasUnscopedRefAttribute: false); 23190VerifyParameterSymbol(baseType.GetMethod("F3A").Parameters[0], "R<System.Int32> r3", RefKind.None, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23191VerifyParameterSymbol(baseType.GetMethod("F4A").Parameters[0], "R<System.Int32> r4", RefKind.None, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23216VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F1").Parameters[0], "R<T> r1", RefKind.None, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23217VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F2").Parameters[0], "ref R<T> r2", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23218VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F3").Parameters[0], "in R<T> r3", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23219VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F4").Parameters[0], "out R<T> r4", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23465VerifyParameterSymbol(lambdas[0].Parameters[0], "out System.Int32 i1", RefKind.Out, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23466VerifyParameterSymbol(lambdas[1].Parameters[0], "out System.Int32 i2", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23467VerifyParameterSymbol(lambdas[2].Parameters[0], "out System.Object o1", RefKind.Out, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23468VerifyParameterSymbol(lambdas[3].Parameters[0], "out System.Object o2", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23501VerifyParameterSymbol(lambdas[0].Parameters[0], "ref System.Int32 i1", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 23502VerifyParameterSymbol(lambdas[1].Parameters[0], "ref System.Int32 i2", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23503VerifyParameterSymbol(lambdas[2].Parameters[0], "ref System.Object o1", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 23504VerifyParameterSymbol(lambdas[3].Parameters[0], "ref System.Object o2", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23538VerifyParameterSymbol(lambdas[0].Parameters[0], "scoped ref R<System.Int32> r1", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23539VerifyParameterSymbol(lambdas[1].Parameters[0], "ref R<System.Int32> r2", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 23540VerifyParameterSymbol(lambdas[2].Parameters[0], "scoped ref R<System.Object> r1", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23541VerifyParameterSymbol(lambdas[3].Parameters[0], "ref R<System.Object> r2", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 23962VerifyParameterSymbol(typeA.GetMethod("NoAttributes").Parameters[0], "out System.Int32 i", RefKind.Out, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23963VerifyParameterSymbol(typeA.GetMethod("ScopedRefOnly").Parameters[0], "out System.Int32 i", RefKind.Out, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23964VerifyParameterSymbol(typeA.GetMethod("UnscopedRefOnly").Parameters[0], "out System.Int32 i", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23965VerifyParameterSymbol(typeA.GetMethod("ScopedRefAndUnscopedRef").Parameters[0], "out System.Int32 i", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24064VerifyParameterSymbol(typeA.GetMethod("NoAttributes").Parameters[0], "ref R x", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 24065VerifyParameterSymbol(typeA.GetMethod("ScopedRefOnly").Parameters[0], "scoped ref R x", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 24066VerifyParameterSymbol(typeA.GetMethod("UnscopedRefOnly").Parameters[0], "ref R x", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24067VerifyParameterSymbol(typeA.GetMethod("ScopedRefAndUnscopedRef").Parameters[0], "ref R x", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24172VerifyParameterSymbol(typeA.GetMethod("NoAttributes").Parameters[0], "in R x", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 24173VerifyParameterSymbol(typeA.GetMethod("ScopedRefOnly").Parameters[0], "scoped in R x", RefKind.In, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 24174VerifyParameterSymbol(typeA.GetMethod("UnscopedRefOnly").Parameters[0], "in R x", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24175VerifyParameterSymbol(typeA.GetMethod("ScopedRefAndUnscopedRef").Parameters[0], "in R x", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24230VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F1").ThisParameter, "ref S1 this", RefKind.Ref, ScopedKind.ScopedRef); 24231VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F2").ThisParameter, "in S2 this", RefKind.In, ScopedKind.ScopedRef); 24232VerifyParameterSymbol(comp.GetMember<MethodSymbol>("A.F3").Parameters[0], "out System.Int32 i3", RefKind.Out, useUpdatedRules ? ScopedKind.ScopedRef : ScopedKind.None); 24233VerifyParameterSymbol(comp.GetMember<MethodSymbol>("A.F4").Parameters[0], "ref R r4", RefKind.Ref, ScopedKind.None); 24234VerifyParameterSymbol(comp.GetMember<MethodSymbol>("A.F5").Parameters[0], "in R r5", RefKind.In, ScopedKind.None); 24273VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F1").ThisParameter, "ref S1 this", RefKind.Ref, ScopedKind.ScopedRef); 24274VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F2").ThisParameter, "in S2 this", RefKind.In, ScopedKind.ScopedRef); 24275VerifyParameterSymbol(comp.GetMember<MethodSymbol>("A.F3").Parameters[0], "out System.Int32 i3", RefKind.Out, useUpdatedRules ? ScopedKind.ScopedRef : ScopedKind.None); 24276VerifyParameterSymbol(comp.GetMember<MethodSymbol>("A.F4").Parameters[0], "ref R r4", RefKind.Ref, ScopedKind.None); 24277VerifyParameterSymbol(comp.GetMember<MethodSymbol>("A.F5").Parameters[0], "in R r5", RefKind.In, ScopedKind.None); 24307verifyParameter(delegateTypesAndLambdas[0], 0, "out System.Int32", "i1", RefKind.Out, useUpdatedRules ? ScopedKind.ScopedRef : ScopedKind.None); 24308verifyParameter(delegateTypesAndLambdas[1], 0, "R", "r2", RefKind.None, ScopedKind.None); 24309verifyParameter(delegateTypesAndLambdas[2], 0, "ref R", "r3", RefKind.Ref, ScopedKind.None); 24310verifyParameter(delegateTypesAndLambdas[3], 0, "in R", "r4", RefKind.In, ScopedKind.None); 24311verifyParameter(delegateTypesAndLambdas[4], 0, "out R", "r5", RefKind.Out, useUpdatedRules ? ScopedKind.ScopedRef : ScopedKind.None); 24313static void verifyParameter((NamedTypeSymbol, LambdaSymbol) delegateTypeAndLambda, int parameterIndex, string expectedDisplayType, string expectedDisplayName, RefKind expectedRefKind, ScopedKind expectedScope) 24357VerifyParameterSymbol(getFunctionPointerMethod(comp, "A.F1").Parameters[0], "out modreq(System.Runtime.InteropServices.OutAttribute) System.Int32", RefKind.Out, useUpdatedRules ? ScopedKind.ScopedRef : ScopedKind.None); 24358VerifyParameterSymbol(getFunctionPointerMethod(comp, "A.F2").Parameters[0], "R", RefKind.None, ScopedKind.None); 24359VerifyParameterSymbol(getFunctionPointerMethod(comp, "A.F3").Parameters[0], "ref R", RefKind.Ref, ScopedKind.None); 24360VerifyParameterSymbol(getFunctionPointerMethod(comp, "A.F4").Parameters[0], "in modreq(System.Runtime.InteropServices.InAttribute) R", RefKind.In, ScopedKind.None); 24361VerifyParameterSymbol(getFunctionPointerMethod(comp, "A.F5").Parameters[0], "out modreq(System.Runtime.InteropServices.OutAttribute) R", RefKind.Out, useUpdatedRules ? ScopedKind.ScopedRef : ScopedKind.None); 24417VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S.F").ThisParameter, "ref S this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24418VerifyParameterSymbol(comp.GetMember<PropertySymbol>("S.P").GetMethod.ThisParameter, "ref S this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24419VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F1").Parameters[0], "out System.Int32 i1", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24420VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F2").Parameters[0], "R r2", RefKind.None, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24421VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F3").Parameters[0], "ref R r3", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24422VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F4").Parameters[0], "in R r4", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24423VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F5").Parameters[0], "out R r5", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 25036VerifyParameterSymbol(typeA.GetMethod("F1").Parameters[0], "ref R x", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 25037VerifyParameterSymbol(typeA.GetMethod("F2").Parameters[0], "ref R x", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 25038VerifyParameterSymbol(typeA.GetMethod("F3").Parameters[0], "in R x", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 25039VerifyParameterSymbol(typeA.GetMethod("F4").Parameters[0], "in R x", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 25992VerifyParameterSymbol(method.Parameters[0], "out System.Int32 i", RefKind.Out, version == 11 ? ScopedKind.ScopedRef : ScopedKind.None); 26031VerifyParameterSymbol(method.Parameters[0], "out System.Int32 i", RefKind.Out, ScopedKind.None); 26070VerifyParameterSymbol(method.Parameters[0], "out System.Int32 i", RefKind.Out, ScopedKind.None); 26120VerifyParameterSymbol(method.Parameters[0], "out T t", RefKind.Out, expectedUseUpdatedEscapeRules ? ScopedKind.ScopedRef : ScopedKind.None); 26612VerifyLocalSymbol(locals[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 26613VerifyLocalSymbol(locals[1], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 26614VerifyLocalSymbol(locals[2], "scoped ref readonly R r5", RefKind.RefReadOnly, ScopedKind.ScopedRef); 26702VerifyLocalSymbol(locals[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 26703VerifyLocalSymbol(locals[1], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 26704VerifyLocalSymbol(locals[2], "scoped ref readonly R r5", RefKind.RefReadOnly, ScopedKind.ScopedRef); 26822VerifyLocalSymbol(locals[0], "scoped s1", RefKind.None, ScopedKind.None); 26823VerifyLocalSymbol(locals[1], "ref scoped s2", RefKind.Ref, ScopedKind.None); 26824VerifyLocalSymbol(locals[2], "ref scoped s3", RefKind.Ref, ScopedKind.None); 26825VerifyLocalSymbol(locals[3], "scoped scoped s4", RefKind.None, ScopedKind.ScopedValue); 26826VerifyLocalSymbol(locals[4], "scoped ref scoped s5", RefKind.Ref, ScopedKind.ScopedRef); 26827VerifyLocalSymbol(locals[5], "scoped ref scoped s6", RefKind.Ref, ScopedKind.ScopedRef); 26923VerifyLocalSymbol(locals[0], "scoped s1", RefKind.None, ScopedKind.None); 26924VerifyLocalSymbol(locals[1], "ref scoped s2", RefKind.Ref, ScopedKind.None); 26925VerifyLocalSymbol(locals[2], "ref scoped s3", RefKind.Ref, ScopedKind.None); 26926VerifyLocalSymbol(locals[3], "scoped scoped s4", RefKind.None, ScopedKind.ScopedValue); 26927VerifyLocalSymbol(locals[4], "scoped ref scoped s5", RefKind.Ref, ScopedKind.ScopedRef); 26928VerifyLocalSymbol(locals[5], "scoped ref scoped s6", RefKind.Ref, ScopedKind.ScopedRef); 26974VerifyLocalSymbol(locals[0], "scoped R<System.Int32> r1", RefKind.None, ScopedKind.ScopedValue); 26975VerifyLocalSymbol(locals[1], "scoped R<System.Int32> r3", RefKind.None, ScopedKind.ScopedValue); 27034VerifyLocalSymbol(locals[0], "scoped R<System.Int32> r1", RefKind.None, ScopedKind.ScopedValue); 27035VerifyLocalSymbol(locals[1], "scoped R<System.Int32> r3", RefKind.None, ScopedKind.ScopedValue); 27258VerifyLocalSymbol(locals[0], "scoped R r2", RefKind.None, ScopedKind.ScopedValue); 27259VerifyLocalSymbol(locals[1], "scoped R r5", RefKind.None, ScopedKind.ScopedValue); 27306VerifyLocalSymbol(locals[0], "scoped R r2", RefKind.None, ScopedKind.ScopedValue); 27307VerifyLocalSymbol(locals[1], "scoped R r5", RefKind.None, ScopedKind.ScopedValue);
Semantics\RefLocalsAndReturnsTests.cs (2)
5262Assert.Equal(RefKind.None, f.RefKind); 5301Assert.Equal(RefKind.None, f.RefKind);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (152)
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 (3)
1314Single(m => m.ParameterRefKinds.Single() == RefKind.Out); 6709Assert.Equal(RefKind.In, parameterSymbol.RefKind); 6752Assert.Equal(RefKind.RefReadOnlyParameter, parameterSymbol.RefKind);
SymbolDisplay\SymbolDisplayTests.cs (3)
6684Assert.Equal(RefKind.None, local.RefKind); 6729Assert.Equal(RefKind.Ref, local.RefKind); 6776Assert.Equal(RefKind.RefReadOnly, local.RefKind);
Symbols\CompilationCreationTests.cs (2)
2357Assert.Equal(RefKind.Ref, x1.RefKind); 2362Assert.Equal(RefKind.Out, x2.RefKind);
Symbols\DefaultInterfaceImplementationTests.cs (1)
69145Assert.Equal(RefKind.In, p.RefKind);
Symbols\ExtensionMethodTests.cs (4)
4035Assert.Equal(RefKind.In, parameter.RefKind); 4041Assert.Equal(RefKind.In, parameter.RefKind); 4065Assert.Equal(RefKind.Ref, parameter.RefKind); 4071Assert.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); 1532Assert.Throws<ArgumentNullException>("returnType", () => comp.CreateFunctionPointerTypeSymbol(returnType: null!, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty)); 1533Assert.Throws<ArgumentNullException>("parameterTypes", () => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: default, parameterRefKinds: ImmutableArray<RefKind>.Empty)); 1534Assert.Throws<ArgumentNullException>("parameterTypes[0]", () => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray.Create((ITypeSymbol?)null)!, parameterRefKinds: ImmutableArray.Create(RefKind.None))); 1535Assert.Throws<ArgumentNullException>("parameterRefKinds", () => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: default)); 1536Assert.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!))); 1537Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray.Create(RefKind.None))); 1538Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.Out, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty)); 1539Assert.Throws<ArgumentOutOfRangeException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: (SignatureCallingConvention)10)); 1540Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.Default, callingConventionTypes: ImmutableArray.Create(cdeclType)!)); 1541Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.StdCall, callingConventionTypes: ImmutableArray.Create(cdeclType)!)); 1542Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.FastCall, callingConventionTypes: ImmutableArray.Create(cdeclType)!)); 1543Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.CDecl, callingConventionTypes: ImmutableArray.Create(cdeclType)!)); 1544Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.ThisCall, callingConventionTypes: ImmutableArray.Create(cdeclType)!)); 1545Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.Unmanaged, callingConventionTypes: ImmutableArray.Create(@string)!)); 1553var ptr = comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.VarArgs); 1569RefKind.None, 1571ImmutableArray.Create(RefKind.None, RefKind.None)); 1584RefKind.RefReadOnly, 1586ImmutableArray.Create(RefKind.In)); 1601RefKind.None, 1603ImmutableArray.Create(RefKind.Out)); 1619RefKind.RefReadOnly, 1621ImmutableArray.Create(RefKind.Out)); 1638var ptr = comp.CreateFunctionPointerTypeSymbol(@string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, convention); 1640ptr = comp.CreateFunctionPointerTypeSymbol(@string, returnRefKind: RefKind.RefReadOnly, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, convention); 1653var ptr = comp.CreateFunctionPointerTypeSymbol(@string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, SignatureCallingConvention.Unmanaged, ImmutableArray.Create(cdeclType, stdcallType)!); 1655ptr = comp.CreateFunctionPointerTypeSymbol(@string, returnRefKind: RefKind.RefReadOnly, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, SignatureCallingConvention.Unmanaged, ImmutableArray.Create(cdeclType, stdcallType)!); 1658ptr = comp.CreateFunctionPointerTypeSymbol(@string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, SignatureCallingConvention.Unmanaged, ImmutableArray.Create(cdeclType)!); 1967returnRefKind: RefKind.None, 1969parameterRefKinds: ImmutableArray<RefKind>.Empty, 2047returnRefKind: RefKind.None, 2050parameterRefKinds: ImmutableArray<RefKind>.Empty, 2056RefKind.Ref, 2059parameterRefKinds: ImmutableArray<RefKind>.Empty, 2114returnRefKind: RefKind.None, 2117parameterRefKinds: ImmutableArray<RefKind>.Empty, 2123RefKind.Ref, 2126parameterRefKinds: ImmutableArray<RefKind>.Empty, 2173returnRefKind: RefKind.None, 2176parameterRefKinds: ImmutableArray<RefKind>.Empty, 2182RefKind.Ref, 2185parameterRefKinds: ImmutableArray<RefKind>.Empty,
Symbols\InterfaceImplementationTests.cs (2)
2032Assert.Equal(RefKind.Ref, interfaceMethod.RefKind); 2033Assert.Equal(RefKind.Ref, baseMethod.RefKind);
Symbols\Metadata\MetadataMemberTests.cs (2)
286Assert.Equal(RefKind.Ref, p5.RefKind); 289Assert.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); 783Assert.Equal(RefKind.Ref, d.DelegateInvokeMethod.RefKind); 784Assert.Equal(RefKind.Ref, ((MethodSymbol)d.GetMembers("EndInvoke").Single()).RefKind); 800Assert.Equal(RefKind.RefReadOnly, d.DelegateInvokeMethod.RefKind); 801Assert.Equal(RefKind.RefReadOnly, ((MethodSymbol)d.GetMembers("EndInvoke").Single()).RefKind); 803Assert.Equal(RefKind.In, d.DelegateInvokeMethod.Parameters[0].RefKind); 832Assert.Equal(RefKind.In, lambda.Parameters[0].RefKind); 839Assert.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)
3372Assert.Equal(RefKind.Ref, param.RefKind);
Symbols\TypeTests.cs (5)
514Assert.Equal(RefKind.Ref, p1.RefKind); 516Assert.Equal(RefKind.Out, p2.RefKind); 518Assert.Equal(RefKind.None, p3.RefKind); 1558Assert.Equal(RefKind.Ref, paras[0].RefKind); 1559Assert.Equal(RefKind.Out, paras[1].RefKind);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (14)
Extensions.cs (2)
216m.Parameters.All(p => p.RefKind == RefKind.Out && p.Type.Equals(primaryConstructor.Parameters[p.Ordinal].Type, SymbolEqualityComparer.Default))); 610Assert.Equal(RefKind.None, valueParameter.RefKind);
FunctionPointerUtilities.cs (12)
271public static void VerifyFunctionPointerSymbol(TypeSymbol type, CallingConvention expectedConvention, (RefKind RefKind, Action<TypeSymbol> TypeVerifier) returnVerifier, params (RefKind RefKind, Action<TypeSymbol> TypeVerifier)[] argumentVerifiers) 283case RefKind.RefReadOnly: 288case RefKind.None: 289case RefKind.Ref: 294case RefKind.Out: 309case RefKind.Out: 314case RefKind.In: 319case RefKind.Ref: 320case RefKind.None: 350public 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 (34)
CodeGeneration\CSharpSyntaxGenerator.cs (12)
191string name, SyntaxNode? type, SyntaxNode? initializer, RefKind refKind, bool isExtension, bool isParams, bool isScoped) 211internal static SyntaxToken GetArgumentModifiers(RefKind refKind) 215case RefKind.None: 216case RefKind.In: 218case RefKind.Out: 220case RefKind.Ref: 222case RefKind.RefReadOnlyParameter: 3433private protected override SyntaxNode TypeExpression(ITypeSymbol typeSymbol, RefKind refKind) 3438RefKind.Ref => SyntaxFactory.RefType(type), 3439RefKind.RefReadOnly => SyntaxFactory.RefType(RefKeyword, ReadOnlyKeyword, type), 3486public override SyntaxNode Argument(string? name, RefKind refKind, SyntaxNode expression) 3616=> this.ParameterDeclaration(identifier, type, initializer: null, RefKind.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\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)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
379ReducedFrom.Parameters: [{ RefKind: RefKind.Ref }, ..],
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
592public RefKind GetRefKindOfArgument(SyntaxNode node)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (3)
669if (castedSymbol is not IFieldSymbol and not ILocalSymbol and not IParameterSymbol and not IParameterSymbol { RefKind: RefKind.Ref }) 1351if (operation is IPropertyReferenceOperation { Property.RefKind: not RefKind.Ref }) 1355if (operation is IInvocationOperation { TargetMethod.RefKind: not RefKind.Ref })
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (7)
135internal static SyntaxTokenList GetParameterModifiers(RefKind refKind, bool forFunctionPointerReturnParameter = false) 138RefKind.None => [], 139RefKind.Out => [OutKeyword], 140RefKind.Ref => [RefKeyword], 144RefKind.In when !forFunctionPointerReturnParameter => [InKeyword], 145RefKind.RefReadOnly when forFunctionPointerReturnParameter => [RefKeyword, ReadOnlyKeyword], 146RefKind.RefReadOnlyParameter => [RefKeyword, ReadOnlyKeyword],
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (3)
715return InferTypeInArgument(index, parameterizedSymbols, name, RefKind.None); 748var refKind = argumentOpt.GetRefKind(); 757RefKind refKind)
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (4)
CodeGeneration\SyntaxGeneratorTests.cs (4)
467VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.Argument(RefKind.Ref, Generator.IdentifierName("y"))), "x(ref y)"); 468VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.Argument(RefKind.Out, Generator.IdentifierName("y"))), "x(out y)"); 531Generator.Argument("goo", RefKind.None, Generator.IdentifierName("x")), 532Generator.Argument("bar", RefKind.None, Generator.IdentifierName("y"))]), "(goo: x, bar: y)");
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (17)
CodeGeneration\CodeGenerationTests.cs (7)
160RefKind.None, 353RefKind.None, 448RefKind.None, 459RefKind.None, 483RefKind.None, 658attributes: default, RefKind.None, isParams, GetTypeSymbol(s.Compilation, type), name, 665attributes: default, RefKind.None, isParams, GetTypeSymbol(s.Compilation, typeFullName, typeArrayRank), parameterName,
CodeGeneration\ExpressionGenerationTests.cs (10)
382f.Argument("n", RefKind.None, f.IdentifierName("a"))), 395f.Argument(null, RefKind.Out, f.IdentifierName("a")), 396f.Argument(null, RefKind.Ref, f.IdentifierName("b"))), 409f.Argument("n1", RefKind.Out, f.IdentifierName("a")), 410f.Argument("n2", RefKind.Ref, f.IdentifierName("b"))), 448f.Argument("n", RefKind.None, f.IdentifierName("a"))), 461f.Argument(null, RefKind.Out, f.IdentifierName("a")), 462f.Argument(null, RefKind.Ref, f.IdentifierName("b"))), 475f.Argument("n1", RefKind.Out, f.IdentifierName("a")), 476f.Argument("n2", RefKind.Ref, f.IdentifierName("b"))),
Microsoft.CodeAnalysis.Features (59)
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.State.cs (1)
110return constructorParams.All(parameter => parameter.RefKind == RefKind.None) &&
ChangeSignature\AbstractChangeSignatureService.cs (1)
833refKind: 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)
870RefKind.None, 875CodeGenerationSymbolFactory.CreateParameterSymbol(RefKind.Out, p.Type, p.Name)),
EditAndContinue\Utilities\Extensions.cs (1)
165static (param, constructor) => param.RefKind == RefKind.Out && param.Type.Equals(constructor.Parameters[param.Ordinal].Type, SymbolEqualityComparer.Default),
EncapsulateField\AbstractEncapsulateFieldService.cs (1)
351refKind: RefKind.None,
ExtractMethod\MethodExtractor.CodeGenerator.cs (5)
360var refKind = GetRefKind(parameter.ParameterModifier); 376private static RefKind GetRefKind(ParameterBehavior parameterBehavior) 378return parameterBehavior == ParameterBehavior.Ref ? RefKind.Ref : 379parameterBehavior == ParameterBehavior.Out ? RefKind.Out : RefKind.None;
GenerateConstructorFromMembers\AbstractGenerateConstructorFromMembersCodeRefactoringProvider.State.cs (1)
105where c.Parameters.All(p => p.RefKind == RefKind.None) && !c.Parameters.Any(static p => p.IsParams)
GenerateEqualsAndGetHashCodeFromMembers\AbstractGenerateEqualsAndGetHashCodeService.cs (1)
139refKind: RefKind.None,
GenerateFromMembers\AbstractGenerateFromMembersCodeRefactoringProvider.cs (1)
112refKind: RefKind.None,
GenerateType\AbstractGenerateTypeService.GenerateNamedType.cs (1)
50RefKind.None,
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (1)
258if (parameter.RefKind == RefKind.Out)
InitializeParameter\AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs (1)
346RefKind.None,
IntroduceParameter\IntroduceParameterDocumentRewriter.cs (1)
576? (TArgumentSyntax)_generator.Argument(parameterName, RefKind.None, newArgumentExpression)
MetadataAsSource\AbstractMetadataAsSourceService.WrappedFieldSymbol.cs (1)
26public RefKind RefKind => _symbol.RefKind;
MetadataAsSource\AbstractMetadataAsSourceService.WrappedMethodSymbol.cs (1)
90public RefKind RefKind => _symbol.RefKind;
MetadataAsSource\AbstractMetadataAsSourceService.WrappedPropertySymbol.cs (1)
44public RefKind RefKind => _symbol.RefKind;
ReplaceMethodWithProperty\ReplaceMethodWithPropertyCodeRefactoringProvider.cs (1)
137setMethod.Parameters is [{ RefKind: RefKind.None } parameter] &&
RQName\RQNodeBuilder.cs (2)
152if (parameter.RefKind == RefKind.Out) 156else if (parameter.RefKind == RefKind.Ref)
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
743methodSymbol.Parameters[0].RefKind == RefKind.None &&
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (2)
544case RefKind.Out: 551case RefKind.Ref:
src\Analyzers\Core\Analyzers\UseCompoundAssignment\UseCompoundAssignmentUtilities.cs (1)
133if (property.RefKind == RefKind.None)
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForReturn\UseConditionalExpressionForReturnHelpers.cs (2)
81syntaxFacts, anyReturn.GetRefKind(containingSymbol) != RefKind.None, 122isRef = anyReturn.GetRefKind(containingSymbol) != RefKind.None;
src\Analyzers\Core\CodeFixes\AddParameter\AbstractAddParameterCodeFixProvider.cs (1)
393private async Task<(ITypeSymbol, RefKind)> GetArgumentTypeAndRefKindAsync(Document invocationDocument, TArgumentSyntax argument, CancellationToken cancellationToken)
src\Analyzers\Core\CodeFixes\AddParameter\AddParameterService.cs (2)
77RefKind refKind, 162RefKind refKind,
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.State.cs (1)
48private ImmutableArray<RefKind> _parameterRefKinds;
src\Analyzers\Core\CodeFixes\GenerateConstructor\Argument.cs (2)
9protected readonly struct Argument(RefKind refKind, string? name, TExpressionSyntax? expression) 11public readonly RefKind RefKind = refKind;
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateDeconstructMethodService.State.cs (1)
76refKind: RefKind.None,
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateMethodService.State.cs (1)
255refKind: RefKind.None,
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.MethodSignatureInfo.cs (2)
27protected override RefKind DetermineRefKind(CancellationToken cancellationToken) 33protected override ImmutableArray<RefKind> DetermineParameterModifiers(CancellationToken cancellationToken)
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.SignatureInfo.cs (2)
50protected abstract RefKind DetermineRefKind(CancellationToken cancellationToken); 65protected abstract ImmutableArray<RefKind> DetermineParameterModifiers(CancellationToken cancellationToken);
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.CodeAction.cs (4)
34private readonly RefKind _refKind; 44RefKind refKind) 70var setAccessor = _isReadonly || _refKind != RefKind.None 121return _state.TypeToGenerateIn.TypeKind != TypeKind.Interface && _refKind != RefKind.None
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.cs (8)
153document, state, generateProperty: false, isReadonly: false, isConstant: true, refKind: RefKind.None)); 167document, state, generateProperty: false, isReadonly: true, isConstant: false, refKind: RefKind.None)); 181document, state, generateProperty: false, isReadonly: false, isConstant: false, refKind: RefKind.None)); 229parameter.RefKind is RefKind.Out || 254private static RefKind GetRefKindFromContext(State state) 258return RefKind.Ref; 262return RefKind.RefReadOnly; 266return RefKind.None;
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.GenerateParameterCodeAction.cs (1)
44RefKind.None,
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator_DisposePattern.cs (1)
203g.Argument(DisposingName, RefKind.None, g.TrueLiteralExpression())))));
src\Compilers\Core\Portable\DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (1)
796if ((symbol.RefKind == RefKind.None) == parameterInfo.IsRefOrOut)
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)
2894refKind As RefKind, 2896parameterRefKinds 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)
455Private ReadOnly Property IFieldSymbol_RefKind As RefKind Implements IFieldSymbol.RefKind 457Return RefKind.None
Symbols\MethodSymbol.vb (3)
1050Private ReadOnly Property IMethodSymbol_RefKind As RefKind Implements IMethodSymbol.RefKind 1052Return If(Me.ReturnsByRef, RefKind.Ref, RefKind.None)
Symbols\ParameterSymbol.vb (3)
304Private ReadOnly Property IParameterSymbol_RefKind As RefKind Implements IParameterSymbol.RefKind, IParameterSymbolInternal.RefKind 308Return 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)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\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
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\ParenthesizedExpressionSyntaxExtensions.vb (1)
288parameter.RefKind <> RefKind.None Then
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SyntaxFacts\VisualBasicSyntaxFacts.vb (2)
599Public Function GetRefKindOfArgument(node As SyntaxNode) As RefKind Implements ISyntaxFacts.GetRefKindOfArgument 601Return RefKind.None
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (8)
src\Analyzers\VisualBasic\CodeFixes\GenerateConstructor\VisualBasicGenerateConstructorService.vb (1)
162Return arguments.SelectAsArray(Function(a) New Argument(RefKind.None, TryCast(a, SimpleArgumentSyntax)?.NameColonEquals?.Name.Identifier.ValueText, a.GetArgumentExpression()))
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicGenerateConversionService.vb (1)
155refKind:=RefKind.None,
src\Analyzers\VisualBasic\CodeFixes\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)
src\Analyzers\VisualBasic\CodeFixes\ImplementInterface\VisualBasicImplementInterfaceService.vb (1)
118g.Argument(DisposingName, RefKind.None, g.FalseLiteralExpression()))))
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (1)
NavigationBar\VisualBasicEditorNavigationBarItemService_CodeGeneration.vb (1)
233refKind:=RefKind.None,
Microsoft.CodeAnalysis.VisualBasic.Features (16)
CodeFixes\GenerateEvent\GenerateEventCodeFixProvider.vb (3)
144refKind:=RefKind.None, name:=eventHandlerName, 293modifiers:=Nothing, returnType:=returnType, refKind:=RefKind.None, 393refKind:=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)
68refKind:=RefKind.None,
GenerateType\VisualBasicGenerateTypeService.vb (1)
703refKind:=RefKind.None,
src\Analyzers\VisualBasic\CodeFixes\GenerateConstructor\VisualBasicGenerateConstructorService.vb (1)
162Return arguments.SelectAsArray(Function(a) New Argument(RefKind.None, TryCast(a, SimpleArgumentSyntax)?.NameColonEquals?.Name.Identifier.ValueText, a.GetArgumentExpression()))
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicGenerateConversionService.vb (1)
155refKind:=RefKind.None,
src\Analyzers\VisualBasic\CodeFixes\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)
src\Analyzers\VisualBasic\CodeFixes\ImplementInterface\VisualBasicImplementInterfaceService.vb (1)
118g.Argument(DisposingName, RefKind.None, g.FalseLiteralExpression()))))
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)
108Public Overloads Overrides Function Argument(name As String, refKind As RefKind, expression As SyntaxNode) As SyntaxNode 386Private Protected Overrides Function TypeExpression(typeSymbol As ITypeSymbol, refKind As RefKind) As SyntaxNode 819refKind As RefKind, 839Private Shared Function GetParameterModifiers(refKind As RefKind, initializer As SyntaxNode) As SyntaxTokenList 845If refKind <> RefKind.None Then 1498Return Argument(name, RefKind.None, expression)
Simplification\VisualBasicSimplificationService.Expander.vb (1)
325parameter.RefKind <> RefKind.None Then
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\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
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\ParenthesizedExpressionSyntaxExtensions.vb (1)
288parameter.RefKind <> RefKind.None Then
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SyntaxFacts\VisualBasicSyntaxFacts.vb (2)
599Public Function GetRefKindOfArgument(node As SyntaxNode) As RefKind Implements ISyntaxFacts.GetRefKindOfArgument 601Return 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 (77)
Editing\DeclarationModifiers.cs (2)
88isRef: field?.RefKind is RefKind.Ref or RefKind.RefReadOnly || type?.IsRefLikeType == true,
Editing\SyntaxGenerator.cs (12)
303RefKind refKind = RefKind.None) 313RefKind refKind, 331isScoped: symbol is { RefKind: RefKind.Ref or RefKind.In or RefKind.RefReadOnlyParameter, ScopedKind: ScopedKind.ScopedRef } 332or { RefKind: RefKind.None, Type.IsRefLikeType: true, ScopedKind: ScopedKind.ScopedValue }); 1931=> TypeExpression(typeSymbol, RefKind.None); 1933private protected abstract SyntaxNode TypeExpression(ITypeSymbol typeSymbol, RefKind refKind); 2234public abstract SyntaxNode Argument(string? name, RefKind refKind, SyntaxNode expression); 2239public SyntaxNode Argument(RefKind refKind, SyntaxNode expression) 2246=> Argument(name: null, RefKind.None, expression);
ReassignedVariable\AbstractReassignedVariableService.cs (2)
211symbolIsDefinitelyAssigned: parameter.RefKind != RefKind.Out, 235symbolIsDefinitelyAssigned: parameter.RefKind != RefKind.Out,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\IParameterSymbolExtensions.cs (2)
15case RefKind.Ref: 16case RefKind.Out:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (1)
435if (symbol is IMethodSymbol method && method.Parameters.All(p => p.RefKind == RefKind.None))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (9)
163case RefKind.RefReadOnly: 166case RefKind.Out: 169case RefKind.Ref: 180RefKind.RefReadOnly => ValueUsageInfo.ReadableReference, 181RefKind.Ref => ValueUsageInfo.ReadableWritableReference, 218case RefKind.Ref: 221case RefKind.RefReadOnly: 230public static RefKind GetRefKind(this IReturnOperation? operation, ISymbol containingSymbol) 233return containingMethod?.RefKind ?? RefKind.None;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (2)
441if (parameter.RefKind is RefKind.Ref or RefKind.Out)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (1)
305RefKind GetRefKindOfArgument(SyntaxNode node);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
273PooledArrayBuilder<RefKind> refKinds)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.FunctionPointerTypeSymbolKey.cs (1)
55var returnRefKind = reader.ReadRefKind();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\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();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (1)
318internal void WriteRefKind(RefKind refKind) => WriteInteger((int)refKind);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.ParameterSymbolEqualityComparer.cs (4)
72public static bool AreRefKindsEquivalent(RefKind rk1, RefKind rk2, bool distinguishRefFromOut) 76: (rk1 == RefKind.None) == (rk2 == RefKind.None);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\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, 396refKind: RefKind.None, 468RefKind refKind,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractMethodSymbol.cs (1)
45public abstract RefKind RefKind { get; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedMethodSymbol.cs (1)
37public override RefKind RefKind => _constructedFrom.RefKind;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructorSymbol.cs (1)
27refKind: RefKind.None,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConversionSymbol.cs (1)
31refKind: RefKind.None,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationDestructorSymbol.cs (1)
18refKind: RefKind.None,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationFieldSymbol.cs (2)
84public RefKind RefKind => RefKind.None;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationMethodSymbol.cs (4)
33RefKind refKind, 86return RefKind == RefKind.Ref; 94return RefKind == RefKind.RefReadOnly; 98public override RefKind RefKind { get; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationOperatorSymbol.cs (1)
32refKind: RefKind.None,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationParameterSymbol.cs (2)
20RefKind refKind, 28public RefKind RefKind { get; } = refKind;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertySymbol.cs (4)
23RefKind refKind, 75public RefKind RefKind => refKind; 77public bool ReturnsByRef => refKind == RefKind.Ref; 79public bool ReturnsByRefReadonly => refKind == RefKind.RefReadOnly;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (5)
270if (parameter.RefKind != RefKind.Out && 292if (parameter.RefKind != RefKind.Out && 300refKind: RefKind.None, 330var refKind = parameter.RefKind; 334if (refKind == RefKind.Out)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
56refKind: RefKind.None,
Microsoft.Extensions.Logging.Generators (3)
LoggerMessageGenerator.Parser.cs (3)
364if (paramSymbol.RefKind == RefKind.In) 368else if (paramSymbol.RefKind == RefKind.Ref) 372else if (paramSymbol.RefKind == RefKind.Out)
Microsoft.Gen.Logging (4)
Parsing\Parser.cs (2)
544if (paramSymbol.RefKind == RefKind.In) 548else if (paramSymbol.RefKind != RefKind.None)
Parsing\Parser.TagProvider.cs (2)
99&& method.Parameters[0].RefKind == RefKind.None 100&& method.Parameters[1].RefKind == RefKind.None
Microsoft.Interop.ComInterfaceGenerator (1)
ComInterfaceGenerator.cs (1)
314RefKind = RefKind.Out,
Microsoft.Interop.LibraryImportGenerator (2)
Analyzers\ConvertToLibraryImportFixer.cs (1)
245editor.Generator.ParameterDeclaration("@return", editor.Generator.GetType(generatedDeclaration), refKind: RefKind.Out)
Analyzers\CustomMarshallerAttributeFixer.cs (1)
262gen.ParameterDeclaration("numElements", type: gen.TypeExpression(SpecialType.System_Int32), refKind: RefKind.Out),
Microsoft.Interop.SourceGeneration (40)
MarshallerShape.cs (2)
317&& m.Parameters[1].RefKind == RefKind.Out); 328&& m.Parameters[2].RefKind == RefKind.Out);
Marshalling\AttributedMarshallingModelGeneratorResolver.cs (4)
383if (info.RefKind == RefKind.Ref) 453private static RefKind CreateElementRefKind(RefKind refKind, ByValueContentsMarshalKind byValueContentsMarshalKind) 455if (refKind == RefKind.None)
Marshalling\BreakingChangeDetector.cs (2)
26if (info is { RefKind: RefKind.In or RefKind.RefReadOnlyParameter, MarshallingAttributeInfo: NativeMarshallingAttributeInfo(ManagedTypeInfo { DiagnosticFormattedName: TypeNames.ComVariantMarshaller }, _) }
Marshalling\ElementsMarshalling.cs (1)
605return context.ElementIndirectionLevel != 0 || info.ByValueContentsMarshalKind == ByValueContentsMarshalKind.Out || info.RefKind == RefKind.Out || info.IsNativeReturnPosition;
Marshalling\MarshallerHelpers.cs (27)
18public static RefKind GetRefKindForByValueContentsKind(this ByValueContentsMarshalKind byValue) 22ByValueContentsMarshalKind.Default => RefKind.None, 23ByValueContentsMarshalKind.In => RefKind.In, 24ByValueContentsMarshalKind.InOut => RefKind.Ref, 25ByValueContentsMarshalKind.Out => RefKind.Out, 107return context.SingleFrameSpansNativeContext && (!info.IsByRef || info.RefKind == RefKind.In || info.RefKind == RefKind.RefReadOnlyParameter); 317case RefKind.In: 318case RefKind.RefReadOnlyParameter: 320case RefKind.Ref: 322case RefKind.Out: 339case RefKind.In: 340case RefKind.RefReadOnlyParameter: 342case RefKind.Ref: 344case RefKind.Out: 382if (!(info.RefKind is RefKind.Out 387if (countInfo.ElementInfo.IsByRef && countInfo.ElementInfo.RefKind is RefKind.Out) 417if (typeInfo.ScopedKind != ScopedKind.None && typeInfo.RefKind != RefKind.Out) 426case RefKind.In: 429case RefKind.Ref: 433case RefKind.Out: 436case RefKind.RefReadOnlyParameter: 457RefKind.None => default, 458RefKind.In => Token(SyntaxKind.InKeyword), 459RefKind.Ref => Token(SyntaxKind.RefKeyword), 460RefKind.Out => Token(SyntaxKind.OutKeyword), 461RefKind.RefReadOnlyParameter => Token(SyntaxKind.RefKeyword),
TypePositionInfo.cs (3)
65public RefKind RefKind { get; init; } = RefKind.None; 67public bool IsByRef => RefKind != RefKind.None;
VariableDeclarations.cs (1)
27if (info.RefKind == RefKind.Out)
Microsoft.VisualStudio.LanguageServices (7)
ChangeSignature\ChangeSignatureDialogViewModel.ParameterViewModels.cs (4)
192case RefKind.Out: 194case RefKind.Ref: 196case RefKind.In: 198case RefKind.RefReadOnlyParameter:
Progression\GraphBuilder.cs (2)
316node.SetValue<bool>(Properties.IsByReference, parameterSymbol.RefKind == RefKind.Ref); 317node.SetValue<bool>(Properties.IsOut, parameterSymbol.RefKind == RefKind.Out);
Venus\ContainedLanguageCodeSupport.cs (1)
195refKind: RefKind.None,
Microsoft.VisualStudio.LanguageServices.CSharp (4)
CodeModel\CSharpCodeModelService_Prototype.cs (2)
528if (parameter.RefKind == RefKind.Ref) 532else if (parameter.RefKind == RefKind.Out)
ObjectBrowser\DescriptionBuilder.cs (2)
436if (current.RefKind == RefKind.Ref) 440else if (current.RefKind == RefKind.Out)
Microsoft.VisualStudio.LanguageServices.UnitTests (7)
ChangeSignature\ChangeSignatureViewModelTests.vb (7)
298Dim includedInTest = {RefKind.None, RefKind.Ref, RefKind.Out, RefKind.In, RefKind.RefReadOnly, RefKind.RefReadOnlyParameter} 299Assert.Equal(includedInTest, EnumUtilities.GetValues(Of RefKind)())
Microsoft.VisualStudio.LanguageServices.VisualBasic (1)
ObjectBrowser\DescriptionBuilder.vb (1)
389If current.RefKind = RefKind.Ref Then