91 references to GetCapturedParameters
Microsoft.CodeAnalysis.CSharp (16)
Binder\Binder.ValueChecks.cs (1)
1385
primaryConstructor.
GetCapturedParameters
().TryGetValue(parameterSymbol, out FieldSymbol backingField))
Binder\Binder_Expressions.cs (4)
462
primaryConstructor.
GetCapturedParameters
().ContainsKey(parameter))
1839
Debug.Assert(!primaryConstructor.
GetCapturedParameters
().ContainsKey(shadowedParameter)); // How could we capture a shadowed parameter?
2217
else if (primaryCtor.
GetCapturedParameters
().ContainsKey(parameter)) // check other references in the entire type
5083
if (primaryConstructor.
GetCapturedParameters
().ContainsKey(parameter))
Binder\Binder_Operators.cs (1)
4109
primaryConstructor.
GetCapturedParameters
().ContainsKey(parameterSymbol))
Compiler\MethodCompiler.cs (1)
1272
IReadOnlyDictionary<ParameterSymbol, FieldSymbol> capturedParameters = primaryCtor.
GetCapturedParameters
();
FlowAnalysis\DefiniteAssignment.cs (2)
642
primaryConstructor.
GetCapturedParameters
().ContainsKey(parameter))) // Primary constructor parameter captured by the type itself is not hoisted into a closure
1912
!primaryCtor.
GetCapturedParameters
().ContainsKey(parameter))
FlowAnalysis\NullableWalker.cs (2)
2248
primaryConstructor.
GetCapturedParameters
().TryGetValue(parameter, out FieldSymbol? field))
10761
parameter.ContainingSymbol is not SynthesizedPrimaryConstructor primaryConstructor || !primaryConstructor.
GetCapturedParameters
().ContainsKey(parameter):
Lowering\ClosureConversion\ClosureConversion.cs (1)
816
primaryConstructor.
GetCapturedParameters
().Any());
Lowering\LocalRewriter\LocalRewriter.cs (1)
315
primaryCtor.
GetCapturedParameters
().TryGetValue(node.ParameterSymbol, out var field))
Lowering\LocalRewriter\LocalRewriter_Call.cs (1)
642
primaryCtor.
GetCapturedParameters
().ContainsKey(parameter);
Symbols\Source\SourceMemberContainerSymbol.cs (1)
3073
PrimaryConstructor is { } primaryConstructor && primaryConstructor.
GetCapturedParameters
().Any() &&
Symbols\Synthesized\Records\SynthesizedPrimaryConstructor.cs (1)
114
IReadOnlyDictionary<ParameterSymbol, FieldSymbol> capturedParameters =
GetCapturedParameters
();
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (75)
Semantics\ExtensionTests.cs (5)
14990
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
15032
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
20328
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
20418
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
21200
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
Semantics\PrimaryConstructorTests.cs (69)
1979
Assert.Empty(((SynthesizedPrimaryConstructor)symbol.GetSymbol().ContainingSymbol).
GetCapturedParameters
());
7848
var capturedParameters = comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
();
8713
Assert.Empty(((CSharpCompilation)verifier.Compilation).GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9896
Assert.Empty(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9956
Assert.Equal(1, comp.GetTypeByMetadataName("C2").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
9957
Assert.Empty(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10009
Assert.Empty(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10010
Assert.Equal(1, comp.GetTypeByMetadataName("C2").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
10011
Assert.Equal(1, comp.GetTypeByMetadataName("C3").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
10012
Assert.Equal(2, comp.GetTypeByMetadataName("C4").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
10031
Assert.Equal(1, comp.GetTypeByMetadataName("C3").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
10058
Assert.Equal(2, comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
10160
Assert.Equal(1, comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
10203
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10238
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10281
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10319
Assert.NotEmpty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10350
Assert.NotEmpty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10390
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10426
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10462
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10501
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10540
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10576
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10612
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10651
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10690
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10729
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10765
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10801
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10841
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10888
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10932
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10972
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11015
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11062
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11104
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11149
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11184
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11214
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11249
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11279
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11314
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11345
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11381
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11412
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11455
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11494
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11533
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11573
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11616
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11806
Assert.Equal(isStatic, comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().IsEmpty());
11850
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11851
Assert.Empty(comp.GetTypeByMetadataName("S2").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11852
Assert.NotEmpty(comp.GetTypeByMetadataName("S3").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11924
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11960
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
12003
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
12051
Assert.Equal("System.String P1", comp1.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Single().Key.ToTestDisplayString());
12052
Assert.Equal("System.Int32 p2", comp1.GetTypeByMetadataName("C2").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Single().Key.ToTestDisplayString());
12053
Assert.Equal(2, comp1.GetTypeByMetadataName("C3").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
12083
Assert.Empty(comp2.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
12084
Assert.Empty(comp2.GetTypeByMetadataName("C2").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
12124
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
12168
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
12214
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
16389
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
19777
Assert.Single(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
20268
Assert.Empty(comp.GetTypeByMetadataName("C").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
Semantics\RecordTests.cs (1)
22195
Assert.Empty(((SynthesizedPrimaryConstructor)symbol.GetSymbol().ContainingSymbol).
GetCapturedParameters
());