152 references to RefReadOnly
ILLink.RoslynAnalyzer (3)
IOperationExtensions.cs (3)
126 case RefKind.RefReadOnly: 140 RefKind.RefReadOnly => ValueUsageInfo.ReadableReference, 166 case RefKind.RefReadOnly:
Microsoft.CodeAnalysis.CodeStyle (4)
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\OperationExtensions.cs (3)
163case RefKind.RefReadOnly: 180RefKind.RefReadOnly => ValueUsageInfo.ReadableReference, 221case RefKind.RefReadOnly:
Microsoft.CodeAnalysis.CodeStyle.Fixes (3)
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.cs (1)
262return RefKind.RefReadOnly;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationMethodSymbol.cs (1)
94return RefKind == RefKind.RefReadOnly;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertySymbol.cs (1)
79public bool ReturnsByRefReadonly => refKind == RefKind.RefReadOnly;
Microsoft.CodeAnalysis.CSharp (56)
Binder\Binder.ValueChecks.cs (11)
1060if (localSymbol.RefKind == RefKind.RefReadOnly || 1369case RefKind.RefReadOnly: 1394case RefKind.RefReadOnly: 1408case RefKind.RefReadOnly: 1683if (RequiresAssignableVariable(valueKind) && methodSymbol.RefKind == RefKind.RefReadOnly) 1738if (RequiresAssignableVariable(valueKind) && propertySymbol.RefKind == RefKind.RefReadOnly) 5769(!IsAnyReadOnly(addressKind) && local.RefKind == RefKind.RefReadOnly)); 5774(IsAnyReadOnly(addressKind) && methodRefKind == RefKind.RefReadOnly); 5780(IsAnyReadOnly(addressKind) && dupRefKind == RefKind.RefReadOnly); 5796(IsAnyReadOnly(addressKind) && lhsRefKind is RefKind.RefReadOnly or RefKind.RefReadOnlyParameter); 5885if (field.RefKind == RefKind.RefReadOnly)
Binder\Binder_Statements.cs (1)
928valueKind = variableRefKind == RefKind.RefReadOnly
Binder\ForEachLoopBinder.cs (3)
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)) ||
BoundTree\BoundExpressionExtensions.cs (1)
56return RefKind.RefReadOnly;
BoundTree\UnboundLambda.cs (1)
818if (lambdaSymbol.RefKind == CodeAnalysis.RefKind.RefReadOnly)
CodeGen\EmitAddress.cs (2)
127(IsAnyReadOnly(addressKind) && funcPtrRefKind == RefKind.RefReadOnly)) 183(IsAnyReadOnly(addressKind) && methodRefKind == RefKind.RefReadOnly);
CodeGen\EmitExpression.cs (1)
2994LocalDefinition temp = EmitAddress(assignmentOperator.Right, lhs.GetRefKind() is RefKind.RefReadOnly or RefKindExtensions.StrictIn or RefKind.RefReadOnlyParameter ? AddressKind.ReadOnlyStrict : AddressKind.Writeable);
CodeGen\EmitStatement.cs (1)
873var unexpectedTemp = this.EmitAddress(expressionOpt, this._method.RefKind == RefKind.RefReadOnly ? AddressKind.ReadOnlyStrict : AddressKind.Writeable);
CodeGen\Optimizer.cs (1)
986if (localSymbol.RefKind is RefKind.RefReadOnly or RefKindExtensions.StrictIn &&
Emitter\EditAndContinue\CSharpSymbolMatcher.cs (2)
701Debug.Assert(RefKind.RefReadOnly == RefKind.In); 704case RefKind.RefReadOnly:
Lowering\ClosureConversion\SynthesizedClosureMethod.cs (1)
121if (RefKind == RefKind.RefReadOnly)
Lowering\LocalRewriter\LocalRewriter_FixedStatement.cs (2)
264refKind: RefKind.RefReadOnly, 326refKind: RefKind.RefReadOnly,
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (1)
640if (refKind != RefKind.None && refKind != RefKind.RefReadOnly)
SymbolDisplay\SymbolDisplayVisitor.cs (1)
254if (symbol.RefKind == RefKind.RefReadOnly)
SymbolDisplay\SymbolDisplayVisitor.Members.cs (1)
42case RefKind.RefReadOnly:
Symbols\FunctionPointers\FunctionPointerMethodSymbol.cs (2)
48refKind = RefKind.RefReadOnly; 553RefKind = getRefKind(retInfo, RefCustomModifiers, RefKind.RefReadOnly, RefKind.Ref, requiresLocationAllowed: false);
Symbols\Metadata\PE\PEFieldSymbol.cs (1)
326moduleSymbol.Module.HasIsReadOnlyAttribute(_handle) ? RefKind.RefReadOnly : RefKind.Ref :
Symbols\Metadata\PE\PEParameterSymbol.cs (1)
402isBad |= (parameter.RefKind == RefKind.RefReadOnly) != hasInAttributeModifier;
Symbols\Metadata\PE\PEPropertySymbol.cs (2)
281_refKind = RefKind.RefReadOnly; 739this.RefKind == RefKind.RefReadOnly ? AttributeDescription.IsReadOnlyAttribute : default,
Symbols\MethodSymbol.cs (1)
230return this.RefKind == RefKind.RefReadOnly;
Symbols\PropertySymbol.cs (1)
76public bool ReturnsByRefReadonly { get { return this.RefKind == RefKind.RefReadOnly; } }
Symbols\RefKindExtensions.cs (1)
16Debug.Assert(refKind <= RefKind.RefReadOnly);
Symbols\Source\FieldSymbolWithAttributesAndModifiers.cs (1)
392if (this.RefKind == RefKind.RefReadOnly)
Symbols\Source\LocalFunctionSymbol.cs (1)
261if (_refKind == RefKind.RefReadOnly)
Symbols\Source\SourceDelegateMethodSymbol.cs (2)
280if (this.RefKind == RefKind.RefReadOnly) 319if (this.RefKind == RefKind.RefReadOnly)
Symbols\Source\SourceFieldSymbol.cs (1)
139if (RefKind == RefKind.RefReadOnly)
Symbols\Source\SourceMemberContainerSymbol_ImplementationChecks.cs (1)
1391(method.RefKind is RefKind.Ref or RefKind.RefReadOnly))
Symbols\Source\SourceMemberFieldSymbol.cs (1)
489Debug.Assert(refKind is RefKind.None or RefKind.Ref or RefKind.RefReadOnly);
Symbols\Source\SourceOrdinaryMethodOrUserDefinedOperatorSymbol.cs (2)
118else if (RefKind == RefKind.RefReadOnly) 242if (RefKind == RefKind.RefReadOnly)
Symbols\Source\SourcePropertySymbolBase.cs (2)
268else if (_refKind == RefKind.RefReadOnly) 1025if (_refKind == RefKind.RefReadOnly)
Symbols\Synthesized\RefKindVector.cs (2)
49(false, true, true) => RefKind.RefReadOnly, 62RefKind.RefReadOnly => (false, true, true),
Symbols\Synthesized\SynthesizedBackingFieldSymbol.cs (1)
92Debug.Assert(property.RefKind is RefKind.None or RefKind.Ref or RefKind.RefReadOnly);
Symbols\Synthesized\SynthesizedInlineArrayElementRefReadOnlyMethod.cs (1)
21public override RefKind RefKind => RefKind.RefReadOnly;
Symbols\Synthesized\SynthesizedInlineArrayFirstElementRefReadOnlyMethod.cs (1)
20public override RefKind RefKind => RefKind.RefReadOnly;
Syntax\SyntaxNodeExtensions.cs (1)
254? RefKind.RefReadOnly
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (1)
145RefKind.RefReadOnly when forFunctionPointerReturnParameter => [RefKeyword, ReadOnlyKeyword],
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (20)
CodeGen\CodeGenFunctionPointersTests.cs (5)
229(RefKind.RefReadOnly, IsSpecialType(SpecialType.System_Boolean)), 565(RefKind.RefReadOnly, IsSpecialType(SpecialType.System_Int32))); 569(RefKind.RefReadOnly, IsSpecialType(SpecialType.System_Int32))); 652(RefKind.RefReadOnly, IsSpecialType(SpecialType.System_String))))); 690(RefKind.RefReadOnly, IsSpecialType(SpecialType.System_Boolean)),
CodeGen\CodeGenReadonlyStructTests.cs (13)
1572verifyReadOnly(s1.GetMethod("M2"), true, RefKind.RefReadOnly); 1574verifyReadOnly(s1.GetProperty("P1").GetMethod, true, RefKind.RefReadOnly); 1577verifyReadOnly(s1.GetProperty("P2").GetMethod, true, RefKind.RefReadOnly); 1579verifyReadOnly(s1.GetProperty("P3").GetMethod, true, RefKind.RefReadOnly); 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);
Emit\InAttributeModifierTests.cs (2)
3834Assert.Equal(RefKind.RefReadOnly, interfaceMethod.RefKind); 3863Assert.Equal(RefKind.RefReadOnly, parentMethod.RefKind);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (22)
Attributes\AttributeTests_RefReadOnly.cs (22)
38Assert.Equal(RefKind.RefReadOnly, method.RefKind); 92Assert.Equal(RefKind.RefReadOnly, method.RefKind); 120Assert.Equal(RefKind.RefReadOnly, method.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); 446Assert.Equal(RefKind.RefReadOnly, indexer.RefKind); 474Assert.Equal(RefKind.RefReadOnly, indexer.RefKind); 501Assert.Equal(RefKind.RefReadOnly, method.RefKind); 537Assert.Equal(RefKind.RefReadOnly, method.RefKind); 561Assert.Equal(RefKind.RefReadOnly, method.RefKind); 598Assert.Equal(RefKind.RefReadOnly, method.RefKind); 652Assert.Equal(RefKind.RefReadOnly, method.RefKind); 686Assert.Equal(RefKind.RefReadOnly, method.RefKind); 725Assert.Equal(RefKind.RefReadOnly, method.RefKind); 784Assert.Equal(RefKind.RefReadOnly, method.RefKind); 819Assert.Equal(RefKind.RefReadOnly, method.RefKind); 2346Assert.Equal(RefKind.RefReadOnly, method.RefKind); 2370Assert.Equal(RefKind.RefReadOnly, method.Parameters[0].RefKind); 2393Assert.Equal(RefKind.RefReadOnly, method.RefKind); 2418Assert.Equal(RefKind.RefReadOnly, method.Parameters[1].RefKind);
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 (13)
Semantics\RefFieldTests.cs (13)
148VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F2"), "ref readonly T S<T>.F2", RefKind.RefReadOnly, new string[0]); 154VerifyFieldSymbol(comp.GetMember<FieldSymbol>("S.F2"), "ref readonly T S<T>.F2", RefKind.RefReadOnly, 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]); 345VerifyFieldSymbol(field, "ref readonly System.Int32 A.F", RefKind.RefReadOnly, new string[0]); 12066VerifyLocalSymbol(locals[2], "scoped ref readonly R r5", RefKind.RefReadOnly, ScopedKind.ScopedRef); 12069VerifyLocalSymbol(locals[5], "scoped ref readonly R r51", RefKind.RefReadOnly, ScopedKind.ScopedRef); 12203VerifyLocalSymbol(locals[2], "scoped ref readonly R r5", RefKind.RefReadOnly, ScopedKind.ScopedRef); 14603VerifyLocalSymbol(locals[2], "scoped ref readonly R r5", RefKind.RefReadOnly, ScopedKind.ScopedRef); 27052VerifyLocalSymbol(locals[2], "scoped ref readonly R r5", RefKind.RefReadOnly, ScopedKind.ScopedRef); 27142VerifyLocalSymbol(locals[2], "scoped ref readonly R r5", RefKind.RefReadOnly, ScopedKind.ScopedRef);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (17)
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);
SymbolDisplay\SymbolDisplayTests.cs (1)
6776Assert.Equal(RefKind.RefReadOnly, local.RefKind);
Symbols\FunctionPointerTypeSymbolTests.cs (7)
28[InlineData("ref readonly", RefKind.RefReadOnly, 116verifyRefKind(RefKind.RefReadOnly, mParams[3]); 200Assert.Equal(RefKind.RefReadOnly, secondSignature.RefKind); 1584RefKind.RefReadOnly, 1619RefKind.RefReadOnly, 1640ptr = comp.CreateFunctionPointerTypeSymbol(@string, returnRefKind: RefKind.RefReadOnly, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, convention); 1655ptr = comp.CreateFunctionPointerTypeSymbol(@string, returnRefKind: RefKind.RefReadOnly, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, SignatureCallingConvention.Unmanaged, ImmutableArray.Create(cdeclType, stdcallType)!);
Symbols\Source\DelegateTests.cs (2)
800Assert.Equal(RefKind.RefReadOnly, d.DelegateInvokeMethod.RefKind); 801Assert.Equal(RefKind.RefReadOnly, ((MethodSymbol)d.GetMembers("EndInvoke").Single()).RefKind);
Symbols\Source\ExpressionBodiedPropertyTests.cs (3)
534Assert.Equal(RefKind.RefReadOnly, p.GetMethod.RefKind); 561Assert.Equal(RefKind.RefReadOnly, p.GetMethod.RefKind); 589Assert.Equal(RefKind.RefReadOnly, p.GetMethod.RefKind);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
FunctionPointerUtilities.cs (1)
283case RefKind.RefReadOnly:
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
CodeGeneration\CSharpSyntaxGenerator.cs (1)
3439RefKind.RefReadOnly => SyntaxFactory.RefType(RefKeyword, ReadOnlyKeyword, type),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (1)
145RefKind.RefReadOnly when forFunctionPointerReturnParameter => [RefKeyword, ReadOnlyKeyword],
Microsoft.CodeAnalysis.Features (1)
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.cs (1)
262return RefKind.RefReadOnly;
Microsoft.CodeAnalysis.Workspaces (6)
Editing\DeclarationModifiers.cs (1)
88isRef: field?.RefKind is RefKind.Ref or RefKind.RefReadOnly || type?.IsRefLikeType == true,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (3)
163case RefKind.RefReadOnly: 180RefKind.RefReadOnly => ValueUsageInfo.ReadableReference, 221case RefKind.RefReadOnly:
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationMethodSymbol.cs (1)
94return RefKind == RefKind.RefReadOnly;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertySymbol.cs (1)
79public bool ReturnsByRefReadonly => refKind == RefKind.RefReadOnly;
Microsoft.VisualStudio.LanguageServices.UnitTests (1)
ChangeSignature\ChangeSignatureViewModelTests.vb (1)
298Dim includedInTest = {RefKind.None, RefKind.Ref, RefKind.Out, RefKind.In, RefKind.RefReadOnly, RefKind.RefReadOnlyParameter}