82 references to GetCapturedParameters
Microsoft.CodeAnalysis.CSharp (13)
Binder\Binder.ValueChecks.cs (1)
940
primaryConstructor.
GetCapturedParameters
().TryGetValue(parameterSymbol, out FieldSymbol backingField))
Binder\Binder_Expressions.cs (3)
1958
else if (primaryCtor.
GetCapturedParameters
().ContainsKey(parameter)) // check other references in the entire type
4278
if (constructor is SynthesizedPrimaryConstructor primaryConstructor && primaryConstructor.
GetCapturedParameters
().Any())
4304
primaryConstructor.
GetCapturedParameters
().ContainsKey(parameter))
Binder\Binder_Operators.cs (1)
2607
primaryConstructor.
GetCapturedParameters
().ContainsKey(parameterSymbol))
Compiler\MethodCompiler.cs (1)
1270
IReadOnlyDictionary<ParameterSymbol, FieldSymbol> capturedParameters = primaryCtor.
GetCapturedParameters
();
FlowAnalysis\DefiniteAssignment.cs (2)
669
primaryConstructor.
GetCapturedParameters
().ContainsKey(parameter))) // Primary constructor parameter captured by the type itself is not hoisted into a closure
1822
!primaryCtor.
GetCapturedParameters
().ContainsKey(parameter))
FlowAnalysis\NullableWalker.cs (1)
2078
primaryConstructor.
GetCapturedParameters
().TryGetValue(parameter, out FieldSymbol? field))
Lowering\ClosureConversion\ClosureConversion.cs (1)
796
primaryConstructor.
GetCapturedParameters
().Any());
Lowering\LocalRewriter\LocalRewriter.cs (1)
277
primaryCtor.
GetCapturedParameters
().TryGetValue(node.ParameterSymbol, out var field))
Lowering\LocalRewriter\LocalRewriter_Call.cs (1)
391
primaryCtor.
GetCapturedParameters
().ContainsKey(parameter);
Symbols\Synthesized\Records\SynthesizedPrimaryConstructor.cs (1)
76
IReadOnlyDictionary<ParameterSymbol, FieldSymbol> capturedParameters =
GetCapturedParameters
();
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (69)
Semantics\PrimaryConstructorTests.cs (68)
1870
Assert.Empty(((SynthesizedPrimaryConstructor)symbol.GetSymbol().ContainingSymbol).
GetCapturedParameters
());
7222
var capturedParameters = comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
();
7692
Assert.Empty(((CSharpCompilation)verifier.Compilation).GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
8872
Assert.Empty(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
8932
Assert.Equal(1, comp.GetTypeByMetadataName("C2").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
8933
Assert.Empty(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
8985
Assert.Empty(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
8986
Assert.Equal(1, comp.GetTypeByMetadataName("C2").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
8987
Assert.Equal(1, comp.GetTypeByMetadataName("C3").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
8988
Assert.Equal(2, comp.GetTypeByMetadataName("C4").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
9007
Assert.Equal(1, comp.GetTypeByMetadataName("C3").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
9034
Assert.Equal(2, comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
9136
Assert.Equal(1, comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
9179
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9214
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9257
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9295
Assert.NotEmpty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9326
Assert.NotEmpty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9366
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9402
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9438
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9477
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9516
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9552
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9588
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9627
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9666
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9705
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9741
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9777
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9817
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9864
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9908
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9948
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9991
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10038
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10080
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10125
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10160
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10190
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10225
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10255
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10290
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10321
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10357
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10388
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10431
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10470
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10509
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10549
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10592
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10782
Assert.Equal(isStatic, comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().IsEmpty());
10826
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10827
Assert.Empty(comp.GetTypeByMetadataName("S2").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10828
Assert.NotEmpty(comp.GetTypeByMetadataName("S3").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10900
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10936
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10979
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11027
Assert.Equal("System.String P1", comp1.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Single().Key.ToTestDisplayString());
11028
Assert.Equal("System.Int32 p2", comp1.GetTypeByMetadataName("C2").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Single().Key.ToTestDisplayString());
11029
Assert.Equal(2, comp1.GetTypeByMetadataName("C3").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
11059
Assert.Empty(comp2.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11060
Assert.Empty(comp2.GetTypeByMetadataName("C2").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11100
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11144
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11190
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
15102
Assert.Single(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
15398
Assert.Empty(comp.GetTypeByMetadataName("C").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
Semantics\RecordTests.cs (1)
22101
Assert.Empty(((SynthesizedPrimaryConstructor)symbol.GetSymbol().ContainingSymbol).
GetCapturedParameters
());