3147 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)
1120/// * <see cref="RefKind.Out"/> is passed as the returnRefKind. 1128RefKind returnRefKind, 1130ImmutableArray<RefKind> parameterRefKinds, 1139RefKind returnRefKind, 1141ImmutableArray<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)
471if (p.RefKind == RefKind.Ref &&
Operations\ControlFlowGraphBuilder.cs (2)
4663return new SimpleAssignmentOperation(isRef: local.RefKind != RefKind.None, 6825Debug.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)
762methodSymbol.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)
486if (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)
306RefKind GetRefKindOfArgument(SyntaxNode node);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
275PooledArrayBuilder<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)
324internal 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 (1821)
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 (126)
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) 363if (indexerAccess.Indexer.RefKind != RefKind.None) 386var useSetAccessor = coreValueKind == BindValueKind.Assignable && indexerAccess.Indexer.RefKind != RefKind.Ref; 395ArrayBuilder<RefKind>? refKindsBuilderOpt; 398refKindsBuilderOpt = ArrayBuilder<RefKind>.GetInstance(accessorForDefaultArguments.ParameterCount); 1037if (localSymbol.RefKind == RefKind.RefReadOnly || 1038(localSymbol.RefKind == RefKind.None && !localSymbol.IsWritableVariable)) 1046if (localSymbol.RefKind == RefKind.None) 1078if (localSymbol.RefKind == RefKind.None) 1119if (parameterSymbol.RefKind is RefKind.In or RefKind.RefReadOnlyParameter && RequiresAssignableVariable(valueKind)) 1124else if (parameterSymbol.RefKind == RefKind.None && RequiresRefAssignableVariable(valueKind)) 1130Debug.Assert(parameterSymbol.RefKind != RefKind.None || !RequiresRefAssignableVariable(valueKind)); 1134if (parameterSymbol.RefKind == RefKind.None && 1138Debug.Assert(backingField.RefKind == RefKind.None); 1143Debug.Assert(backingField.RefKind == RefKind.None); 1233{ RefKind: RefKind.Out, UseUpdatedEscapeRules: true } => SafeContext.ReturnOnly, 1245{ RefKind: RefKind.None } => SafeContext.CurrentMethod, 1247{ HasUnscopedRefAttribute: true, RefKind: RefKind.Out } => SafeContext.ReturnOnly, 1280Debug.Assert(parameterSymbol.RefKind == RefKind.None || isRefScoped || refSafeToEscape.IsReturnOnly); 1330if ((fieldSymbol.RefKind == RefKind.None ? RequiresAssignableVariable(valueKind) : RequiresRefAssignableVariable(valueKind)) && 1342case RefKind.None: 1344case RefKind.Ref: 1346case RefKind.RefReadOnly: 1367case RefKind.None: 1370case RefKind.Ref: 1371case RefKind.RefReadOnly: 1382case RefKind.None: 1384case RefKind.Ref: 1385case RefKind.RefReadOnly: 1485if (fieldSymbol.RefKind != RefKind.None) 1509if (fieldSymbol.RefKind != RefKind.None) 1645if (RequiresVariable(valueKind) && methodSymbol.RefKind == RefKind.None) 1660if (RequiresAssignableVariable(valueKind) && methodSymbol.RefKind == RefKind.RefReadOnly) 1691propertySymbol.RefKind == RefKind.None) 1715if (RequiresAssignableVariable(valueKind) && propertySymbol.RefKind == RefKind.RefReadOnly) 1721var requiresSet = RequiresAssignableVariable(valueKind) && propertySymbol.RefKind == RefKind.None; 1790var requiresGet = !RequiresAssignmentOnly(valueKind) || propertySymbol.RefKind != RefKind.None; 1963ImmutableArray<RefKind> argRefKindsOpt, 2052ImmutableArray<RefKind> argRefKindsOpt, 2082(param is { RefKind: not RefKind.None, Type: { } type } && type.IsRefLikeOrAllowsRefLikeType())) && 2117ImmutableArray<RefKind> argRefKindsOpt, 2174var valid = effectiveRefKind != RefKind.None && isRefEscape ? 2210ImmutableArray<RefKind> argRefKindsOpt, 2243(param is { RefKind: not RefKind.None, Type: { } type } && type.IsRefLikeOrAllowsRefLikeType())) && 2283ImmutableArray<RefKind> argRefKindsOpt, 2344var refKind = parameter?.RefKind ?? RefKind.None; 2349if (refKind == RefKind.None && 2350parameter?.RefKind is RefKind.In or RefKind.RefReadOnlyParameter) 2385if (getArgument.RefKind == RefKind.Ref) 2391if (setArgument.RefKind == RefKind.Ref) 2407return new EscapeArgument(parameter: null, receiver, RefKind.None); 2410var refKind = RefKind.None; 2430ImmutableArray<RefKind> argRefKindsOpt, 2437var refKind = argRefKindsOpt.IsDefault ? RefKind.None : argRefKindsOpt[argIndex]; 2440if (refKind == RefKind.Ref && mixableArguments is not null) 2460ImmutableArray<RefKind> argRefKindsOpt, 2530ImmutableArray<RefKind> argRefKindsOpt, 2585ImmutableArray<RefKind> argRefKindsOpt, 2615if (refKind != RefKind.None) 2628if (parameter.Type.IsRefLikeOrAllowsRefLikeType() && parameter.RefKind != RefKind.Out && GetParameterValEscapeLevel(parameter) is { } valEscapeLevel) 2635if (parameter.RefKind != RefKind.None && GetParameterRefEscapeLevel(parameter) is { } refEscapeLevel) 2661ImmutableArray<RefKind> argRefKindsOpt, 2704if (parameter.RefKind != RefKind.None) 2775ImmutableArray<RefKind> argRefKindsOpt, 2875ImmutableArray<RefKind> argRefKindsOpt, 2992Debug.Assert(underlyingParameter.RefKind != RefKind.Out); // Shouldn't get here for a constructor 3002public override RefKind RefKind 3006if (_underlyingParameter.RefKind is not RefKind.None and var underlyingRefKind) 3013return RefKind.None; 3018return RefKind.Ref; 3226Debug.Assert(field.RefKind == RefKind.None ? RequiresAssignableVariable(kind) : RequiresRefAssignableVariable(kind)); 3423if (methodSymbol.RefKind == RefKind.None) 3445if (methodSymbol.RefKind == RefKind.None) 3506if (methodSymbol.RefKind == RefKind.None) 3533Debug.Assert(GetInlineArrayAccessEquivalentSignatureMethod(elementAccess, out _, out _).RefKind == RefKind.None); 3538ImmutableArray<RefKind> refKinds; 3541Debug.Assert(equivalentSignatureMethod.RefKind != RefKind.None); 3585conversion.Conversion.Method.RefKind == RefKind.None)); 3592unaryMethod.RefKind == RefKind.None)); 3599binaryMethod.RefKind == RefKind.None)); 3605logicalOperator.LogicalOperator.RefKind == RefKind.None)); 3612compoundMethod.RefKind == RefKind.None)); 3740if (methodSymbol.RefKind == RefKind.None) 3766if (indexerSymbol.RefKind == RefKind.None) 3797if (indexerSymbol.RefKind == RefKind.None) 3823if (methodSymbol.RefKind == RefKind.None) 3854Debug.Assert(GetInlineArrayAccessEquivalentSignatureMethod(elementAccess, out _, out _).RefKind == RefKind.None); 3859ImmutableArray<RefKind> refKinds; 3862Debug.Assert(equivalentSignatureMethod.RefKind != RefKind.None); 3884if (signature.RefKind == RefKind.None) 3908if (propertySymbol.RefKind == RefKind.None) 3955conversion.Conversion.Method.RefKind == RefKind.None); 3962unaryMethod.RefKind == RefKind.None)); 3969binaryMethod.RefKind == RefKind.None)); 3975logicalOperator.LogicalOperator.RefKind == RefKind.None)); 3982compoundMethod.RefKind == RefKind.None)); 4226ImmutableArray<RefKind> refKinds; 4339ImmutableArray<RefKind> refKinds; 4539if (constructMethod is not { Parameters: [{ RefKind: RefKind.None } parameter] }) 4674var accessorKind = property.RefKind == RefKind.None ? AccessorKind.Set : AccessorKind.Get; 4959ImmutableArray<RefKind> refKinds; 5113ImmutableArray<RefKind> refKinds; 5433private SignatureOnlyMethodSymbol GetInlineArrayAccessEquivalentSignatureMethod(BoundInlineArrayAccess elementAccess, out ImmutableArray<BoundExpression> arguments, out ImmutableArray<RefKind> refKinds) 5435RefKind resultRefKind; 5436RefKind parameterRefKind; 5447resultRefKind = RefKind.None; 5448parameterRefKind = RefKind.None; 5452resultRefKind = elementAccess.GetItemOrSliceHelper is WellKnownMember.System_ReadOnlySpan_T__get_Item ? RefKind.In : RefKind.Ref; 5461resultRefKind = RefKind.None; 5462parameterRefKind = elementAccess.GetItemOrSliceHelper is WellKnownMember.System_ReadOnlySpan_T__Slice_Int_Int ? RefKind.In : RefKind.Ref; 5495private SignatureOnlyMethodSymbol GetInlineArrayConversionEquivalentSignatureMethod(BoundConversion conversion, out ImmutableArray<BoundExpression> arguments, out ImmutableArray<RefKind> refKinds) 5501private SignatureOnlyMethodSymbol GetInlineArrayConversionEquivalentSignatureMethod(BoundExpression inlineArray, TypeSymbol resultType, out ImmutableArray<BoundExpression> arguments, out ImmutableArray<RefKind> refKinds) 5507RefKind parameterRefKind = resultType.OriginalDefinition.Equals(_compilation.GetWellKnownType(WellKnownType.System_ReadOnlySpan_T), TypeCompareKind.AllIgnoreOptions) ? RefKind.In : RefKind.Ref; 5522RefKind.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, 1933private bool IsBadLocalOrParameterCapture(Symbol symbol, TypeSymbol type, RefKind refKind) 1935if (refKind != RefKind.None || type.IsRestrictedType()) 2059if (localSymbol.RefKind == RefKind.None && type.IsRestrictedType(ignoreSpanLikeTypes: true)) 2099if (parameter.RefKind != RefKind.None) 2119(parameter.RefKind != RefKind.None || parameter.Type.IsRestrictedType()) && 2122if (parameter.RefKind != RefKind.None) 2136else if (primaryCtor is { ThisParameter.RefKind: not RefKind.None } && 2497if (thisSymbol is not null && thisSymbol.ContainingSymbol != ContainingMemberOrLambda && thisSymbol.RefKind != RefKind.None) 3051RefKind origRefKind = argumentSyntax.RefOrOutKeyword.Kind().GetRefKind(); 3055RefKind refKind = origRefKind == RefKind.None || RefMustBeObeyed(isDelegateCreation, argumentSyntax) ? origRefKind : RefKind.None; 3068if (!hadError && isDelegateCreation && origRefKind != RefKind.None && result.Arguments.Count == 1) 3075var requiredValueKind = origRefKind == RefKind.In ? BindValueKind.ReadonlyRef : BindValueKind.RefOrOut; 3087private BoundExpression BindArgumentValue(BindingDiagnosticBag diagnostics, ArgumentSyntax argumentSyntax, bool allowArglist, RefKind refKind) 3286RefKind refKind) 3294if (refKind != RefKind.None) 3304result.RefKinds.Add(RefKind.None); 3352private BoundExpression BindArgumentExpression(BindingDiagnosticBag diagnostics, ExpressionSyntax argumentExpression, RefKind refKind, bool allowArglist) 3355refKind == RefKind.None ? 3357refKind == RefKind.In ? 3408var argRefKind = analyzedArguments.RefKind(arg); 3414if (argRefKind is RefKind.None or RefKind.In && 3415getCorrespondingParameter(in result, parameters, arg).RefKind == RefKind.RefReadOnlyParameter) 3426if (argRefKind == RefKind.Ref) 3428if (getCorrespondingParameter(in result, parameters, arg).RefKind == RefKind.In) 3438else if (argRefKind == RefKind.None && 3439getCorrespondingParameter(in result, parameters, arg).RefKind == RefKind.RefReadOnlyParameter) 3791var argumentRefKindsBuilder = ArrayBuilder<RefKind>.GetInstance(handlerArgumentIndexes.Length); 3801RefKind refKind; 3807refKind = RefKind.None; 3885argumentRefKindsBuilder.Add(refKind == RefKind.RefReadOnlyParameter ? RefKind.In : refKind); 4979if (analyzedArguments.RefKind(i) is (RefKind.Ref or RefKind.Out)) 5496ArrayBuilder<RefKind> refKinds, 5689var rhsExpr = initializer.Right.CheckAndUnwrapRefExpression(diagnostics, out RefKind refKind); 5690bool isRef = refKind == RefKind.Ref; 5863ImmutableArray<RefKind> argumentRefKindsOpt = default; 8212extensionMethodArguments.RefKinds.Add(RefKind.None); 8346RefKind returnRefKind, 8608fieldSymbol.RefKind != RefKind.None) 9570RefKind refKind = analyzedArguments.RefKind(i); 9571if (refKind != RefKind.None) 9670default(ImmutableArray<RefKind>), 9788ImmutableArray<RefKind> argumentRefKinds = analyzedArguments.RefKinds.ToImmutableOrNull(); 10039original.Parameters[0] is { Type.SpecialType: SpecialType.System_Int32, RefKind: RefKind.None }) 10137original.Parameters[0] is { Type.SpecialType: SpecialType.System_Int32, RefKind: RefKind.None } && 10138original.Parameters[1] is { Type.SpecialType: SpecialType.System_Int32, RefKind: RefKind.None }; 10201getMethod.RefKind == RefKind.None && 10244RefKind returnRefKind = default, 10265RefKind returnRefKind = default, 10292RefKind returnRefKind, 10313RefKind returnRefKind = default, 10383RefKind returnRefKind = default, 10798RefKind? returnRefKindOverride = null, 10805var returnRefKind = returnRefKindOverride ?? methodSymbol.RefKind; 10823if (returnsVoid && returnRefKind != RefKind.None) 10837returnRefKind == RefKind.None && 10839(parameterRefKinds.IsDefault || parameterRefKinds.All(refKind => refKind == RefKind.None)) && 10873parameterRefKinds.IsDefault ? RefKind.None : parameterRefKinds[i],
Binder\Binder_InterpolatedString.cs (8)
560ImmutableArray<RefKind> additionalConstructorRefKinds = default) 580ImmutableArray<RefKind> additionalConstructorRefKinds = default) 606ImmutableArray<RefKind> additionalConstructorRefKinds) 639ImmutableArray<RefKind> additionalConstructorRefKinds) 715var refKindsBuilder = ArrayBuilder<RefKind>.GetInstance(constructorArgumentLength); 716refKindsBuilder.Add(RefKind.None); 717refKindsBuilder.Add(RefKind.None); 727refKindsBuilder.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; 4272var whenTrue = node.WhenTrue.CheckAndUnwrapRefExpression(diagnostics, out var whenTrueRefKind); 4273var whenFalse = node.WhenFalse.CheckAndUnwrapRefExpression(diagnostics, out var whenFalseRefKind); 4275var isRef = whenTrueRefKind == RefKind.Ref && whenFalseRefKind == RefKind.Ref; 4278if (whenFalseRefKind == RefKind.Ref) 4283if (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)
861internal BoundExpression BindInferredVariableInitializer(BindingDiagnosticBag diagnostics, RefKind refKind, EqualsValueClauseSyntax initializer, 910RefKind variableRefKind, 915RefKind expressionRefKind = RefKind.None; 917if (variableRefKind == RefKind.None) 920if (expressionRefKind == RefKind.Ref) 928valueKind = variableRefKind == RefKind.RefReadOnly 937else if (expressionRefKind != RefKind.Ref) 998if (localSymbol.RefKind != RefKind.None) 1064localSymbol.RefKind != RefKind.None ? ConversionForAssignmentFlags.RefAssignment : ConversionForAssignmentFlags.None); 1415var rhsExpr = node.Right.CheckAndUnwrapRefExpression(diagnostics, out var refKind); 1416var isRef = refKind == RefKind.Ref; 1445var lhsRefKind = boundLeft.GetRefKind(); 1446if (lhsRefKind is RefKind.Ref or RefKind.Out) 2143var delegateRefKind = delegateParameters[i].RefKind; 2144if (delegateRefKind != RefKind.None) 2184var lambdaRefKind = anonymousFunction.RefKind(i); 2186var delegateRefKind = delegateParameters[i].RefKind; 2198if (delegateRefKind == RefKind.None) 2966protected virtual TypeSymbol GetCurrentReturnType(out RefKind refKind) 2983refKind = RefKind.None; 2989var refKind = RefKind.None; 3007RefKind sigRefKind; 3018if (refKind != RefKind.None) 3030else if ((object)retType != null && (refKind != RefKind.None) != (sigRefKind != RefKind.None)) 3032var errorCode = refKind != RefKind.None 3130RefKind returnRefKind, 3140Debug.Assert(returnRefKind == RefKind.None); 3162if (returnRefKind != RefKind.None) 3178RefKind unusedRefKind; 3446internal BoundBlock CreateBlockFromExpression(CSharpSyntaxNode node, ImmutableArray<LocalSymbol> locals, RefKind refKind, BoundExpression expression, ExpressionSyntax expressionSyntax, BindingDiagnosticBag diagnostics) 3448RefKind returnRefKind; 3453if (IsInAsyncMethod() && refKind != RefKind.None) 3462if ((refKind != RefKind.None) != (returnRefKind != RefKind.None) && expression.Kind != BoundKind.ThrowExpression) 3464var errorCode = refKind != RefKind.None 3469statement = new BoundReturnStatement(syntax, RefKind.None, expression, @checked: CheckOverflowAtRuntime) { WasCompilerGenerated = true }; 3573RefKind refKind; 3589RefKind refKind; 3602return bodyBinder.CreateBlockFromExpression(body, bodyBinder.GetDeclaredLocalsForScope(body), RefKind.None, expression, body, diagnostics); 3605private BindValueKind GetRequiredReturnValueKind(RefKind refKind) 3608if (refKind != RefKind.None) 3610GetCurrentReturnType(out var sigRefKind); 3611requiredValueKind = sigRefKind == RefKind.Ref ? 3962argumentRefKindsOpt: 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)
492Debug.Assert(localSymbol.RefKind == RefKind.None || 506if (localSymbol.RefKind != RefKind.None) 523ValidateEscape(expr, SafeContext.ReturnOnly, node.RefKind != RefKind.None, _diagnostics); 1050ImmutableArray<RefKind> refKinds; 1078AddLocalScopes(local, refEscapeScope: local.RefKind == RefKind.None ? _localScopeDepth : collectionEscape, valEscapeScope: collectionEscape);
Binder\Semantics\Conversions\ConversionsBase.cs (5)
1485if (anonymousFunction.HasExplicitReturnType(out var refKind, out var returnType)) 1529if (delegateParameters[p].RefKind != RefKind.None) 1571if (delegateParameters[p].RefKind == RefKind.Out) 3415bool hasConversion(RefKind refKind, TypeWithAnnotations sourceType, TypeWithAnnotations destinationType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 3419case 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, 2421if ((sourceParam.Type.IsReferenceType || sourceParam.Type.IsFunctionPointer()) && sourceParam.RefKind == RefKind.None) 2431if ((sourceSignature.ReturnType.IsReferenceType || sourceSignature.ReturnType.IsFunctionPointer()) && sourceSignature.RefKind == RefKind.None) 2771if ((sourceParam.Type.IsReferenceType || sourceParam.Type.IsFunctionPointer()) && sourceParam.RefKind == RefKind.None) 2781if ((sourceSignature.ReturnType.IsReferenceType || sourceSignature.ReturnType.IsFunctionPointer()) && sourceSignature.RefKind == RefKind.None)
Binder\Semantics\OverloadResolution\OverloadResolution.cs (78)
144RefKind returnRefKind = default, 192RefKind returnRefKind = default, 433RefKind returnRefKind, 839RefKind? returnRefKind, 864else if (returnRefKind == RefKind.None) 2167var type1 = getParameterTypeAndRefKind(i, m1.Result, m1LeastOverriddenParameters, m1.Result.ParamsElementTypeOpt, out RefKind parameter1RefKind); 2169var type2 = getParameterTypeAndRefKind(i, m2.Result, m2LeastOverriddenParameters, m2.Result.ParamsElementTypeOpt, out RefKind parameter2RefKind); 2558static TypeSymbol getParameterTypeAndRefKind(int i, MemberAnalysisResult result, ImmutableArray<ParameterSymbol> parameters, TypeWithAnnotations paramsElementTypeOpt, out RefKind parameter1RefKind) 2629if (p1.RefKind == RefKind.None && isAcceptableRefMismatch(p2.RefKind, isInterpolatedStringHandlerConversion)) 2640else if (p2.RefKind == RefKind.None && isAcceptableRefMismatch(p1.RefKind, isInterpolatedStringHandlerConversion)) 2656static bool isAcceptableRefMismatch(RefKind refKind, bool isInterpolatedStringHandlerConversion) 2659RefKind.In or RefKind.RefReadOnlyParameter => true, 2660RefKind.Ref when isInterpolatedStringHandlerConversion => true, 2836RefKind refKind1, 2839RefKind refKind2, 2864Debug.Assert(refKind1 == RefKind.None || refKind1 == RefKind.Ref); 2865Debug.Assert(refKind2 == RefKind.None || refKind2 == RefKind.Ref); 2869if (refKind1 == RefKind.None) 2878else if (refKind1 == RefKind.Ref) 3778ArrayBuilder<RefKind> argumentRefKinds, 3784out ImmutableArray<RefKind> parameterRefKinds) 3800internal readonly ImmutableArray<RefKind> ParameterRefKinds; 3803internal EffectiveParameters(ImmutableArray<TypeWithAnnotations> types, ImmutableArray<RefKind> refKinds, int firstParamsElementIndex) 3817ArrayBuilder<RefKind> argumentRefKinds, 3832ImmutableArray<RefKind> parameterRefKinds = member.GetParameterRefKinds(); 3840ArrayBuilder<RefKind> refs = null; 3854RefKind argRefKind = hasAnyRefArg ? argumentRefKinds[arg] : RefKind.None; 3855RefKind paramRefKind = GetEffectiveParameterRefKind(parameter, argRefKind, options, binder, ref hasAnyRefOmittedArgument); 3859if (paramRefKind != RefKind.None) 3861refs = ArrayBuilder<RefKind>.GetInstance(arg, RefKind.None); 3871var refKinds = refs != null ? refs.ToImmutableAndFree() : default(ImmutableArray<RefKind>); 3875private static RefKind GetEffectiveParameterRefKind( 3877RefKind argRefKind, 3882var paramRefKind = parameter.RefKind; 3891if (paramRefKind == RefKind.In) 3893if (argRefKind == RefKind.None) 3895return RefKind.None; 3898if (argRefKind == RefKind.Ref && binder.Compilation.IsFeatureEnabled(MessageID.IDS_FeatureRefReadonlyParameters)) 3900return RefKind.Ref; 3903else if (paramRefKind == RefKind.RefReadOnlyParameter && argRefKind is RefKind.None or RefKind.Ref or RefKind.In) 3916if ((options & Options.AllowRefOmittedArguments) != 0 && paramRefKind == RefKind.Ref && argRefKind == RefKind.None && !binder.InAttributeArgument) 3919return RefKind.None; 3928internal static bool AreRefsCompatibleForMethodConversion(RefKind candidateMethodParameterRefKind, RefKind delegateParameterRefKind, CSharpCompilation compilation) 3938(RefKind.RefReadOnlyParameter, RefKind.Ref) or 3939(RefKind.RefReadOnlyParameter, RefKind.In) or 3940(RefKind.In, RefKind.RefReadOnlyParameter)) 3946(candidateMethodParameterRefKind, delegateParameterRefKind) is (RefKind.In, RefKind.Ref)) 3958ArrayBuilder<RefKind> argumentRefKinds, 3969ArrayBuilder<RefKind> argumentRefKinds, 3977var refs = ArrayBuilder<RefKind>.GetInstance(); 4007var argRefKind = hasAnyRefArg ? argumentRefKinds[arg] : RefKind.None; 4008var paramRefKind = GetEffectiveParameterRefKind(parameter, argRefKind, options, binder, ref hasAnyRefOmittedArgument); 4011if (paramRefKind != RefKind.None) 4017var refKinds = anyRef ? refs.ToImmutable() : default(ImmutableArray<RefKind>); 4444RefKind argumentRefKind = arguments.RefKind(argumentPosition); 4445RefKind parameterRefKind = parameters.ParameterRefKinds.IsDefault ? RefKind.None : parameters.ParameterRefKinds[argumentPosition]; 4450Debug.Assert(argumentRefKind == RefKind.None); 4451if (parameterRefKind == RefKind.Ref) 4465&& parameterRefKind == RefKind.Ref 4561RefKind argRefKind, 4563RefKind parRefKind, 4600Debug.Assert(argRefKind != RefKind.None); 4606if (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)) 779var returnType = DelegateReturnTypeWithAnnotations(invokeMethod, out RefKind refKind); 798refKind == CodeAnalysis.RefKind.None && 818if (lambdaSymbol.RefKind == CodeAnalysis.RefKind.RefReadOnly) 885ImmutableArray<RefKind> parameterRefKinds, 886RefKind refKind) 900var returnType = DelegateReturnTypeWithAnnotations(invokeMethod, out RefKind refKind); 933ImmutableArray<RefKind> parameterRefKinds) 935bool hasExplicitReturnType = HasExplicitReturnType(out var refKind, out var returnType); 990ImmutableArray<RefKind> parameterRefKinds, 992RefKind refKind) 1026public readonly ImmutableArray<RefKind> ParameterRefKinds; 1029public static readonly ReturnInferenceCacheKey Empty = new ReturnInferenceCacheKey(ImmutableArray<TypeWithAnnotations>.Empty, ImmutableArray<RefKind>.Empty, null); 1031private ReturnInferenceCacheKey(ImmutableArray<TypeWithAnnotations> parameterTypes, ImmutableArray<RefKind> parameterRefKinds, NamedTypeSymbol? taskLikeReturnTypeOpt) 1092out ImmutableArray<RefKind> parameterRefKinds, 1098parameterRefKinds = ImmutableArray<RefKind>.Empty; 1107var refKindsBuilder = ArrayBuilder<RefKind>.GetInstance(parameterCount); 1183?? rebind(ReallyInferReturnType(delegateType: null, ImmutableArray<TypeWithAnnotations>.Empty, ImmutableArray<RefKind>.Empty)); 1200ImmutableArray<RefKind> parameterRefKinds) 1203var refKind = inferredReturnType.RefKind; 1215refKind = CodeAnalysis.RefKind.None; 1428private readonly RefKind _returnRefKind; 1434private readonly ImmutableArray<RefKind> _parameterRefKinds; 1443RefKind returnRefKind, 1449ImmutableArray<RefKind> parameterRefKinds, 1474public override bool HasExplicitReturnType(out RefKind refKind, out TypeWithAnnotations returnType) 1533public override RefKind RefKind(int index) 1536return _parameterRefKinds.IsDefault ? Microsoft.CodeAnalysis.RefKind.None : _parameterRefKinds[index]; 1571statements[0] is BoundReturnStatement { RefKind: Microsoft.CodeAnalysis.RefKind.None, ExpressionOpt: BoundExpression expr })
CodeGen\CodeGenerator.cs (1)
169var slotConstraints = _method.RefKind == RefKind.None
CodeGen\CodeGenerator_HasHome.cs (17)
88((BoundParameter)expression).ParameterSymbol.RefKind is not (RefKind.In or RefKind.RefReadOnlyParameter); 94return !((CodeGenerator.IsStackLocal(local, stackLocalsOpt) && local.RefKind == RefKind.None) || 95(!IsAnyReadOnly(addressKind) && local.RefKind == RefKind.RefReadOnly)); 98var methodRefKind = ((BoundCall)expression).Method.RefKind; 99return methodRefKind == RefKind.Ref || 100(IsAnyReadOnly(addressKind) && methodRefKind == RefKind.RefReadOnly); 104var dupRefKind = ((BoundDup)expression).RefKind; 105return dupRefKind == RefKind.Ref || 106(IsAnyReadOnly(addressKind) && dupRefKind == RefKind.RefReadOnly); 120var lhsRefKind = assignment.Left.GetRefKind(); 121return lhsRefKind == RefKind.Ref || 122(IsAnyReadOnly(addressKind) && lhsRefKind is RefKind.RefReadOnly or RefKind.RefReadOnlyParameter); 188if (field.RefKind is RefKind.Ref) 211if (field.RefKind == RefKind.RefReadOnly) 216Debug.Assert(field.RefKind == RefKind.None);
CodeGen\EmitAddress.cs (11)
36Debug.Assert(((BoundDup)expression).RefKind != RefKind.None, "taking address of a stack value?"); 123var funcPtrRefKind = funcPtrInvocation.FunctionPointer.Signature.RefKind; 124if (funcPtrRefKind == RefKind.Ref || 125(IsAnyReadOnly(addressKind) && funcPtrRefKind == RefKind.RefReadOnly)) 179var methodRefKind = call.Method.RefKind; 180return methodRefKind == RefKind.Ref || 181(IsAnyReadOnly(addressKind) && methodRefKind == RefKind.RefReadOnly); 274if (local.RefKind != RefKind.None) 480if (parameterSymbol.RefKind == RefKind.None) 554field.RefKind == RefKind.None ? 558_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)
2226if (method.RefKind != RefKind.None) 4021RefKind returnRefKind, 4023ImmutableArray<RefKind> parameterRefKinds, 4056if (returnRefKind == RefKind.Out) 4196fields.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 (36)
1132VisitArguments(node.Arguments, default(ImmutableArray<RefKind>), null); 1293VisitRvalue(node.InitializerOpt, isKnownToBeAnLvalue: node.LocalSymbol.RefKind != RefKind.None); 1296if (node.LocalSymbol.RefKind != RefKind.None) 1436WriteArgument(receiverOpt, RefKind.Ref, method: null); 1442var thisRefKind = thisParameter.RefKind; 1516protected virtual void VisitArguments(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt, MethodSymbol method) 1523private void VisitArgumentsBeforeCall(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt) 1528RefKind refKind = GetRefKind(refKindsOpt, i); 1529if (refKind != RefKind.Out) 1531VisitRvalue(arguments[i], isKnownToBeAnLvalue: refKind != RefKind.None); 1543private void VisitArgumentsAfterCall(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt, MethodSymbol method) 1547RefKind refKind = GetRefKind(refKindsOpt, i); 1550case RefKind.None: 1551case RefKind.In: 1552case RefKind.RefReadOnlyParameter: 1555case RefKind.Ref: 1556case RefKind.Out: 1566protected static RefKind GetRefKind(ImmutableArray<RefKind> refKindsOpt, int index) 1568return refKindsOpt.IsDefault || refKindsOpt.Length <= index ? RefKind.None : refKindsOpt[index]; 1571protected virtual void WriteArgument(BoundExpression arg, RefKind refKind, MethodSymbol method) 2026VisitRvalue(node.ExpressionOpt, isKnownToBeAnLvalue: node.RefKind != RefKind.None); 2029if (node.RefKind != RefKind.None) 2139if (property.RefKind == RefKind.None) 2157var refKind = node.Left.Kind == BoundKind.BadExpression 2158? RefKind.Ref 2194if (property.RefKind == RefKind.None) 2213if (property.RefKind == RefKind.None) 2805if (property.RefKind == RefKind.None) 3302WriteArgument(operand, RefKind.Ref, method: null); 3488this.WriteArgument(operand, RefKind.Out, null); //Out because we know it will definitely be assigned. 3529VisitArguments(node.Arguments, default(ImmutableArray<RefKind>), node.Constructor); 3613VisitArguments(node.Arguments, default(ImmutableArray<RefKind>), node.AddMethod); 3619VisitArguments(node.Arguments, default(ImmutableArray<RefKind>), node.AddMethod); 3627VisitArguments(node.Arguments, default(ImmutableArray<RefKind>), method: null); 3709property.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 (20)
349NoteWrite(parameter, value: null, read: true, isRef: parameter.RefKind != RefKind.None); 859write: field.RefKind == RefKind.None || isRef); 971write: field.RefKind == RefKind.None || isRef); 1234((ParameterSymbol)symbol).RefKind == RefKind.Out) 1334if (fieldSymbol.RefKind != RefKind.None) 1518if (!isRef && node is BoundFieldAccess { FieldSymbol.RefKind: not RefKind.None } fieldAccess) 1571if (local.LocalSymbol.RefKind != RefKind.None && !isRef) 1622if (isRef && param.RefKind == RefKind.Out) 1640write: field.RefKind == RefKind.None || isRef); 1814if (parameter.RefKind != RefKind.Out) 1826if (thisParameter.RefKind != RefKind.Out) 1849if (current is not MethodSymbol && parameter.RefKind == RefKind.Out) 1879if (parameter.RefKind == RefKind.Out && !(this.CurrentSymbol is MethodSymbol currentMethod && currentMethod.IsAsync)) // out parameters not allowed in async 1887NoteWrite(parameter, value: null, read: true, isRef: parameter.RefKind != RefKind.None); 1945if (!parameter.IsThis && parameter.RefKind != RefKind.Out && parameter.ContainingSymbol is SynthesizedPrimaryConstructor primaryCtor) 1957if (parameter.RefKind != RefKind.None) 2567protected override void WriteArgument(BoundExpression arg, RefKind refKind, MethodSymbol method) 2569if (refKind == RefKind.Ref) 2583if (refKind != RefKind.None && ((object)method == null || method.IsExtern) && arg.Type is TypeSymbol type) 2771NoteWrite(iterationVariable, null, read: true, isRef: iterationVariable.RefKind != RefKind.None);
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)
1255var refKind = parameter.RefKind; 1256if (refKind != RefKind.Out && refKind != RefKind.Ref) 2370RefKind refKind, 2380if (refKind == RefKind.Ref) 2383return AreParameterAnnotationsCompatible(RefKind.None, overriddenType, overriddenAnnotations, overridingType, overridingAnnotations, forRef: true) && 2384AreParameterAnnotationsCompatible(RefKind.Out, overriddenType, overriddenAnnotations, overridingType, overridingAnnotations); 2387if (refKind is RefKind.None or RefKind.In or RefKind.RefReadOnlyParameter) 2417if (refKind == RefKind.Out) 2822if (parameter.RefKind != RefKind.Out) 2895if (node.RefKind == RefKind.None && 2904if (node.RefKind == RefKind.None) 6220var refKind = GetRefKind(node.ArgumentRefKindsOpt, 0); 6278ImmutableArray<RefKind> refKindsOpt = node.ArgumentRefKindsOpt; 6708protected override void VisitArguments(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt, MethodSymbol method) 6717ImmutableArray<RefKind> refKindsOpt, 6730ImmutableArray<RefKind> refKindsOpt, 6745ImmutableArray<RefKind> refKindsOpt, 6766ImmutableArray<RefKind> refKindsOpt, 6807ImmutableArray<RefKind> refKindsOpt, 6977ImmutableArray<RefKind> refKindsOpt, 6995static void expandParamsCollection(ref ImmutableArray<BoundExpression> arguments, ref ImmutableArray<RefKind> refKindsOpt, ImmutableArray<ParameterSymbol> parametersOpt, ref ImmutableArray<int> argsToParamsOpt, ref BitVector defaultArguments) 7055var refKindsBuilder = ArrayBuilder<RefKind>.GetInstance(refKindsOpt.Length + elements.Length - 1); 7057refKindsBuilder.AddMany(RefKind.None, elements.Length); 7218ImmutableArray<RefKind> refKindsOpt, 7279private VisitResult VisitArgumentEvaluate(BoundExpression argument, RefKind refKind, FlowAnalysisAnnotations annotations) 7291private VisitResult VisitArgumentEvaluateEpilogue(BoundExpression argument, RefKind refKind, FlowAnalysisAnnotations annotations) 7297case RefKind.Ref: 7300case RefKind.None: 7301case RefKind.In: 7323case RefKind.Out: 7346RefKind refKind, 7361case RefKind.None: 7362case RefKind.In: 7400case RefKind.Ref: 7420case RefKind.Out: 7483RefKind refKind, 7496case RefKind.None: 7497case RefKind.In: 7503case RefKind.Ref: 7530case RefKind.Out: 7736ImmutableArray<RefKind> refKindsOpt) 7747RefKind refKind = GetRefKind(refKindsOpt, i); 7750if (refKind == RefKind.None) 7818ImmutableArray<RefKind> argumentRefKindsOpt, 7827var refKinds = ArrayBuilder<RefKind>.GetInstance(); 7848parameterRefKinds: out ImmutableArray<RefKind> parameterRefKinds); 10087case BoundLocal { LocalSymbol.RefKind: RefKind.None }: 10088case BoundParameter { ParameterSymbol: { RefKind: RefKind.None } parameter } when 11995TypeWithAnnotations elementType = InMethodBinder.GetIteratorElementTypeFromReturnType(compilation, RefKind.None, 12035VisitArguments(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)
921public BoundDup(SyntaxNode syntax, RefKind refKind, TypeSymbol? type, bool hasErrors) 927public BoundDup(SyntaxNode syntax, RefKind refKind, TypeSymbol? type) 933public RefKind RefKind { get; } 938public BoundDup Update(RefKind refKind, TypeSymbol? type) 1446public BoundFunctionPointerInvocation(SyntaxNode syntax, BoundExpression invokedExpression, ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> argumentRefKindsOpt, LookupResultKind resultKind, TypeSymbol type, bool hasErrors = false) 1463public ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 1469public BoundFunctionPointerInvocation Update(BoundExpression invokedExpression, ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> argumentRefKindsOpt, LookupResultKind resultKind, TypeSymbol type) 3064public BoundArgListOperator(SyntaxNode syntax, ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> argumentRefKindsOpt, TypeSymbol? type, bool hasErrors = false) 3076public ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 3081public BoundArgListOperator Update(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> argumentRefKindsOpt, TypeSymbol? type) 3570public BoundReturnStatement(SyntaxNode syntax, RefKind refKind, BoundExpression? expressionOpt, bool @checked, bool hasErrors = false) 3578public RefKind RefKind { get; } 3585public BoundReturnStatement Update(RefKind refKind, BoundExpression? expressionOpt, bool @checked) 5894public BoundDynamicInvocation(SyntaxNode syntax, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type, bool hasErrors = false) 5910public ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 5916public BoundDynamicInvocation Update(ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<MethodSymbol> applicableMethods, BoundExpression expression, ImmutableArray<BoundExpression> arguments, TypeSymbol type) 6144public 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) 6173public ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 6185public 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) 6283public BoundUnconvertedObjectCreationExpression(SyntaxNode syntax, ImmutableArray<BoundExpression> arguments, ImmutableArray<(string Name, Location Location)?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, InitializerExpressionSyntax? initializerOpt, Binder binder, bool hasErrors = false) 6300public ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 6307public BoundUnconvertedObjectCreationExpression Update(ImmutableArray<BoundExpression> arguments, ImmutableArray<(string Name, Location Location)?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, InitializerExpressionSyntax? initializerOpt, Binder binder) 6342public 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) 6368public override ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 6379public 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) 6622public 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) 6643public override ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 6651public BoundDynamicObjectCreationExpression Update(string name, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, BoundObjectInitializerExpressionBase? initializerExpressionOpt, ImmutableArray<MethodSymbol> applicableMethods, bool wasTargetTyped, TypeSymbol type) 6744public 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) 6768public ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 6779public 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) 7412public 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) 7439public ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 7449public 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) 7553public BoundDynamicIndexerAccess(SyntaxNode syntax, BoundExpression receiver, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<PropertySymbol> applicableIndexers, TypeSymbol type, bool hasErrors = false) 7573public ImmutableArray<RefKind> ArgumentRefKindsOpt { get; } 7579public 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)
438refKinds: 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)
139ref ImmutableArray<RefKind> argumentRefKindsOpt, 284var thisRefKind = methodThisParameter.RefKind; 287if (thisRefKind != RefKind.None 290thisRefKind == RefKind.Ref ? CodeGenerator.AddressKind.Writeable : CodeGenerator.AddressKind.ReadOnlyStrict, 304if (argumentRefKindsOpt.IsDefault && thisRefKind != RefKind.None) 385ImmutableArray<RefKind> argRefKindsOpt = node.ArgumentRefKindsOpt; 443ImmutableArray<RefKind> argumentRefKinds, 530argumentRefKinds: default(ImmutableArray<RefKind>), 535private static bool IsSafeForReordering(BoundExpression expression, RefKind kind) 561return kind != RefKind.None; 659ImmutableArray<RefKind> argumentRefKindsOpt, 679RefKind refKind; 691refKind = rewrittenReceiver.Type.IsValueType || rewrittenReceiver.Type.Kind == SymbolKind.TypeParameter ? RefKind.Ref : RefKind.None; 697refKind = RefKind.None; 703if (refKind == RefKind.None && 710refKind = RefKind.Ref; 879RefKind argRefKind = argumentRefKindsOpt.RefKinds(argIndex); 880RefKind paramRefKind = parameters[paramIndex].RefKind; 882local = _factory.StoreToTemp(visitedArgument, out var store, refKind: paramRefKind is RefKind.In or RefKind.RefReadOnlyParameter ? RefKind.In : argRefKind); 951var intermediateRef = _factory.Local(_factory.SynthesizedLocal(receiverType, refKind: RefKind.Ref)); 1002ref ImmutableArray<RefKind> argumentRefKindsOpt, 1085ArrayBuilder<RefKind> refKinds = ArrayBuilder<RefKind>.GetInstance(parameters.Length, RefKind.None); 1155private static ImmutableArray<RefKind> GetEffectiveArgumentRefKinds(ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<ParameterSymbol> parameters) 1157ArrayBuilder<RefKind>? refKindsBuilder = null; 1160var paramRefKind = parameters[i].RefKind; 1161if (paramRefKind is RefKind.In or RefKind.RefReadOnlyParameter) 1163var argRefKind = argumentRefKindsOpt.IsDefault ? RefKind.None : argumentRefKindsOpt[i]; 1165refKindsBuilder[i] = argRefKind == RefKind.None ? RefKind.In : RefKindExtensions.StrictIn; 1167else if (paramRefKind == RefKind.Ref) 1169var argRefKind = argumentRefKindsOpt.IsDefault ? RefKind.None : argumentRefKindsOpt[i]; 1170if (argRefKind == RefKind.None) 1176refKindsBuilder[i] = RefKind.Ref; 1190static void fillRefKindsBuilder(ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<ParameterSymbol> parameters, [NotNull] ref ArrayBuilder<RefKind>? refKindsBuilder) 1197refKindsBuilder = ArrayBuilder<RefKind>.GetInstance(parameters.Length); 1202refKindsBuilder = ArrayBuilder<RefKind>.GetInstance(parameters.Length, fillWithValue: RefKind.None); 1243private static ImmutableArray<RefKind> GetRefKindsOrNull(ArrayBuilder<RefKind> refKinds) 1247if (refKind != RefKind.None) 1252return default(ImmutableArray<RefKind>); 1305ImmutableArray<RefKind> argumentRefKinds, 1309/* out */ ArrayBuilder<RefKind> refKinds, 1321RefKind argRefKind = argumentRefKinds.RefKinds(a); 1322RefKind paramRefKind = parameters[p].RefKind; 1330Debug.Assert(argRefKind == RefKind.None); 1346arg.rewriter.StoreArgumentToTempIfNecessary(arg.forceLambdaSpilling, arg.storesToTemps, element, RefKind.None, RefKind.None), 1363if (paramRefKind is RefKind.In or RefKind.RefReadOnlyParameter) 1365Debug.Assert(argRefKind is RefKind.None or RefKind.In or RefKind.Ref); 1366argRefKind = argRefKind == RefKind.None ? RefKind.In : RefKindExtensions.StrictIn; 1375private BoundExpression StoreArgumentToTempIfNecessary(bool forceLambdaSpilling, ArrayBuilder<BoundAssignmentOperator> storesToTemps, BoundExpression argument, RefKind argRefKind, RefKind paramRefKind) 1387refKind: paramRefKind is RefKind.In or RefKind.RefReadOnlyParameter 1388? (argRefKind == RefKind.None ? RefKind.In : RefKindExtensions.StrictIn) 1442default(ImmutableArray<RefKind>), 1602ArrayBuilder<RefKind> argsRefKindsBuilder, 1615RefKind paramRefKind = parameters[argIndex].RefKind; 1616RefKind argRefKind = argsRefKindsBuilder[argIndex]; 1620if (argRefKind != RefKind.None || paramRefKind != RefKind.Ref) 1628var localRefKind = ((BoundLocal)argument).LocalSymbol.RefKind; 1629if (localRefKind == RefKind.Ref) 1635Debug.Assert(localRefKind == RefKind.None); 1647argsRefKindsBuilder[argIndex] = RefKind.Ref;
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (1)
567var 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)
619RefKind collectionTempRefKind = RefKind.None; 707private delegate BoundStatement? GetForEachStatementAsForPreamble(LocalRewriter rewriter, SyntaxNode syntax, ForEachEnumeratorInfo enumeratorInfo, ref BoundExpression rewrittenExpression, out LocalSymbol? preambleLocal, out RefKind collectionTempRefKind); 746return static (LocalRewriter rewriter, SyntaxNode syntax, ForEachEnumeratorInfo enumeratorInfo, ref BoundExpression rewrittenExpression, out LocalSymbol? preambleLocal, out RefKind collectionTempRefKind) => 760collectionTempRefKind = 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)
46if (construction.ArgumentRefKindsOpt[i] == RefKind.Out) 51Debug.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)
500Debug.Assert(method.Parameters.AsSpan()[1..].All(static (p) => (p.IsOptional || p.IsParams) && p.RefKind is RefKind.None or RefKind.In or RefKind.RefReadOnlyParameter)); 507Debug.Assert(method.ParameterRefKinds.IsDefaultOrEmpty || method.ParameterRefKinds.All(static refKind => refKind is RefKind.In or RefKind.RefReadOnlyParameter or RefKind.None)); 512ImmutableArray<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)
313if (local.RefKind != RefKind.None) 558var sacrificialTemp = F.SynthesizedLocal(type, refKind: RefKind.Ref); 578RefKind refKind, 588BoundExpression expression = HoistExpression(array.Expression, awaitSyntaxOpt, syntaxOffset, RefKind.None, sideEffects, hoistedFields, ref needsSacrificialEvaluation); 592indices.Add(HoistExpression(index, awaitSyntaxOpt, syntaxOffset, RefKind.None, sideEffects, hoistedFields, ref needsSacrificialEvaluation)); 605if (refKind != RefKind.None || field.FieldSymbol.IsReadOnly) return expr; 609if (refKind == RefKind.None) 617isFieldOfStruct ? refKind : RefKind.None, sideEffects, hoistedFields, ref needsSacrificialEvaluation); 639if (refKind != RefKind.None && refKind != RefKind.In) 641Debug.Assert(refKind is RefKindExtensions.StrictIn or RefKind.Ref or RefKind.Out); 642Debug.Assert(call.Method.RefKind != RefKind.None); 646refKind = RefKind.None; 657if (refKind != RefKind.None && refKind != RefKind.RefReadOnly) 659Debug.Assert(refKind is RefKindExtensions.StrictIn or RefKind.Ref or RefKind.In); 664refKind = RefKind.None; 673if (refKind != RefKind.None)
Lowering\StateMachineRewriter\StateMachineFieldSymbol.cs (2)
62public override RefKind RefKind => RefKind.None;
Lowering\StateMachineRewriter\StateMachineRewriter.cs (2)
171if (local.RefKind != RefKind.None) 179Debug.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)
561Debug.Assert(CurrentFunction.RefKind == RefKind.None); 586RefKind refKind = RefKind.None, 626return SynthesizedParameterSymbol.Create(container, TypeWithAnnotations.Create(type), ordinal, RefKind.None, name); 749public BoundObjectCreationExpression New(MethodSymbol constructor, ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> argumentRefKinds) 858static ImmutableArray<RefKind> getArgumentRefKinds(MethodSymbol method, bool useStrictArgumentRefKinds) 862if (!result.IsDefaultOrEmpty && (result.Contains(RefKind.RefReadOnlyParameter) || 863(useStrictArgumentRefKinds && result.Contains(RefKind.In)))) 865var builder = ArrayBuilder<RefKind>.GetInstance(result.Length); 867foreach (var refKind in result) 871RefKind.In or RefKind.RefReadOnlyParameter when useStrictArgumentRefKinds => RefKindExtensions.StrictIn, 872RefKind.RefReadOnlyParameter => RefKind.In, 884public BoundCall Call(BoundExpression? receiver, MethodSymbol method, ImmutableArray<RefKind> refKinds, ImmutableArray<BoundExpression> args) 1633RefKind refKind = RefKind.None, 1650case RefKind.Out: 1651refKind = RefKind.Ref; 1654case RefKind.In: 1663Debug.Assert(argument.GetRefKind() != RefKind.In); 1664refKind = RefKind.None; 1668case RefKind.None: 1669case RefKind.Ref: 1700isRef: 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)
203if (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"/>. 566RefKind refKind1; 571RefKind refKind2; 796var refKind1 = param1.RefKind; 797var refKind2 = param2.RefKind; 809if ((refKind1 == RefKind.None) != (refKind2 == RefKind.None)) 818static bool areRefKindsCompatible(RefKindCompareMode refKindCompareMode, RefKind refKind1, RefKind refKind2) 827return (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\SourceAssemblySymbol.cs (1)
2743else if (field.RefKind != RefKind.None)
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)
2154var refKind1 = method1.Parameters[i].RefKind; 2155var refKind2 = method2.Parameters[i].RefKind; 3946if (methodParam.RefKind != RefKind.None) 3969methodParams[0].RefKind == RefKind.None && 4294RefKind.Out 4296RefKind.None, 4342RefKind.None 4344RefKind.None, 4391RefKind.None)), 4392RefKind.None, 4447RefKind.None, 4526RefKind.None, 4621RefKind.None, 4652RefKind.None, 4718RefKind.None 4720RefKind.None, 4919_ = fieldSyntax.Declaration.Type.SkipScoped(out _).SkipRefInField(out var refKind); 4928var 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)
57private readonly RefKind _refKind; 96RefKind refKind, 249_lazyRefCustomModifiers = _refKind != RefKind.None ? overriddenOrImplementedProperty.RefCustomModifiers : ImmutableArray<CustomModifier>.Empty; 268else if (_refKind == RefKind.RefReadOnly) 357public sealed override RefKind RefKind 865if (RefKind != RefKind.None && IsRequired) 889if (this.RefKind != RefKind.None) 926if (_refKind != RefKind.None) 953else if (RefKind != RefKind.None) 1025if (_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)
41RefKind.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)
39RefKind.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); 118public 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\SynthesizedHotReloadExceptionConstructorSymbol.cs (2)
19SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(stringType), ordinal: 0, RefKind.None), 20SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(intType), ordinal: 1, 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)
24public static RefKind GetRefKind(this ArgumentSyntax? argument) 27SyntaxKind.RefKeyword => RefKind.Ref, 28SyntaxKind.OutKeyword => RefKind.Out, 29SyntaxKind.InKeyword => RefKind.In, 30_ => RefKind.None, 82parameter.RefKind != RefKind.Out) 88parameter.RefKind != RefKind.Ref)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
374ReducedFrom.Parameters: [{ RefKind: RefKind.Ref }, ..],
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
595public RefKind GetRefKindOfArgument(SyntaxNode node)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (3)
687if (castedSymbol is not IFieldSymbol and not ILocalSymbol and not IParameterSymbol and not IParameterSymbol { RefKind: RefKind.Ref }) 1398if (operation is IPropertyReferenceOperation { Property.RefKind: not RefKind.Ref }) 1402if (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)
3834Assert.Equal(RefKind.RefReadOnly, interfaceMethod.RefKind); 3839Assert.Equal(RefKind.None, classMethod.RefKind); 3863Assert.Equal(RefKind.RefReadOnly, parentMethod.RefKind); 3868Assert.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)
814refKind: 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)
6899Assert.Equal(RefKind.Ref, lambdas[0].Parameters[0].RefKind); 6900Assert.Equal(RefKind.In, lambdas[1].Parameters[0].RefKind); 6901Assert.Equal(RefKind.Out, lambdas[2].Parameters[0].RefKind); 7113Assert.Equal(RefKind.None, lambdaParameter1.RefKind); 7118Assert.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) 10919VerifyParameterSymbol(parameters[0], "R x1", RefKind.None, ScopedKind.None); 10920VerifyParameterSymbol(parameters[1], "scoped R y1", RefKind.None, ScopedKind.ScopedValue); 10923VerifyParameterSymbol(parameters[0], "ref R x2", RefKind.Ref, ScopedKind.None); 10924VerifyParameterSymbol(parameters[1], "scoped ref R y2", RefKind.Ref, ScopedKind.ScopedRef); 10927VerifyParameterSymbol(parameters[0], "in R x3", RefKind.In, ScopedKind.None); 10928VerifyParameterSymbol(parameters[1], "scoped in R y3", RefKind.In, ScopedKind.ScopedRef); 10931VerifyParameterSymbol(parameters[0], "out R x4", RefKind.Out, useUpdatedEscapeRules ? ScopedKind.ScopedRef : ScopedKind.None); 10932VerifyParameterSymbol(parameters[1], "out R y4", RefKind.Out, ScopedKind.ScopedRef); 10968VerifyParameterSymbol(comp.GetMember<NamedTypeSymbol>("A").Constructors.Single(c => !c.IsImplicitlyDeclared).Parameters[0], "scoped ref T t", RefKind.Ref, ScopedKind.ScopedRef); 10969VerifyParameterSymbol(comp.GetMember<PropertySymbol>("A.this[]").GetMethod.Parameters[0], "scoped in System.Object o", RefKind.In, ScopedKind.ScopedRef); 11028VerifyParameterSymbol(localFunctions[0].Parameters[0], "R x1", RefKind.None, ScopedKind.None); 11029VerifyParameterSymbol(localFunctions[0].Parameters[1], "scoped R y1", RefKind.None, ScopedKind.ScopedValue); 11030VerifyParameterSymbol(localFunctions[1].Parameters[0], "ref System.Int32 x2", RefKind.Ref, ScopedKind.None); 11031VerifyParameterSymbol(localFunctions[1].Parameters[1], "scoped ref System.Int32 y2", RefKind.Ref, ScopedKind.ScopedRef); 11032VerifyParameterSymbol(localFunctions[2].Parameters[0], "in System.Int32 x3", RefKind.In, ScopedKind.None); 11033VerifyParameterSymbol(localFunctions[2].Parameters[1], "scoped in System.Int32 y3", RefKind.In, ScopedKind.ScopedRef); 11034VerifyParameterSymbol(localFunctions[3].Parameters[0], "out System.Int32 x4", RefKind.Out, useUpdatedEscapeRules ? ScopedKind.ScopedRef : ScopedKind.None); 11035VerifyParameterSymbol(localFunctions[3].Parameters[1], "out System.Int32 y4", RefKind.Out, ScopedKind.ScopedRef); 11036VerifyParameterSymbol(localFunctions[4].Parameters[0], "ref R x5", RefKind.Ref, ScopedKind.None); 11037VerifyParameterSymbol(localFunctions[4].Parameters[1], "scoped ref R y5", RefKind.Ref, ScopedKind.ScopedRef); 11038VerifyParameterSymbol(localFunctions[5].Parameters[0], "in R x6", RefKind.In, ScopedKind.None); 11039VerifyParameterSymbol(localFunctions[5].Parameters[1], "scoped in R y6", RefKind.In, ScopedKind.ScopedRef); 11040VerifyParameterSymbol(localFunctions[6].Parameters[0], "out R x7", RefKind.Out, useUpdatedEscapeRules ? ScopedKind.ScopedRef : ScopedKind.None); 11041VerifyParameterSymbol(localFunctions[6].Parameters[1], "out R y7", RefKind.Out, ScopedKind.ScopedRef); 11101verifyParameter(delegateTypesAndLambdas[0], 0, "R", "x1", RefKind.None, ScopedKind.None, false); 11102verifyParameter(delegateTypesAndLambdas[0], 1, "scoped R", "y1", RefKind.None, ScopedKind.ScopedValue, false); 11103verifyParameter(delegateTypesAndLambdas[1], 0, "ref System.Int32", "x2", RefKind.Ref, ScopedKind.None, false); 11104verifyParameter(delegateTypesAndLambdas[1], 1, "scoped ref System.Int32", "y2", RefKind.Ref, ScopedKind.ScopedRef, false); 11105verifyParameter(delegateTypesAndLambdas[2], 0, "in System.Int32", "x3", RefKind.In, ScopedKind.None, false); 11106verifyParameter(delegateTypesAndLambdas[2], 1, "scoped in System.Int32", "y3", RefKind.In, ScopedKind.ScopedRef, false); 11107verifyParameter(delegateTypesAndLambdas[3], 0, "out System.Int32", "x4", RefKind.Out, useUpdatedEscapeRules ? ScopedKind.ScopedRef : ScopedKind.None, false); 11108verifyParameter(delegateTypesAndLambdas[3], 1, "out System.Int32", "y4", RefKind.Out, ScopedKind.ScopedRef, false); 11109verifyParameter(delegateTypesAndLambdas[3], 2, "out System.Int32", "z4", RefKind.Out, ScopedKind.None, true); 11110verifyParameter(delegateTypesAndLambdas[4], 0, "ref R", "x5", RefKind.Ref, ScopedKind.None, false); 11111verifyParameter(delegateTypesAndLambdas[4], 1, "scoped ref R", "y5", RefKind.Ref, ScopedKind.ScopedRef, false); 11112verifyParameter(delegateTypesAndLambdas[5], 0, "in R", "x6", RefKind.In, ScopedKind.None, false); 11113verifyParameter(delegateTypesAndLambdas[5], 1, "scoped in R", "y6", RefKind.In, ScopedKind.ScopedRef, false); 11114verifyParameter(delegateTypesAndLambdas[6], 0, "out R", "x7", RefKind.Out, useUpdatedEscapeRules ? ScopedKind.ScopedRef : ScopedKind.None, false); 11115verifyParameter(delegateTypesAndLambdas[6], 1, "out R", "y7", RefKind.Out, ScopedKind.ScopedRef, false); 11118static void verifyParameter((NamedTypeSymbol, LambdaSymbol) delegateTypeAndLambda, int parameterIndex, string expectedDisplayType, string expectedDisplayName, RefKind expectedRefKind, ScopedKind expectedScope, bool expectedHasUnscopedRefAttribute) 11158VerifyParameterSymbol(comp.GetMember<NamedTypeSymbol>("D1").DelegateInvokeMethod.Parameters[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 11159VerifyParameterSymbol(comp.GetMember<NamedTypeSymbol>("D2").DelegateInvokeMethod.Parameters[0], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 11224VerifyParameterSymbol(methods[0].Parameters[0], "R", RefKind.None, ScopedKind.None); 11225VerifyParameterSymbol(methods[1].Parameters[0], "ref R", RefKind.Ref, ScopedKind.None); 11226VerifyParameterSymbol(methods[1].Parameters[1], "ref System.Int32", RefKind.Ref, ScopedKind.None); 11227VerifyParameterSymbol(methods[2].Parameters[0], "ref R", RefKind.Ref, ScopedKind.None); 11246VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F0").Parameters[0], "scoped R r", RefKind.None, ScopedKind.ScopedValue); 11247VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F3").Parameters[0], "scoped ref R r", RefKind.Ref, ScopedKind.ScopedRef); 11248VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F6").Parameters[0], "scoped in R r", RefKind.In, ScopedKind.ScopedRef); 11249VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F9").Parameters[0], "out R r", RefKind.Out, ScopedKind.ScopedRef); 11355VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F0").Parameters[0], "scoped s", RefKind.None, ScopedKind.None); 11356VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F1").Parameters[0], "scoped scoped s", RefKind.None, ScopedKind.ScopedValue); 11357VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F2").Parameters[0], "ref scoped s", RefKind.Ref, ScopedKind.None); 11358VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F4").Parameters[0], "scoped ref scoped s", RefKind.Ref, ScopedKind.ScopedRef); 11359VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F5").Parameters[0], "in scoped s", RefKind.In, ScopedKind.None); 11360VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F7").Parameters[0], "scoped in scoped s", RefKind.In, ScopedKind.ScopedRef); 11361VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F8").Parameters[0], "out scoped s", RefKind.Out, ScopedKind.ScopedRef); 11362VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.FA").Parameters[0], "out scoped s", RefKind.Out, ScopedKind.ScopedRef); 11391VerifyParameterSymbol(lambdas[0].Parameters[0], "R r1", RefKind.None, ScopedKind.None); 11392VerifyParameterSymbol(lambdas[1].Parameters[0], "R r2", RefKind.None, ScopedKind.None); 11437VerifyParameterSymbol(comp.GetMember<PEMethodSymbol>("A.F1").Parameters[0], "out System.Int32 i", RefKind.Out, ScopedKind.ScopedRef); 11471VerifyParameterSymbol(parameters[0], "R a", RefKind.None, ScopedKind.None); 11472VerifyParameterSymbol(parameters[1], "ref R b", RefKind.Ref, ScopedKind.None); 11473VerifyParameterSymbol(parameters[2], "in R c", RefKind.In, ScopedKind.None); 11474VerifyParameterSymbol(parameters[3], "out R d", RefKind.Out, ScopedKind.ScopedRef); 11508VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.ReturnRef").Parameters[0], "scoped ref R r", RefKind.Ref, ScopedKind.ScopedRef); 11549VerifyParameterSymbol(comp.GetMember<MethodSymbol>("C..ctor").ThisParameter, "C this", RefKind.None, ScopedKind.None); 11550VerifyParameterSymbol(comp.GetMember<MethodSymbol>("C.F1").ThisParameter, "C this", RefKind.None, ScopedKind.None); 11551VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1..ctor").ThisParameter, "out S1 this", RefKind.Out, ScopedKind.ScopedRef); 11552VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F1").ThisParameter, "ref S1 this", RefKind.Ref, ScopedKind.ScopedRef); 11553VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F2").ThisParameter, "in S1 this", RefKind.In, ScopedKind.ScopedRef); 11554VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R1..ctor").ThisParameter, "out R1 this", RefKind.Out, ScopedKind.ScopedRef); 11555VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R1.F1").ThisParameter, "ref R1 this", RefKind.Ref, ScopedKind.ScopedRef); 11556VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R1.F2").ThisParameter, "in R1 this", RefKind.In, ScopedKind.ScopedRef); 11557VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2..ctor").ThisParameter, "out S2 this", RefKind.Out, ScopedKind.ScopedRef); 11558VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F1").ThisParameter, "in S2 this", RefKind.In, ScopedKind.ScopedRef); 11559VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F2").ThisParameter, "in S2 this", RefKind.In, ScopedKind.ScopedRef); 11560VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R2..ctor").ThisParameter, "out R2 this", RefKind.Out, ScopedKind.ScopedRef); 11561VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R2.F1").ThisParameter, "in R2 this", RefKind.In, ScopedKind.ScopedRef); 11562VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R2.F2").ThisParameter, "in R2 this", RefKind.In, ScopedKind.ScopedRef); 11566VerifyParameterSymbol(thisParameter, "ref S1 this", RefKind.Ref, ScopedKind.ScopedRef); 11602VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Extensions.F0").Parameters[0], "R<System.Object> r", RefKind.None, ScopedKind.None); 11603VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Extensions.F1").Parameters[0], "scoped R<System.Object> r", RefKind.None, ScopedKind.ScopedValue); 11604VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Extensions.F2").Parameters[0], "scoped", RefKind.None, ScopedKind.None); 11605VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Extensions.F3").Parameters[0], "scoped ref T t", RefKind.Ref, ScopedKind.ScopedRef); 11623VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F2").Parameters[0], "params scoped System.Object[] args", RefKind.None, ScopedKind.ScopedValue); 11923verifyValueParameter(comp.GetMember<PropertySymbol>("R2.P2"), "R1 value", RefKind.None, ScopedKind.None); 11924verifyValueParameter(comp.GetMember<PropertySymbol>("R2.P3"), "R1 value", RefKind.None, ScopedKind.None); 11927static void verifyValueParameter(PropertySymbol property, string expectedDisplayString, RefKind expectedRefKind, ScopedKind expectedScope) 11950VerifyParameterSymbol(method.Parameters[0], "scoped R<System.Int32> x", RefKind.None, ScopedKind.ScopedValue); 11951VerifyParameterSymbol(method.Parameters[1], "scoped in System.Int32 y", RefKind.In, ScopedKind.ScopedRef); 11984VerifyParameterSymbol(method.Parameters[0], "scoped R x", RefKind.None, ScopedKind.ScopedValue); 11985VerifyParameterSymbol(method.Parameters[1], "scoped in System.Int32 y", RefKind.In, ScopedKind.ScopedRef); 11992private static void VerifyParameterSymbol(ParameterSymbol parameter, string expectedDisplayString, RefKind expectedRefKind, ScopedKind expectedScope, bool expectedHasUnscopedRefAttribute = false) 12005private static void VerifyParameterSymbol(IParameterSymbol parameter, string expectedDisplayString, RefKind expectedRefKind, ScopedKind expectedScope) 12064VerifyLocalSymbol(locals[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 12065VerifyLocalSymbol(locals[1], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 12066VerifyLocalSymbol(locals[2], "scoped ref readonly R r5", RefKind.RefReadOnly, ScopedKind.ScopedRef); 12067VerifyLocalSymbol(locals[3], "scoped R r11", RefKind.None, ScopedKind.ScopedValue); 12068VerifyLocalSymbol(locals[4], "scoped ref R r21", RefKind.Ref, ScopedKind.ScopedRef); 12069VerifyLocalSymbol(locals[5], "scoped ref readonly R r51", RefKind.RefReadOnly, ScopedKind.ScopedRef); 12138Assert.Equal(RefKind.None, f.RefKind); 12201VerifyLocalSymbol(locals[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 12202VerifyLocalSymbol(locals[1], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 12203VerifyLocalSymbol(locals[2], "scoped ref readonly R r5", RefKind.RefReadOnly, ScopedKind.ScopedRef); 12387VerifyLocalSymbol(locals[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 12388VerifyLocalSymbol(locals[1], "scoped R r2", RefKind.None, ScopedKind.ScopedValue); 12389VerifyLocalSymbol(locals[2], "scoped R r5", RefKind.None, ScopedKind.ScopedValue); 12390VerifyLocalSymbol(locals[3], "scoped R r11", RefKind.None, ScopedKind.ScopedValue); 12391VerifyLocalSymbol(locals[4], "scoped R r21", RefKind.None, ScopedKind.ScopedValue); 12392VerifyLocalSymbol(locals[5], "scoped R r51", RefKind.None, ScopedKind.ScopedValue); 12577Assert.Equal(RefKind.None, f.RefKind); 12798VerifyLocalSymbol(locals[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 12799VerifyLocalSymbol(locals[1], "scoped R r2", RefKind.None, ScopedKind.ScopedValue); 12800VerifyLocalSymbol(locals[2], "scoped R r5", RefKind.None, ScopedKind.ScopedValue); 12801VerifyLocalSymbol(locals[3], "scoped R r11", RefKind.None, ScopedKind.ScopedValue); 12802VerifyLocalSymbol(locals[4], "scoped R r21", RefKind.None, ScopedKind.ScopedValue); 12803VerifyLocalSymbol(locals[5], "scoped R r51", RefKind.None, ScopedKind.ScopedValue); 12984Assert.Equal(RefKind.None, f.RefKind); 13154VerifyLocalSymbol(locals[0], "scoped s1", RefKind.None, ScopedKind.None); 13155VerifyLocalSymbol(locals[1], "ref scoped s2", RefKind.Ref, ScopedKind.None); 13156VerifyLocalSymbol(locals[2], "ref scoped s3", RefKind.Ref, ScopedKind.None); 13157VerifyLocalSymbol(locals[3], "scoped scoped s4", RefKind.None, ScopedKind.ScopedValue); 13158VerifyLocalSymbol(locals[4], "scoped ref scoped s5", RefKind.Ref, ScopedKind.ScopedRef); 13159VerifyLocalSymbol(locals[5], "scoped ref scoped s6", RefKind.Ref, ScopedKind.ScopedRef); 13209VerifyLocalSymbol(locals[0], "scoped s1", RefKind.None, ScopedKind.None); 13210VerifyLocalSymbol(locals[1], "ref scoped s2", RefKind.Ref, ScopedKind.None); 13211VerifyLocalSymbol(locals[2], "ref scoped s3", RefKind.Ref, ScopedKind.None); 13212VerifyLocalSymbol(locals[3], "scoped scoped s4", RefKind.None, ScopedKind.ScopedValue); 13213VerifyLocalSymbol(locals[4], "scoped ref scoped s5", RefKind.Ref, ScopedKind.ScopedRef); 13214VerifyLocalSymbol(locals[5], "scoped ref scoped s6", RefKind.Ref, ScopedKind.ScopedRef); 13268VerifyLocalSymbol(locals[0], "scoped s1", RefKind.None, ScopedKind.None); 13269VerifyLocalSymbol(locals[2], "scoped s3", RefKind.None, ScopedKind.None); 13270VerifyLocalSymbol(locals[4], "scoped scoped s4", RefKind.None, ScopedKind.ScopedValue); 13271VerifyLocalSymbol(locals[6], "scoped scoped s6", RefKind.None, ScopedKind.ScopedValue); 13313VerifyLocalSymbol(locals[0], "scoped s1", RefKind.None, ScopedKind.None); 13314VerifyLocalSymbol(locals[1], "scoped s3", RefKind.None, ScopedKind.None); 13315VerifyLocalSymbol(locals[2], "scoped scoped s4", RefKind.None, ScopedKind.ScopedValue); 13316VerifyLocalSymbol(locals[3], "scoped scoped s6", RefKind.None, ScopedKind.ScopedValue); 13340VerifyLocalSymbol(locals[0], "System.Boolean scoped", RefKind.None, ScopedKind.None); 13365VerifyLocalSymbol(locals[0], "System.Boolean scoped", RefKind.None, ScopedKind.None); 13385VerifyLocalSymbol(locals[0], "System.Boolean scoped", RefKind.None, ScopedKind.None); 13407VerifyLocalSymbol(locals[0], "System.Boolean scoped", RefKind.None, ScopedKind.None); 13448VerifyLocalSymbol(locals[0], "scoped R<System.Int32> r1", RefKind.None, ScopedKind.ScopedValue); 13449VerifyLocalSymbol(locals[1], "scoped ref R<System.Int32> r3", RefKind.Ref, ScopedKind.ScopedRef); 13512VerifyLocalSymbol(locals[0], "scoped R<System.Int32> r1", RefKind.None, ScopedKind.ScopedValue); 13513VerifyLocalSymbol(locals[1], "scoped ref R<System.Int32> r3", RefKind.Ref, ScopedKind.ScopedRef); 13588VerifyLocalSymbol(locals[0], "scoped R<System.Int32> r1", RefKind.None, ScopedKind.ScopedValue); 13589VerifyLocalSymbol(locals[2], "scoped R<System.Int32> r3", RefKind.None, ScopedKind.ScopedValue); 13659VerifyLocalSymbol(locals[0], "scoped R<System.Int32> r1", RefKind.None, ScopedKind.ScopedValue); 13660VerifyLocalSymbol(locals[1], "scoped R<System.Int32> r3", RefKind.None, ScopedKind.ScopedValue); 13718VerifyLocalSymbol(locals[0], "ref System.Int32 a", RefKind.Ref, ScopedKind.None); 13719VerifyLocalSymbol(locals[1], "ref System.Int32 b", RefKind.Ref, ScopedKind.None); 14358VerifyLocalSymbol(locals[0], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 14359VerifyLocalSymbol(locals[1], "scoped ref R r5", RefKind.Ref, ScopedKind.ScopedRef); 14400VerifyLocalSymbol(locals[0], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 14401VerifyLocalSymbol(locals[1], "scoped ref R r5", RefKind.Ref, ScopedKind.ScopedRef); 14525VerifyLocalSymbol(locals[0], "R r11", RefKind.None, ScopedKind.None); 14526VerifyLocalSymbol(locals[1], "R r12", RefKind.None, ScopedKind.None); 14527VerifyLocalSymbol(locals[2], "scoped R r21", RefKind.None, ScopedKind.ScopedValue); 14528VerifyLocalSymbol(locals[3], "scoped R r22", RefKind.None, ScopedKind.ScopedValue); 14530VerifyLocalSymbol(locals[4], "ref R r31", RefKind.Ref, ScopedKind.None); 14531VerifyLocalSymbol(locals[5], "ref R r32", RefKind.Ref, ScopedKind.None); 14532VerifyLocalSymbol(locals[6], "scoped ref R r41", RefKind.Ref, ScopedKind.ScopedRef); 14533VerifyLocalSymbol(locals[7], "scoped ref R r42", RefKind.Ref, ScopedKind.ScopedRef); 14601VerifyLocalSymbol(locals[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 14602VerifyLocalSymbol(locals[1], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 14603VerifyLocalSymbol(locals[2], "scoped ref readonly R r5", RefKind.RefReadOnly, ScopedKind.ScopedRef); 14846VerifyLocalSymbol(locals[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 14847VerifyLocalSymbol(locals[1], "scoped R r2", RefKind.None, ScopedKind.ScopedValue); 14848VerifyLocalSymbol(locals[2], "scoped R r5", RefKind.None, ScopedKind.ScopedValue); 14849VerifyLocalSymbol(locals[3], "scoped R r11", RefKind.None, ScopedKind.ScopedValue); 14850VerifyLocalSymbol(locals[4], "scoped R r21", RefKind.None, ScopedKind.ScopedValue); 14851VerifyLocalSymbol(locals[5], "scoped R r51", RefKind.None, ScopedKind.ScopedValue); 15054VerifyLocalSymbol(locals[0], "scoped s1", RefKind.None, ScopedKind.None); 15055VerifyLocalSymbol(locals[1], "ref scoped s2", RefKind.Ref, ScopedKind.None); 15056VerifyLocalSymbol(locals[2], "ref scoped s3", RefKind.Ref, ScopedKind.None); 15057VerifyLocalSymbol(locals[3], "scoped scoped s4", RefKind.None, ScopedKind.ScopedValue); 15058VerifyLocalSymbol(locals[4], "scoped ref scoped s5", RefKind.Ref, ScopedKind.ScopedRef); 15059VerifyLocalSymbol(locals[5], "scoped ref scoped s6", RefKind.Ref, ScopedKind.ScopedRef); 15080VerifyLocalSymbol(locals[0], "System.Boolean scoped", RefKind.None, ScopedKind.None); 15141VerifyLocalSymbol(locals[0], "scoped R<System.Int32> r1", RefKind.None, ScopedKind.ScopedValue); 15142VerifyLocalSymbol(locals[1], "scoped ref R<System.Int32> r3", RefKind.Ref, ScopedKind.ScopedRef); 15712private static void VerifyLocalSymbol(LocalSymbol local, string expectedDisplayString, RefKind expectedRefKind, ScopedKind expectedScope) 15721private static void VerifyLocalSymbol(ILocalSymbol local, string expectedDisplayString, RefKind expectedRefKind, ScopedKind expectedScope) 15761VerifyParameterSymbol(method.Parameters[0], "ref System.Int32 i", RefKind.Ref, ScopedKind.None); 17949VerifyParameterSymbol(delegateInvokeMethods[0].Parameters[0], "R arg1", RefKind.None, ScopedKind.None); 17950VerifyParameterSymbol(delegateInvokeMethods[0].Parameters[1], "scoped R arg2", RefKind.None, ScopedKind.ScopedValue); 17951VerifyParameterSymbol(delegateInvokeMethods[1].Parameters[1], "scoped ref System.Int32 arg2", RefKind.Ref, ScopedKind.ScopedRef); 22836VerifyParameterSymbol(type.GetMethod("Get").ThisParameter, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 22837VerifyParameterSymbol(type.GetMethod("get_Item").ThisParameter, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 22841VerifyParameterSymbol(type.GetMethod("Get").ThisParameter, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22842VerifyParameterSymbol(type.GetMethod("get_Item").ThisParameter, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22905VerifyParameterSymbol(type.GetMethod("Get").ThisParameter, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 22906VerifyParameterSymbol(type.GetMethod("get_Item").ThisParameter, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 22911VerifyParameterSymbol(type.GetMethod("Get").ThisParameter, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 22912VerifyParameterSymbol(type.GetMethod("get_Item").ThisParameter, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23059VerifyParameterSymbol(parameters[1], "scoped ref R x", RefKind.Ref, ScopedKind.ScopedRef); 23060VerifyParameterSymbol(parameters[2], "ref R y", RefKind.Ref, ScopedKind.None); 23122VerifyParameterSymbol(baseType.GetMethod("F1A").Parameters[0], "ref R<System.Int32> r1", RefKind.Ref, ScopedKind.None); 23123VerifyParameterSymbol(baseType.GetMethod("F2A").Parameters[0], "scoped ref R<System.Int32> r2", RefKind.Ref, ScopedKind.ScopedRef); 23211VerifyParameterSymbol(type.GetMethod("F1").Parameters[0], "ref R<T> r1", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23212VerifyParameterSymbol(type.GetMethod("F2").Parameters[0], "out T t2", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23213VerifyParameterSymbol(type.GetMethod("F3").Parameters[0], "in R<T> t3", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23214VerifyParameterSymbol(type.GetMethod("F4").Parameters[0], "R<T> t4", RefKind.None, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23295VerifyParameterSymbol(baseType.GetMethod("F4A").Parameters[0], "ref R<System.Int32> r4", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23318VerifyParameterSymbol(parameters[0], "System.Int32 x", RefKind.None, default, expectedHasUnscopedRefAttribute: true); 23319VerifyParameterSymbol(parameters[1], "System.Object y", RefKind.None, default, expectedHasUnscopedRefAttribute: true); 23346VerifyParameterSymbol(parameters[1], "out System.Int32 x", RefKind.Out, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23347VerifyParameterSymbol(parameters[2], "out System.Int32 y", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23405VerifyParameterSymbol(baseType.GetMethod("F1A").Parameters[0], "out System.Int32 t1", RefKind.Out, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23406VerifyParameterSymbol(baseType.GetMethod("F2A").Parameters[0], "out System.Int32 t2", RefKind.Out, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23407VerifyParameterSymbol(baseType.GetMethod("F3A").Parameters[0], "out System.Int32 t3", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23470VerifyParameterSymbol(baseType.GetMethod("F1A").Parameters[0], "ref System.Int32 t1", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 23471VerifyParameterSymbol(baseType.GetMethod("F2A").Parameters[0], "scoped ref System.Int32 t2", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23472VerifyParameterSymbol(baseType.GetMethod("F3A").Parameters[0], "ref System.Int32 t3", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23473VerifyParameterSymbol(baseType.GetMethod("F4A").Parameters[0], "ref System.Int32 t4", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23536VerifyParameterSymbol(baseType.GetMethod("F1A").Parameters[0], "in System.Int32 t1", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 23537VerifyParameterSymbol(baseType.GetMethod("F2A").Parameters[0], "scoped in System.Int32 t2", RefKind.In, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23538VerifyParameterSymbol(baseType.GetMethod("F3A").Parameters[0], "in System.Int32 t3", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23539VerifyParameterSymbol(baseType.GetMethod("F4A").Parameters[0], "in System.Int32 t4", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23626VerifyParameterSymbol(baseType.GetMethod("F1A").Parameters[0], "R<System.Int32> r1", RefKind.None, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 23627VerifyParameterSymbol(baseType.GetMethod("F2A").Parameters[0], "scoped R<System.Int32> r2", RefKind.None, ScopedKind.ScopedValue, expectedHasUnscopedRefAttribute: false); 23628VerifyParameterSymbol(baseType.GetMethod("F3A").Parameters[0], "R<System.Int32> r3", RefKind.None, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23629VerifyParameterSymbol(baseType.GetMethod("F4A").Parameters[0], "R<System.Int32> r4", RefKind.None, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23654VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F1").Parameters[0], "R<T> r1", RefKind.None, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23655VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F2").Parameters[0], "ref R<T> r2", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23656VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F3").Parameters[0], "in R<T> r3", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23657VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F4").Parameters[0], "out R<T> r4", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23903VerifyParameterSymbol(lambdas[0].Parameters[0], "out System.Int32 i1", RefKind.Out, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23904VerifyParameterSymbol(lambdas[1].Parameters[0], "out System.Int32 i2", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23905VerifyParameterSymbol(lambdas[2].Parameters[0], "out System.Object o1", RefKind.Out, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23906VerifyParameterSymbol(lambdas[3].Parameters[0], "out System.Object o2", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23939VerifyParameterSymbol(lambdas[0].Parameters[0], "ref System.Int32 i1", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 23940VerifyParameterSymbol(lambdas[1].Parameters[0], "ref System.Int32 i2", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23941VerifyParameterSymbol(lambdas[2].Parameters[0], "ref System.Object o1", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 23942VerifyParameterSymbol(lambdas[3].Parameters[0], "ref System.Object o2", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23976VerifyParameterSymbol(lambdas[0].Parameters[0], "scoped ref R<System.Int32> r1", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23977VerifyParameterSymbol(lambdas[1].Parameters[0], "ref R<System.Int32> r2", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 23978VerifyParameterSymbol(lambdas[2].Parameters[0], "scoped ref R<System.Object> r1", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23979VerifyParameterSymbol(lambdas[3].Parameters[0], "ref R<System.Object> r2", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 24400VerifyParameterSymbol(typeA.GetMethod("NoAttributes").Parameters[0], "out System.Int32 i", RefKind.Out, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 24401VerifyParameterSymbol(typeA.GetMethod("ScopedRefOnly").Parameters[0], "out System.Int32 i", RefKind.Out, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 24402VerifyParameterSymbol(typeA.GetMethod("UnscopedRefOnly").Parameters[0], "out System.Int32 i", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24403VerifyParameterSymbol(typeA.GetMethod("ScopedRefAndUnscopedRef").Parameters[0], "out System.Int32 i", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24502VerifyParameterSymbol(typeA.GetMethod("NoAttributes").Parameters[0], "ref R x", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 24503VerifyParameterSymbol(typeA.GetMethod("ScopedRefOnly").Parameters[0], "scoped ref R x", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 24504VerifyParameterSymbol(typeA.GetMethod("UnscopedRefOnly").Parameters[0], "ref R x", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24505VerifyParameterSymbol(typeA.GetMethod("ScopedRefAndUnscopedRef").Parameters[0], "ref R x", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24610VerifyParameterSymbol(typeA.GetMethod("NoAttributes").Parameters[0], "in R x", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 24611VerifyParameterSymbol(typeA.GetMethod("ScopedRefOnly").Parameters[0], "scoped in R x", RefKind.In, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 24612VerifyParameterSymbol(typeA.GetMethod("UnscopedRefOnly").Parameters[0], "in R x", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24613VerifyParameterSymbol(typeA.GetMethod("ScopedRefAndUnscopedRef").Parameters[0], "in R x", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24668VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F1").ThisParameter, "ref S1 this", RefKind.Ref, ScopedKind.ScopedRef); 24669VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F2").ThisParameter, "in S2 this", RefKind.In, ScopedKind.ScopedRef); 24670VerifyParameterSymbol(comp.GetMember<MethodSymbol>("A.F3").Parameters[0], "out System.Int32 i3", RefKind.Out, useUpdatedRules ? ScopedKind.ScopedRef : ScopedKind.None); 24671VerifyParameterSymbol(comp.GetMember<MethodSymbol>("A.F4").Parameters[0], "ref R r4", RefKind.Ref, ScopedKind.None); 24672VerifyParameterSymbol(comp.GetMember<MethodSymbol>("A.F5").Parameters[0], "in R r5", RefKind.In, ScopedKind.None); 24711VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F1").ThisParameter, "ref S1 this", RefKind.Ref, ScopedKind.ScopedRef); 24712VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F2").ThisParameter, "in S2 this", RefKind.In, ScopedKind.ScopedRef); 24713VerifyParameterSymbol(comp.GetMember<MethodSymbol>("A.F3").Parameters[0], "out System.Int32 i3", RefKind.Out, useUpdatedRules ? ScopedKind.ScopedRef : ScopedKind.None); 24714VerifyParameterSymbol(comp.GetMember<MethodSymbol>("A.F4").Parameters[0], "ref R r4", RefKind.Ref, ScopedKind.None); 24715VerifyParameterSymbol(comp.GetMember<MethodSymbol>("A.F5").Parameters[0], "in R r5", RefKind.In, ScopedKind.None); 24745verifyParameter(delegateTypesAndLambdas[0], 0, "out System.Int32", "i1", RefKind.Out, useUpdatedRules ? ScopedKind.ScopedRef : ScopedKind.None); 24746verifyParameter(delegateTypesAndLambdas[1], 0, "R", "r2", RefKind.None, ScopedKind.None); 24747verifyParameter(delegateTypesAndLambdas[2], 0, "ref R", "r3", RefKind.Ref, ScopedKind.None); 24748verifyParameter(delegateTypesAndLambdas[3], 0, "in R", "r4", RefKind.In, ScopedKind.None); 24749verifyParameter(delegateTypesAndLambdas[4], 0, "out R", "r5", RefKind.Out, useUpdatedRules ? ScopedKind.ScopedRef : ScopedKind.None); 24751static void verifyParameter((NamedTypeSymbol, LambdaSymbol) delegateTypeAndLambda, int parameterIndex, string expectedDisplayType, string expectedDisplayName, RefKind expectedRefKind, ScopedKind expectedScope) 24795VerifyParameterSymbol(getFunctionPointerMethod(comp, "A.F1").Parameters[0], "out modreq(System.Runtime.InteropServices.OutAttribute) System.Int32", RefKind.Out, useUpdatedRules ? ScopedKind.ScopedRef : ScopedKind.None); 24796VerifyParameterSymbol(getFunctionPointerMethod(comp, "A.F2").Parameters[0], "R", RefKind.None, ScopedKind.None); 24797VerifyParameterSymbol(getFunctionPointerMethod(comp, "A.F3").Parameters[0], "ref R", RefKind.Ref, ScopedKind.None); 24798VerifyParameterSymbol(getFunctionPointerMethod(comp, "A.F4").Parameters[0], "in modreq(System.Runtime.InteropServices.InAttribute) R", RefKind.In, ScopedKind.None); 24799VerifyParameterSymbol(getFunctionPointerMethod(comp, "A.F5").Parameters[0], "out modreq(System.Runtime.InteropServices.OutAttribute) R", RefKind.Out, useUpdatedRules ? ScopedKind.ScopedRef : ScopedKind.None); 24855VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S.F").ThisParameter, "ref S this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24856VerifyParameterSymbol(comp.GetMember<PropertySymbol>("S.P").GetMethod.ThisParameter, "ref S this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24857VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F1").Parameters[0], "out System.Int32 i1", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24858VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F2").Parameters[0], "R r2", RefKind.None, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24859VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F3").Parameters[0], "ref R r3", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24860VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F4").Parameters[0], "in R r4", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24861VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F5").Parameters[0], "out R r5", RefKind.Out, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 25474VerifyParameterSymbol(typeA.GetMethod("F1").Parameters[0], "ref R x", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 25475VerifyParameterSymbol(typeA.GetMethod("F2").Parameters[0], "ref R x", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 25476VerifyParameterSymbol(typeA.GetMethod("F3").Parameters[0], "in R x", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 25477VerifyParameterSymbol(typeA.GetMethod("F4").Parameters[0], "in R x", RefKind.In, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 26430VerifyParameterSymbol(method.Parameters[0], "out System.Int32 i", RefKind.Out, version == 11 ? ScopedKind.ScopedRef : ScopedKind.None); 26469VerifyParameterSymbol(method.Parameters[0], "out System.Int32 i", RefKind.Out, ScopedKind.None); 26508VerifyParameterSymbol(method.Parameters[0], "out System.Int32 i", RefKind.Out, ScopedKind.None); 26558VerifyParameterSymbol(method.Parameters[0], "out T t", RefKind.Out, expectedUseUpdatedEscapeRules ? ScopedKind.ScopedRef : ScopedKind.None); 27050VerifyLocalSymbol(locals[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 27051VerifyLocalSymbol(locals[1], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 27052VerifyLocalSymbol(locals[2], "scoped ref readonly R r5", RefKind.RefReadOnly, ScopedKind.ScopedRef); 27140VerifyLocalSymbol(locals[0], "scoped R r1", RefKind.None, ScopedKind.ScopedValue); 27141VerifyLocalSymbol(locals[1], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 27142VerifyLocalSymbol(locals[2], "scoped ref readonly R r5", RefKind.RefReadOnly, ScopedKind.ScopedRef); 27260VerifyLocalSymbol(locals[0], "scoped s1", RefKind.None, ScopedKind.None); 27261VerifyLocalSymbol(locals[1], "ref scoped s2", RefKind.Ref, ScopedKind.None); 27262VerifyLocalSymbol(locals[2], "ref scoped s3", RefKind.Ref, ScopedKind.None); 27263VerifyLocalSymbol(locals[3], "scoped scoped s4", RefKind.None, ScopedKind.ScopedValue); 27264VerifyLocalSymbol(locals[4], "scoped ref scoped s5", RefKind.Ref, ScopedKind.ScopedRef); 27265VerifyLocalSymbol(locals[5], "scoped ref scoped s6", RefKind.Ref, ScopedKind.ScopedRef); 27361VerifyLocalSymbol(locals[0], "scoped s1", RefKind.None, ScopedKind.None); 27362VerifyLocalSymbol(locals[1], "ref scoped s2", RefKind.Ref, ScopedKind.None); 27363VerifyLocalSymbol(locals[2], "ref scoped s3", RefKind.Ref, ScopedKind.None); 27364VerifyLocalSymbol(locals[3], "scoped scoped s4", RefKind.None, ScopedKind.ScopedValue); 27365VerifyLocalSymbol(locals[4], "scoped ref scoped s5", RefKind.Ref, ScopedKind.ScopedRef); 27366VerifyLocalSymbol(locals[5], "scoped ref scoped s6", RefKind.Ref, ScopedKind.ScopedRef); 27412VerifyLocalSymbol(locals[0], "scoped R<System.Int32> r1", RefKind.None, ScopedKind.ScopedValue); 27413VerifyLocalSymbol(locals[1], "scoped R<System.Int32> r3", RefKind.None, ScopedKind.ScopedValue); 27472VerifyLocalSymbol(locals[0], "scoped R<System.Int32> r1", RefKind.None, ScopedKind.ScopedValue); 27473VerifyLocalSymbol(locals[1], "scoped R<System.Int32> r3", RefKind.None, ScopedKind.ScopedValue); 27696VerifyLocalSymbol(locals[0], "scoped R r2", RefKind.None, ScopedKind.ScopedValue); 27697VerifyLocalSymbol(locals[1], "scoped R r5", RefKind.None, ScopedKind.ScopedValue); 27744VerifyLocalSymbol(locals[0], "scoped R r2", RefKind.None, ScopedKind.ScopedValue); 27745VerifyLocalSymbol(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)
69333Assert.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)
3375Assert.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)
24public static RefKind GetRefKind(this ArgumentSyntax? argument) 27SyntaxKind.RefKeyword => RefKind.Ref, 28SyntaxKind.OutKeyword => RefKind.Out, 29SyntaxKind.InKeyword => RefKind.In, 30_ => RefKind.None, 82parameter.RefKind != RefKind.Out) 88parameter.RefKind != RefKind.Ref)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
374ReducedFrom.Parameters: [{ RefKind: RefKind.Ref }, ..],
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
595public RefKind GetRefKindOfArgument(SyntaxNode node)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (3)
687if (castedSymbol is not IFieldSymbol and not ILocalSymbol and not IParameterSymbol and not IParameterSymbol { RefKind: RefKind.Ref }) 1398if (operation is IPropertyReferenceOperation { Property.RefKind: not RefKind.Ref }) 1402if (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)
182static (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)
762methodSymbol.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)
2902refKind As RefKind, 2904parameterRefKinds 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)
698refKind:=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)
486if (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)
306RefKind GetRefKindOfArgument(SyntaxNode node);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
275PooledArrayBuilder<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)
324internal 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.InKeyword),
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