451 references to Ref
ILLink.RoslynAnalyzer (4)
IOperationExtensions.cs (3)
132 case RefKind.Ref: 141 RefKind.Ref => ValueUsageInfo.ReadableWritableReference, 163 case RefKind.Ref:
TrimAnalysis\ParameterProxy.cs (1)
26 case RefKind.Ref: return ReferenceKind.Ref;
Microsoft.CodeAnalysis (4)
Emit\EditAndContinue\DefinitionMap.cs (1)
471if (p.RefKind == RefKind.Ref &&
Symbols\RefKind.cs (3)
57case RefKind.Ref: return "ref"; 69case RefKind.Ref: return "ref"; 80case RefKind.Ref: return "ref ";
Microsoft.CodeAnalysis.CodeStyle (8)
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
552if (member is IFieldSymbol { IsReadOnly: false, RefKind: RefKind.Ref })
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (1)
551case RefKind.Ref:
src\Workspaces\Core\Portable\Editing\DeclarationModifiers.cs (1)
88isRef: field?.RefKind is RefKind.Ref or RefKind.RefReadOnly || type?.IsRefLikeType == true,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\IParameterSymbolExtensions.cs (1)
15case RefKind.Ref:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (3)
169case RefKind.Ref: 181RefKind.Ref => ValueUsageInfo.ReadableWritableReference, 218case RefKind.Ref:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (1)
441if (parameter.RefKind is RefKind.Ref or RefKind.Out)
Microsoft.CodeAnalysis.CodeStyle.Fixes (4)
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.cs (1)
249return RefKind.Ref;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationMethodSymbol.cs (1)
86return RefKind == RefKind.Ref;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertySymbol.cs (1)
77public bool ReturnsByRef => refKind == RefKind.Ref;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SyntaxGeneratorInternalExtensions\SyntaxGeneratorInternal.cs (1)
106=> symbol is { RefKind: RefKind.Ref or RefKind.In or RefKind.RefReadOnlyParameter, ScopedKind: ScopedKind.ScopedRef }
Microsoft.CodeAnalysis.CSharp (160)
Binder\Binder.ValueChecks.cs (11)
386var useSetAccessor = coreValueKind == BindValueKind.Assignable && indexerAccess.Indexer.RefKind != RefKind.Ref; 1344case RefKind.Ref: 1370case RefKind.Ref: 1384case RefKind.Ref: 2385if (getArgument.RefKind == RefKind.Ref) 2391if (setArgument.RefKind == RefKind.Ref) 2440if (refKind == RefKind.Ref && mixableArguments is not null) 3018return RefKind.Ref; 5458resultRefKind = elementAccess.GetItemOrSliceHelper is WellKnownMember.System_ReadOnlySpan_T__get_Item ? RefKind.In : RefKind.Ref; 5468parameterRefKind = elementAccess.GetItemOrSliceHelper is WellKnownMember.System_ReadOnlySpan_T__Slice_Int_Int ? RefKind.In : RefKind.Ref; 5513RefKind parameterRefKind = resultType.OriginalDefinition.Equals(_compilation.GetWellKnownType(WellKnownType.System_ReadOnlySpan_T), TypeCompareKind.AllIgnoreOptions) ? RefKind.In : RefKind.Ref;
Binder\Binder_Crefs.cs (1)
936if (refKind == RefKind.Ref && parameter.ReadOnlyKeyword.IsKind(SyntaxKind.ReadOnlyKeyword))
Binder\Binder_Expressions.cs (3)
3426if (argRefKind == RefKind.Ref) 4979if (analyzedArguments.RefKind(i) is (RefKind.Ref or RefKind.Out)) 5690bool isRef = refKind == RefKind.Ref;
Binder\Binder_Invocation.cs (3)
302case RefKind.Ref: 1226if (receiverParameter.RefKind == RefKind.Ref) 1239analyzedArguments.RefKinds[0] = RefKind.Ref;
Binder\Binder_Operators.cs (4)
4280var isRef = whenTrueRefKind == RefKind.Ref && whenFalseRefKind == RefKind.Ref; 4283if (whenFalseRefKind == RefKind.Ref) 4288if (whenTrueRefKind == RefKind.Ref)
Binder\Binder_Statements.cs (5)
920if (expressionRefKind == RefKind.Ref) 937else if (expressionRefKind != RefKind.Ref) 1416var isRef = refKind == RefKind.Ref; 1446if (lhsRefKind is RefKind.Ref or RefKind.Out) 3611requiredValueKind = sigRefKind == RefKind.Ref ?
Binder\ForEachLoopBinder.cs (4)
244if (getEnumeratorMethod.ParameterRefKinds is { IsDefault: false } refKinds && refKinds[0] == RefKind.Ref) 339case RefKind.Ref: 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)) ||
Binder\Semantics\OverloadResolution\OverloadResolution.cs (12)
2660RefKind.Ref when isInterpolatedStringHandlerConversion => true, 2864Debug.Assert(refKind1 == RefKind.None || refKind1 == RefKind.Ref); 2865Debug.Assert(refKind2 == RefKind.None || refKind2 == RefKind.Ref); 2878else if (refKind1 == RefKind.Ref) 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) 3938(RefKind.RefReadOnlyParameter, RefKind.Ref) or 3946(candidateMethodParameterRefKind, delegateParameterRefKind) is (RefKind.In, RefKind.Ref)) 4451if (parameterRefKind == RefKind.Ref) 4465&& parameterRefKind == RefKind.Ref
Binder\Semantics\OverloadResolution\OverloadResolutionResult.cs (4)
1195if (refParameter == RefKind.Ref || 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)) 1265else if (refArg == RefKind.Ref && refParameter == RefKind.In && !binder.Compilation.IsFeatureEnabled(MessageID.IDS_FeatureRefReadonlyParameters))
BoundTree\BoundExpressionExtensions.cs (1)
54return RefKind.Ref;
BoundTree\Constructors.cs (1)
194Debug.Assert(argumentRefKind is RefKind.None or RefKind.Ref or RefKind.In or RefKind.Out or RefKindExtensions.StrictIn &&
CodeGen\CodeGenerator_HasHome.cs (4)
99return methodRefKind == RefKind.Ref || 105return dupRefKind == RefKind.Ref || 121return lhsRefKind == RefKind.Ref || 188if (field.RefKind is RefKind.Ref)
CodeGen\EmitAddress.cs (2)
124if (funcPtrRefKind == RefKind.Ref || 180return methodRefKind == RefKind.Ref ||
CodeGen\EmitExpression.cs (1)
729Debug.Assert(refKind is RefKind.Ref or RefKind.Out or RefKindExtensions.StrictIn);
CodeGen\Optimizer.cs (3)
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"); 2191left.LocalSymbol.RefKind == RefKind.Ref &&
FlowAnalysis\AbstractFlowPass.cs (4)
1436WriteArgument(receiverOpt, RefKind.Ref, method: null); 1555case RefKind.Ref: 2158? RefKind.Ref 3306WriteArgument(operand, RefKind.Ref, method: null);
FlowAnalysis\DefiniteAssignment.cs (1)
2569if (refKind == RefKind.Ref)
FlowAnalysis\NullableWalker.cs (5)
1317if (refKind != RefKind.Out && refKind != RefKind.Ref) 2441if (refKind == RefKind.Ref) 7358case RefKind.Ref: 7461case RefKind.Ref: 7564case RefKind.Ref:
Lowering\ClosureConversion\ClosureConversion.cs (1)
925refkindsBuilder.AddMany(RefKind.Ref, frameCount);
Lowering\Instrumentation\LocalStateTracingInstrumenter.cs (1)
577if (refKinds[i] is not (RefKind.Ref or RefKind.Out))
Lowering\LocalRewriter\LocalRewriter_Call.cs (10)
290thisRefKind == RefKind.Ref ? CodeGenerator.AddressKind.Writeable : CodeGenerator.AddressKind.ReadOnlyStrict, 691refKind = rewrittenReceiver.Type.IsValueType || rewrittenReceiver.Type.Kind == SymbolKind.TypeParameter ? RefKind.Ref : RefKind.None; 710refKind = RefKind.Ref; 951var intermediateRef = _factory.Local(_factory.SynthesizedLocal(receiverType, refKind: RefKind.Ref)); 1167else if (paramRefKind == RefKind.Ref) 1176refKindsBuilder[i] = RefKind.Ref; 1365Debug.Assert(argRefKind is RefKind.None or RefKind.In or RefKind.Ref); 1620if (argRefKind != RefKind.None || paramRefKind != RefKind.Ref) 1629if (localRefKind == RefKind.Ref) 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 (5)
205var receiverTemp = _factory.StoreToTemp(rewrittenReceiver, out assignmentToTemp, refKind: variableRepresentsLocation ? RefKind.Ref : 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); 678Debug.Assert(originalLHS.GetRefKind() == RefKind.Ref); 754var variableTemp = _factory.StoreToTemp(rewrittenVariable, out assignmentToTemp2, refKind: RefKind.Ref);
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (1)
760collectionTempRefKind = enumeratorInfo.InlineArraySpanType == WellKnownType.System_Span_T ? RefKind.Ref : RefKindExtensions.StrictIn;
Lowering\LocalRewriter\LocalRewriter_IndexerAccess.cs (4)
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); 807receiver.Type.IsReferenceType ? RefKind.None : RefKind.Ref);
Lowering\LocalRewriter\LocalRewriter_ObjectOrCollectionInitializerExpression.cs (2)
164if (addMethod.Parameters[0].RefKind == RefKind.Ref) 170builder[0] = RefKind.Ref;
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (2)
551argumentRefKindsOpt: [readOnlySpanCtorRefParamChar.Parameters[0].RefKind == RefKind.Ref ? RefKind.Ref : RefKindExtensions.StrictIn],
Lowering\LocalRewriter\LoweredDynamicOperationFactory.cs (4)
555return hasHome ? RefKind.Ref : RefKind.None; 794return refKind == RefKind.None ? RefKind.None : RefKind.Ref; 817Debug.Assert(refKind == RefKind.None || refKind == RefKind.Ref || refKind == RefKind.Out, "unexpected refKind in dynamic"); 824else if (refKind == RefKind.Ref)
Lowering\SpillSequenceSpiller.cs (9)
370var left = Spill(builder, assignment.Left, RefKind.Ref); 371var right = Spill(builder, assignment.Right, RefKind.Ref); 538Left: BoundLocal { LocalSymbol: { SynthesizedKind: SynthesizedLocalKind.LoweringTemp, RefKind: RefKind.Ref } receiverRefLocal }, 541ValueTypeReceiver: BoundLocal { LocalSymbol: { SynthesizedKind: SynthesizedLocalKind.LoweringTemp, RefKind: RefKind.Ref } } valueTypeReceiver, 551Right: BoundLocal { LocalSymbol: { SynthesizedKind: SynthesizedLocalKind.LoweringTemp, RefKind: RefKind.Ref } originalReceiverReference } 907left = Spill(leftBuilder, VisitExpression(ref leftBuilder, left), RefKind.Ref); 954receiver = Spill(leftBuilder, VisitExpression(ref leftBuilder, field.ReceiverOpt), RefKind.Ref); 1076result = receiver.Type.IsReadOnly ? RefKind.In : RefKind.Ref; 1304receiver = Spill(receiverBuilder, receiver, RefKind.Ref);
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (3)
558var sacrificialTemp = F.SynthesizedLocal(type, refKind: RefKind.Ref); 641Debug.Assert(refKind is RefKindExtensions.StrictIn or RefKind.Ref or RefKind.Out); 659Debug.Assert(refKind is RefKindExtensions.StrictIn or RefKind.Ref or RefKind.In);
Lowering\SynthesizedMethodBaseSymbol.cs (1)
154builder.Add(SynthesizedParameterSymbol.Create(this, this.TypeMap.SubstituteType(extra), ordinal++, RefKind.Ref));
Lowering\SyntheticBoundNodeFactory.cs (2)
1651refKind = RefKind.Ref; 1669case RefKind.Ref:
SymbolDisplay\SymbolDisplayVisitor.Members.cs (2)
39case RefKind.Ref: 1136case RefKind.Ref:
Symbols\FunctionPointers\FunctionPointerMethodSymbol.cs (4)
53refKind = RefKind.Ref; 312Debug.Assert(refKind is RefKind.None or RefKind.In or RefKind.Ref or RefKind.Out); 553RefKind = getRefKind(retInfo, RefCustomModifiers, RefKind.RefReadOnly, RefKind.Ref, requiresLocationAllowed: false); 589true => RefKind.Ref,
Symbols\FunctionPointers\FunctionPointerTypeSymbol.cs (1)
201=> refKind == RefKind.None ? RefKind.None : RefKind.Ref;
Symbols\MemberSignatureComparer.cs (1)
254/// the difference between <see cref="RefKind.Out"/> and <see cref="RefKind.Ref"/>.
Symbols\Metadata\PE\PEFieldSymbol.cs (1)
326moduleSymbol.Module.HasIsReadOnlyAttribute(_handle) ? RefKind.RefReadOnly : RefKind.Ref :
Symbols\Metadata\PE\PEMethodSymbol.cs (2)
1128case RefKind.Ref: 1157case RefKind.Ref:
Symbols\Metadata\PE\PEParameterSymbol.cs (2)
264refKind = isByRef ? RefKind.Ref : RefKind.None; 304refKind = RefKind.Ref;
Symbols\Metadata\PE\PEPropertySymbol.cs (1)
285_refKind = RefKind.Ref;
Symbols\MethodSymbol.cs (1)
218return this.RefKind == RefKind.Ref;
Symbols\NamedTypeSymbol.cs (1)
358if ((thisParam.RefKind == RefKind.Ref && !thisParam.Type.IsValueType) ||
Symbols\ParameterSymbol.cs (1)
164(refKind == RefKind.Ref && ContainingSymbol.ContainingType.IsComImport));
Symbols\PropertySymbol.cs (1)
71public bool ReturnsByRef { get { return this.RefKind == RefKind.Ref; } }
Symbols\PropertySymbolExtensions.cs (1)
73if (param.RefKind == RefKind.Ref || param.RefKind == RefKind.Out)
Symbols\RefKindExtensions.cs (2)
26return RefKind.Ref; 42case RefKind.Ref:
Symbols\Source\ParameterHelpers.cs (4)
183if (!allowRefOrOut && (refKind == RefKind.Ref || refKind == RefKind.Out)) 746if (refKind == RefKind.Ref || refKind == RefKind.Out) 945refKind = RefKind.Ref; 966if (refKind == RefKind.Ref && refnessKeyword.GetNextToken() == modifier)
Symbols\Source\SourceComplexParameterSymbol.cs (1)
1408case RefKind.Ref:
Symbols\Source\SourceMemberContainerSymbol_ImplementationChecks.cs (6)
1278overrideMethod.RefKind == RefKind.Ref ? RefKind.Ref : RefKind.Out, 1350case RefKind.Ref: 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);
Symbols\Source\SourceMemberFieldSymbol.cs (1)
489Debug.Assert(refKind is RefKind.None or RefKind.Ref or RefKind.RefReadOnly);
Symbols\Source\SourceOrdinaryMethodSymbol.cs (1)
218else if (parameter0RefKind == RefKind.Ref && !parameter0Type.Type.IsValueType)
Symbols\Source\ThisParameterSymbol.cs (1)
162return RefKind.Ref;
Symbols\Synthesized\RefKindVector.cs (2)
47(false, false, true) => RefKind.Ref, 60RefKind.Ref => (false, false, true),
Symbols\Synthesized\SynthesizedBackingFieldSymbol.cs (1)
92Debug.Assert(property.RefKind is RefKind.None or RefKind.Ref or RefKind.RefReadOnly);
Symbols\Synthesized\SynthesizedInlineArrayAsSpanMethod.cs (1)
17this.SetParameters(ImmutableArray.Create<ParameterSymbol>(SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(TypeParameters[0]), 0, RefKind.Ref, "buffer"),
Symbols\Synthesized\SynthesizedInlineArrayElementRefMethod.cs (2)
17this.SetParameters(ImmutableArray.Create<ParameterSymbol>(SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(TypeParameters[0]), 0, RefKind.Ref, "buffer"), 21public override RefKind RefKind => RefKind.Ref;
Symbols\Synthesized\SynthesizedInlineArrayFirstElementRefMethod.cs (2)
17this.SetParameters(ImmutableArray.Create<ParameterSymbol>(SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(TypeParameters[0]), 0, RefKind.Ref, "buffer"))); 20public override RefKind RefKind => RefKind.Ref;
Syntax\SyntaxNodeExtensions.cs (2)
255: RefKind.Ref; 330refKind = RefKind.Ref;
Microsoft.CodeAnalysis.CSharp.CodeStyle (7)
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (1)
318if (primaryConstructor.Parameters.Any(static p => p.RefKind is RefKind.Ref or RefKind.Out))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ArgumentSyntaxExtensions.cs (2)
27SyntaxKind.RefKeyword => RefKind.Ref, 88parameter.RefKind != RefKind.Ref)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
374ReducedFrom.Parameters: [{ RefKind: RefKind.Ref }, ..],
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (3)
707if (castedSymbol is not IFieldSymbol and not ILocalSymbol and not IParameterSymbol and not IParameterSymbol { RefKind: RefKind.Ref }) 1418if (operation is IPropertyReferenceOperation { Property.RefKind: not RefKind.Ref }) 1422if (operation is IInvocationOperation { TargetMethod.RefKind: not RefKind.Ref })
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (2)
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateParameterizedMemberService.cs (1)
39=> _invocationExpression.IsParentKind(SyntaxKind.RefExpression) ? RefKind.Ref : RefKind.None;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (1)
150case RefKind.Ref:
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (35)
CodeGen\CodeGenFunctionPointersTests.cs (11)
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))), 650(RefKind.Ref, 746(RefKind.Ref, IsSpecialType(SpecialType.System_Boolean)), 747(RefKind.Ref, IsSpecialType(SpecialType.System_Int32))); 7678parameterRefCustomModifiers: default, returnRefKind: RefKind.Ref, parameterTypes: ImmutableArray<TypeWithAnnotations>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, 7687parameterRefCustomModifiers: default, returnRefKind: RefKind.Ref, parameterTypes: ImmutableArray<TypeWithAnnotations>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, 7763returnRefKind: RefKind.Ref, parameterTypes: ImmutableArray<TypeWithAnnotations>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, 7772returnRefKind: RefKind.Ref, parameterTypes: ImmutableArray<TypeWithAnnotations>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty,
CodeGen\CodeGenLocalFunctionTests.cs (11)
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);
CodeGen\CodeGenReadonlyStructTests.cs (8)
868Assert.Equal(RefKind.Ref, namedType.GetMethod("M1").ThisParameter.RefKind); 869Assert.Equal(RefKind.Ref, namedType.GetMethod("ToString").ThisParameter.RefKind); 1032Assert.Equal(RefKind.Ref, namedType.GetMethod("M1").ThisParameter.RefKind); 1033Assert.Equal(RefKind.Ref, namedType.GetMethod("ToString").ThisParameter.RefKind); 1571verifyReadOnly(s1.GetMethod("M1"), false, RefKind.Ref); 1575verifyReadOnly(s1.GetProperty("P1").SetMethod, false, RefKind.Ref); 1580verifyReadOnly(s1.GetProperty("P3").SetMethod, false, RefKind.Ref); 1582verifyReadOnly(s1.GetProperty("P4").GetMethod, false, RefKind.Ref);
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 (2)
448Assert.Equal(RefKind.Ref, parameter1.RefKind); 2027Assert.Equal(RefKind.Ref, m.Parameters[1].RefKind);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (8)
Attributes\AttributeTests_RefReadOnly.cs (2)
2371Assert.Equal(RefKind.Ref, method.Parameters[1].RefKind); 2417Assert.Equal(RefKind.Ref, method.Parameters[0].RefKind);
RefReadonlyParameterTests.cs (6)
483Assert.Equal(RefKind.Ref, m.RefKind); 1075Assert.Equal(RefKind.Ref, p.RefKind); 1229Assert.Equal(RefKind.Ref, p.RefKind); 1669Assert.Equal(RefKind.Ref, p.RefKind); 7081"ref" => RefKind.Ref, 7178Assert.Equal(RefKind.Ref, parameter.RefKind);
Microsoft.CodeAnalysis.CSharp.Features (6)
CodeRefactorings\ConvertLocalFunctionToMethod\CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs (1)
92refKind: dataFlow.WrittenInside.Contains(capture) ? RefKind.Ref : RefKind.None,
Completion\CompletionProviders\CrefCompletionProvider.cs (1)
313RefKind.Ref => "ref ",
Completion\Providers\ContextVariableArgumentProvider.cs (1)
38case RefKind.Ref:
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (1)
106refKind: AnalyzerResult.ReturnsByRef ? RefKind.Ref : RefKind.None,
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (1)
318if (primaryConstructor.Parameters.Any(static p => p.RefKind is RefKind.Ref or RefKind.Out))
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateParameterizedMemberService.cs (1)
39=> _invocationExpression.IsParentKind(SyntaxKind.RefExpression) ? RefKind.Ref : RefKind.None;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (119)
Semantics\LambdaTests.cs (1)
6899Assert.Equal(RefKind.Ref, lambdas[0].Parameters[0].RefKind);
Semantics\RefExtensionMethodsTests.cs (2)
2148Assert.Equal(RefKind.Ref, symbol.RefKind); 2186Assert.Equal(RefKind.Ref, symbol.RefKind);
Semantics\RefFieldTests.cs (116)
147VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F1"), "ref T S<T>.F1", RefKind.Ref, new string[0]); 153VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F1"), "ref T S<T>.F1", RefKind.Ref, 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]); 317VerifyFieldSymbol(field, "ref modopt(System.SByte) modopt(System.Object) System.Int32 A<System.Int32>.F", RefKind.Ref, new[] { "System.SByte", "System.Object" }); 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" }); 10923VerifyParameterSymbol(parameters[0], "ref R x2", RefKind.Ref, ScopedKind.None); 10924VerifyParameterSymbol(parameters[1], "scoped ref R y2", RefKind.Ref, ScopedKind.ScopedRef); 10968VerifyParameterSymbol(comp.GetMember<NamedTypeSymbol>("A").Constructors.Single(c => !c.IsImplicitlyDeclared).Parameters[0], "scoped ref T t", RefKind.Ref, ScopedKind.ScopedRef); 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); 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); 11103verifyParameter(delegateTypesAndLambdas[1], 0, "ref System.Int32", "x2", RefKind.Ref, ScopedKind.None, false, false); 11104verifyParameter(delegateTypesAndLambdas[1], 1, "scoped ref System.Int32", "y2", RefKind.Ref, ScopedKind.ScopedRef, false, false); 11110verifyParameter(delegateTypesAndLambdas[4], 0, "ref R", "x5", RefKind.Ref, ScopedKind.None, false, false); 11111verifyParameter(delegateTypesAndLambdas[4], 1, "scoped ref R", "y5", RefKind.Ref, ScopedKind.ScopedRef, false, false); 11159VerifyParameterSymbol(comp.GetMember<NamedTypeSymbol>("D2").DelegateInvokeMethod.Parameters[0], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 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); 11247VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F3").Parameters[0], "scoped ref R r", RefKind.Ref, ScopedKind.ScopedRef); 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); 11472VerifyParameterSymbol(parameters[1], "ref R b", RefKind.Ref, ScopedKind.None); 11508VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.ReturnRef").Parameters[0], "scoped ref R r", RefKind.Ref, ScopedKind.ScopedRef); 11552VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F1").ThisParameter, "ref S1 this", RefKind.Ref, ScopedKind.ScopedRef); 11555VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R1.F1").ThisParameter, "ref R1 this", RefKind.Ref, ScopedKind.ScopedRef); 11566VerifyParameterSymbol(thisParameter, "ref S1 this", RefKind.Ref, ScopedKind.ScopedRef); 11605VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Extensions.F3").Parameters[0], "scoped ref T t", RefKind.Ref, ScopedKind.ScopedRef); 12065VerifyLocalSymbol(locals[1], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 12068VerifyLocalSymbol(locals[4], "scoped ref R r21", RefKind.Ref, ScopedKind.ScopedRef); 12202VerifyLocalSymbol(locals[1], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 13155VerifyLocalSymbol(locals[1], "ref scoped s2", RefKind.Ref, ScopedKind.None); 13156VerifyLocalSymbol(locals[2], "ref scoped s3", RefKind.Ref, ScopedKind.None); 13158VerifyLocalSymbol(locals[4], "scoped ref scoped s5", RefKind.Ref, ScopedKind.ScopedRef); 13159VerifyLocalSymbol(locals[5], "scoped ref scoped s6", RefKind.Ref, ScopedKind.ScopedRef); 13210VerifyLocalSymbol(locals[1], "ref scoped s2", RefKind.Ref, ScopedKind.None); 13211VerifyLocalSymbol(locals[2], "ref scoped s3", RefKind.Ref, ScopedKind.None); 13213VerifyLocalSymbol(locals[4], "scoped ref scoped s5", RefKind.Ref, ScopedKind.ScopedRef); 13214VerifyLocalSymbol(locals[5], "scoped ref scoped s6", RefKind.Ref, ScopedKind.ScopedRef); 13449VerifyLocalSymbol(locals[1], "scoped ref R<System.Int32> r3", RefKind.Ref, ScopedKind.ScopedRef); 13513VerifyLocalSymbol(locals[1], "scoped ref R<System.Int32> r3", RefKind.Ref, ScopedKind.ScopedRef); 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); 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); 14602VerifyLocalSymbol(locals[1], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 15055VerifyLocalSymbol(locals[1], "ref scoped s2", RefKind.Ref, ScopedKind.None); 15056VerifyLocalSymbol(locals[2], "ref scoped s3", RefKind.Ref, ScopedKind.None); 15058VerifyLocalSymbol(locals[4], "scoped ref scoped s5", RefKind.Ref, ScopedKind.ScopedRef); 15059VerifyLocalSymbol(locals[5], "scoped ref scoped s6", RefKind.Ref, ScopedKind.ScopedRef); 15142VerifyLocalSymbol(locals[1], "scoped ref R<System.Int32> r3", RefKind.Ref, ScopedKind.ScopedRef); 15761VerifyParameterSymbol(method.Parameters[0], "ref System.Int32 i", RefKind.Ref, ScopedKind.None); 17951VerifyParameterSymbol(delegateInvokeMethods[1].Parameters[1], "scoped ref System.Int32 arg2", RefKind.Ref, ScopedKind.ScopedRef); 23389VerifyParameterSymbol(type.GetMethod("Get").ThisParameter, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23390VerifyParameterSymbol(type.GetMethod("get_Item").ThisParameter, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23394VerifyParameterSymbol(type.GetMethod("Get").ThisParameter, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23395VerifyParameterSymbol(type.GetMethod("get_Item").ThisParameter, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23458VerifyParameterSymbol(type.GetMethod("Get").ThisParameter, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23459VerifyParameterSymbol(type.GetMethod("get_Item").ThisParameter, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 23464VerifyParameterSymbol(type.GetMethod("Get").ThisParameter, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23465VerifyParameterSymbol(type.GetMethod("get_Item").ThisParameter, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23612VerifyParameterSymbol(parameters[1], "scoped ref R x", RefKind.Ref, ScopedKind.ScopedRef); 23613VerifyParameterSymbol(parameters[2], "ref R y", RefKind.Ref, ScopedKind.None); 23675VerifyParameterSymbol(baseType.GetMethod("F1A").Parameters[0], "ref R<System.Int32> r1", RefKind.Ref, ScopedKind.None); 23676VerifyParameterSymbol(baseType.GetMethod("F2A").Parameters[0], "scoped ref R<System.Int32> r2", RefKind.Ref, ScopedKind.ScopedRef); 23764VerifyParameterSymbol(type.GetMethod("F1").Parameters[0], "ref R<T> r1", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 23848VerifyParameterSymbol(baseType.GetMethod("F4A").Parameters[0], "ref R<System.Int32> r4", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24023VerifyParameterSymbol(baseType.GetMethod("F1A").Parameters[0], "ref System.Int32 t1", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 24024VerifyParameterSymbol(baseType.GetMethod("F2A").Parameters[0], "scoped ref System.Int32 t2", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 24025VerifyParameterSymbol(baseType.GetMethod("F3A").Parameters[0], "ref System.Int32 t3", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24026VerifyParameterSymbol(baseType.GetMethod("F4A").Parameters[0], "ref System.Int32 t4", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24208VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F2").Parameters[0], "ref R<T> r2", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24492VerifyParameterSymbol(lambdas[0].Parameters[0], "ref System.Int32 i1", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 24493VerifyParameterSymbol(lambdas[1].Parameters[0], "ref System.Int32 i2", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24494VerifyParameterSymbol(lambdas[2].Parameters[0], "ref System.Object o1", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 24495VerifyParameterSymbol(lambdas[3].Parameters[0], "ref System.Object o2", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 24529VerifyParameterSymbol(lambdas[0].Parameters[0], "scoped ref R<System.Int32> r1", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 24530VerifyParameterSymbol(lambdas[1].Parameters[0], "ref R<System.Int32> r2", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 24531VerifyParameterSymbol(lambdas[2].Parameters[0], "scoped ref R<System.Object> r1", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 24532VerifyParameterSymbol(lambdas[3].Parameters[0], "ref R<System.Object> r2", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 25055VerifyParameterSymbol(typeA.GetMethod("NoAttributes").Parameters[0], "ref R x", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 25056VerifyParameterSymbol(typeA.GetMethod("ScopedRefOnly").Parameters[0], "scoped ref R x", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false); 25057VerifyParameterSymbol(typeA.GetMethod("UnscopedRefOnly").Parameters[0], "ref R x", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 25058VerifyParameterSymbol(typeA.GetMethod("ScopedRefAndUnscopedRef").Parameters[0], "ref R x", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 25221VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F1").ThisParameter, "ref S1 this", RefKind.Ref, ScopedKind.ScopedRef); 25224VerifyParameterSymbol(comp.GetMember<MethodSymbol>("A.F4").Parameters[0], "ref R r4", RefKind.Ref, ScopedKind.None); 25264VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F1").ThisParameter, "ref S1 this", RefKind.Ref, ScopedKind.ScopedRef); 25267VerifyParameterSymbol(comp.GetMember<MethodSymbol>("A.F4").Parameters[0], "ref R r4", RefKind.Ref, ScopedKind.None); 25300verifyParameter(delegateTypesAndLambdas[2], 0, "ref R", "r3", RefKind.Ref, ScopedKind.None); 25350VerifyParameterSymbol(getFunctionPointerMethod(comp, "A.F3").Parameters[0], "ref R", RefKind.Ref, ScopedKind.None); 25418VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S.F").ThisParameter, "ref S this", RefKind.Ref, scopedRefInCSharp10, expectedHasUnscopedRefAttribute: true); 25419VerifyParameterSymbol(comp.GetMember<PropertySymbol>("S.P").GetMethod.ThisParameter, "ref S this", RefKind.Ref, scopedRefInCSharp10, expectedHasUnscopedRefAttribute: true); 25422VerifyParameterSymbol(comp.GetMember<MethodSymbol>("Program.F3").Parameters[0], "ref R r3", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 26037VerifyParameterSymbol(typeA.GetMethod("F1").Parameters[0], "ref R x", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: false); 26038VerifyParameterSymbol(typeA.GetMethod("F2").Parameters[0], "ref R x", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true); 27614VerifyLocalSymbol(locals[1], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 27704VerifyLocalSymbol(locals[1], "scoped ref R r2", RefKind.Ref, ScopedKind.ScopedRef); 27824VerifyLocalSymbol(locals[1], "ref scoped s2", RefKind.Ref, ScopedKind.None); 27825VerifyLocalSymbol(locals[2], "ref scoped s3", RefKind.Ref, ScopedKind.None); 27827VerifyLocalSymbol(locals[4], "scoped ref scoped s5", RefKind.Ref, ScopedKind.ScopedRef); 27828VerifyLocalSymbol(locals[5], "scoped ref scoped s6", RefKind.Ref, ScopedKind.ScopedRef); 27925VerifyLocalSymbol(locals[1], "ref scoped s2", RefKind.Ref, ScopedKind.None); 27926VerifyLocalSymbol(locals[2], "ref scoped s3", RefKind.Ref, ScopedKind.None); 27928VerifyLocalSymbol(locals[4], "scoped ref scoped s5", RefKind.Ref, ScopedKind.ScopedRef); 27929VerifyLocalSymbol(locals[5], "scoped ref scoped s6", RefKind.Ref, ScopedKind.ScopedRef);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (39)
SymbolDisplay\SymbolDisplayTests.cs (1)
6901Assert.Equal(RefKind.Ref, local.RefKind);
Symbols\CompilationCreationTests.cs (1)
2357Assert.Equal(RefKind.Ref, x1.RefKind);
Symbols\ExtensionMethodTests.cs (2)
4065Assert.Equal(RefKind.Ref, parameter.RefKind); 4071Assert.Equal(RefKind.Ref, parameter.RefKind);
Symbols\FunctionPointerTypeSymbolTests.cs (12)
27[InlineData("ref", RefKind.Ref, "delegate*<ref System.Object>")] 114verifyRefKind(RefKind.Ref, mParams[1]); 115verifyRefKind(RefKind.Ref, mParams[2]); 119verifyRefKind(RefKind.Ref, mParams[6]); 199Assert.Equal(RefKind.Ref, firstSignature.RefKind); 472Assert.Equal(RefKind.Ref, firstParam.Parameters.Single().RefKind); 580Assert.Equal(RefKind.Ref, thirdParam.Parameters.Single().RefKind); 592Assert.Equal(RefKind.Ref, seventhParam.Parameters.Single().RefKind); 598Assert.Equal(RefKind.Ref, ninthParam.Parameters.Single().RefKind); 2056RefKind.Ref, 2123RefKind.Ref, 2182RefKind.Ref,
Symbols\InterfaceImplementationTests.cs (2)
2032Assert.Equal(RefKind.Ref, interfaceMethod.RefKind); 2033Assert.Equal(RefKind.Ref, baseMethod.RefKind);
Symbols\Metadata\MetadataMemberTests.cs (1)
286Assert.Equal(RefKind.Ref, p5.RefKind);
Symbols\Metadata\PE\DynamicTransformsTests.cs (1)
276Assert.Equal(RefKind.Ref, f2.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 (2)
116Assert.Equal(RefKind.Ref, y.RefKind); 134Assert.Equal(RefKind.Ref, y2.RefKind);
Symbols\Source\DelegateTests.cs (3)
743Assert.Equal(RefKind.Ref, parameter.RefKind); 783Assert.Equal(RefKind.Ref, d.DelegateInvokeMethod.RefKind); 784Assert.Equal(RefKind.Ref, ((MethodSymbol)d.GetMembers("EndInvoke").Single()).RefKind);
Symbols\Source\ExpressionBodiedPropertyTests.cs (1)
511Assert.Equal(RefKind.Ref, p.GetMethod.RefKind);
Symbols\Source\MethodTests.cs (7)
363Assert.Equal(RefKind.Ref, p1.RefKind); 405Assert.Equal(RefKind.Ref, m.RefKind); 410Assert.Equal(RefKind.Ref, p1.RefKind); 454Assert.Equal(RefKind.Ref, p1.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 (2)
514Assert.Equal(RefKind.Ref, p1.RefKind); 1558Assert.Equal(RefKind.Ref, paras[0].RefKind);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (2)
FunctionPointerUtilities.cs (2)
289case RefKind.Ref: 319case RefKind.Ref:
Microsoft.CodeAnalysis.CSharp.Workspaces (9)
CodeGeneration\CSharpSyntaxGenerator.cs (2)
216case RefKind.Ref: 3419RefKind.Ref => SyntaxFactory.RefType(type),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ArgumentSyntaxExtensions.cs (2)
27SyntaxKind.RefKeyword => RefKind.Ref, 88parameter.RefKind != RefKind.Ref)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
374ReducedFrom.Parameters: [{ RefKind: RefKind.Ref }, ..],
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (3)
707if (castedSymbol is not IFieldSymbol and not ILocalSymbol and not IParameterSymbol and not IParameterSymbol { RefKind: RefKind.Ref }) 1418if (operation is IPropertyReferenceOperation { Property.RefKind: not RefKind.Ref }) 1422if (operation is IInvocationOperation { TargetMethod.RefKind: not RefKind.Ref })
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (1)
150case RefKind.Ref:
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (1)
CodeGeneration\SyntaxGeneratorTests.cs (1)
467VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.Argument(RefKind.Ref, Generator.IdentifierName("y"))), "x(ref y)");
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (4)
CodeGeneration\ExpressionGenerationTests.cs (4)
396f.Argument(null, RefKind.Ref, f.IdentifierName("b"))), 410f.Argument("n2", RefKind.Ref, f.IdentifierName("b"))), 462f.Argument(null, RefKind.Ref, f.IdentifierName("b"))), 476f.Argument("n2", RefKind.Ref, f.IdentifierName("b"))),
Microsoft.CodeAnalysis.Features (5)
ExtractMethod\MethodExtractor.CodeGenerator.cs (1)
377ParameterBehavior.Ref => RefKind.Ref,
RQName\RQNodeBuilder.cs (1)
156else if (parameter.RefKind == RefKind.Ref)
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
552if (member is IFieldSymbol { IsReadOnly: false, RefKind: RefKind.Ref })
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (1)
551case RefKind.Ref:
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.cs (1)
249return RefKind.Ref;
Microsoft.CodeAnalysis.Test.Utilities (3)
Diagnostics\CouldHaveMoreSpecificTypeAnalyzer.cs (1)
90if (argument.Parameter.RefKind == RefKind.Out || argument.Parameter.RefKind == RefKind.Ref)
Diagnostics\FieldCouldBeReadOnlyAnalyzer.cs (1)
78if (argument.Parameter.RefKind == RefKind.Out || argument.Parameter.RefKind == RefKind.Ref)
Diagnostics\LocalCouldBeConstAnalyzer.cs (1)
71if (argument.Parameter.RefKind == RefKind.Out || argument.Parameter.RefKind == RefKind.Ref)
Microsoft.CodeAnalysis.UnitTests (1)
Diagnostics\OperationTests.cs (1)
54RefKind refKind = RefKind.Ref;
Microsoft.CodeAnalysis.VisualBasic (4)
Compilation\ClsComplianceChecker.vb (1)
958builder.Add(If(parameter.IsByRef, RefKind.Ref, RefKind.None))
Symbols\MethodSymbol.vb (1)
1082Return If(Me.ReturnsByRef, RefKind.Ref, RefKind.None)
Symbols\ParameterSymbol.vb (1)
308Return If(Me.IsByRef, RefKind.Ref, RefKind.None)
Symbols\PropertySymbol.vb (1)
611Return If(Me.ReturnsByRef, RefKind.Ref, RefKind.None)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\ExpressionSyntaxExtensions.vb (1)
399method.ReducedFrom.Parameters.First().RefKind = RefKind.Ref Then
Microsoft.CodeAnalysis.VisualBasic.Features (1)
Completion\CompletionProviders\CrefCompletionProvider.vb (1)
233If parameter.RefKind = RefKind.Ref Then
Microsoft.CodeAnalysis.VisualBasic.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\ExpressionSyntaxExtensions.vb (1)
399method.ReducedFrom.Parameters.First().RefKind = RefKind.Ref Then
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (1)
CodeGeneration\SyntaxGeneratorTests.vb (1)
426VerifySyntax(Of InvocationExpressionSyntax)(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.Argument(RefKind.Ref, Generator.IdentifierName("y"))), "x(y)")
Microsoft.CodeAnalysis.Workspaces (9)
Editing\DeclarationModifiers.cs (1)
88isRef: field?.RefKind is RefKind.Ref or RefKind.RefReadOnly || type?.IsRefLikeType == true,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\IParameterSymbolExtensions.cs (1)
15case RefKind.Ref:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (3)
169case RefKind.Ref: 181RefKind.Ref => ValueUsageInfo.ReadableWritableReference, 218case RefKind.Ref:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (1)
441if (parameter.RefKind is RefKind.Ref or RefKind.Out)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationMethodSymbol.cs (1)
86return RefKind == RefKind.Ref;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertySymbol.cs (1)
77public bool ReturnsByRef => refKind == RefKind.Ref;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SyntaxGeneratorInternalExtensions\SyntaxGeneratorInternal.cs (1)
106=> symbol is { RefKind: RefKind.Ref or RefKind.In or RefKind.RefReadOnlyParameter, ScopedKind: ScopedKind.ScopedRef }
Microsoft.Extensions.Logging.Generators (1)
LoggerMessageGenerator.Parser.cs (1)
368else if (paramSymbol.RefKind == RefKind.Ref)
Microsoft.Interop.SourceGeneration (6)
Marshalling\AttributedMarshallingModelGeneratorResolver.cs (1)
383if (info.RefKind == RefKind.Ref)
Marshalling\MarshallerHelpers.cs (5)
24ByValueContentsMarshalKind.InOut => RefKind.Ref, 320case RefKind.Ref: 342case RefKind.Ref: 429case RefKind.Ref: 459RefKind.Ref => Token(SyntaxKind.RefKeyword),
Microsoft.VisualStudio.LanguageServices (2)
ChangeSignature\ChangeSignatureDialogViewModel.ParameterViewModels.cs (1)
194case RefKind.Ref:
Progression\GraphBuilder.cs (1)
316node.SetValue<bool>(Properties.IsByReference, parameterSymbol.RefKind == RefKind.Ref);
Microsoft.VisualStudio.LanguageServices.CSharp (2)
CodeModel\CSharpCodeModelService_Prototype.cs (1)
528if (parameter.RefKind == RefKind.Ref)
ObjectBrowser\DescriptionBuilder.cs (1)
427if (current.RefKind == RefKind.Ref)
Microsoft.VisualStudio.LanguageServices.UnitTests (1)
ChangeSignature\ChangeSignatureViewModelTests.vb (1)
298Dim includedInTest = {RefKind.None, RefKind.Ref, RefKind.Out, RefKind.In, RefKind.RefReadOnly, RefKind.RefReadOnlyParameter}
Microsoft.VisualStudio.LanguageServices.VisualBasic (1)
ObjectBrowser\DescriptionBuilder.vb (1)
415If current.RefKind = RefKind.Ref Then