91 references to GetCapturedParameters
Microsoft.CodeAnalysis.CSharp (16)
Binder\Binder.ValueChecks.cs (1)
1162
primaryConstructor.
GetCapturedParameters
().TryGetValue(parameterSymbol, out FieldSymbol backingField))
Binder\Binder_Expressions.cs (4)
461
primaryConstructor.
GetCapturedParameters
().ContainsKey(parameter))
1816
Debug.Assert(!primaryConstructor.
GetCapturedParameters
().ContainsKey(shadowedParameter)); // How could we capture a shadowed parameter?
2194
else if (primaryCtor.
GetCapturedParameters
().ContainsKey(parameter)) // check other references in the entire type
5051
if (primaryConstructor.
GetCapturedParameters
().ContainsKey(parameter))
Binder\Binder_Operators.cs (1)
4077
primaryConstructor.
GetCapturedParameters
().ContainsKey(parameterSymbol))
Compiler\MethodCompiler.cs (1)
1258
IReadOnlyDictionary<ParameterSymbol, FieldSymbol> capturedParameters = primaryCtor.
GetCapturedParameters
();
FlowAnalysis\DefiniteAssignment.cs (2)
691
primaryConstructor.
GetCapturedParameters
().ContainsKey(parameter))) // Primary constructor parameter captured by the type itself is not hoisted into a closure
1961
!primaryCtor.
GetCapturedParameters
().ContainsKey(parameter))
FlowAnalysis\NullableWalker.cs (2)
2224
primaryConstructor.
GetCapturedParameters
().TryGetValue(parameter, out FieldSymbol? field))
10610
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)
641
primaryCtor.
GetCapturedParameters
().ContainsKey(parameter);
Symbols\Source\SourceMemberContainerSymbol.cs (1)
3082
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)
13867
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
13909
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
19161
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
19251
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
20033
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
Semantics\PrimaryConstructorTests.cs (69)
1979
Assert.Empty(((SynthesizedPrimaryConstructor)symbol.GetSymbol().ContainingSymbol).
GetCapturedParameters
());
7838
var capturedParameters = comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
();
8703
Assert.Empty(((CSharpCompilation)verifier.Compilation).GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9886
Assert.Empty(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9946
Assert.Equal(1, comp.GetTypeByMetadataName("C2").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
9947
Assert.Empty(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
9999
Assert.Empty(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10000
Assert.Equal(1, comp.GetTypeByMetadataName("C2").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
10001
Assert.Equal(1, comp.GetTypeByMetadataName("C3").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
10002
Assert.Equal(2, comp.GetTypeByMetadataName("C4").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
10021
Assert.Equal(1, comp.GetTypeByMetadataName("C3").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
10048
Assert.Equal(2, comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
10150
Assert.Equal(1, comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
10193
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10228
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10271
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10309
Assert.NotEmpty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10340
Assert.NotEmpty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10380
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10416
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10452
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10491
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10530
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10566
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10602
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10641
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10680
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10719
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10755
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10791
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10831
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10878
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10922
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10962
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11005
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11052
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11094
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11139
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11174
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11204
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11239
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11269
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11304
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11335
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11371
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11402
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11445
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11484
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11523
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11563
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11606
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11796
Assert.Equal(isStatic, comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().IsEmpty());
11840
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11841
Assert.Empty(comp.GetTypeByMetadataName("S2").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11842
Assert.NotEmpty(comp.GetTypeByMetadataName("S3").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11914
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11950
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11993
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
12041
Assert.Equal("System.String P1", comp1.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Single().Key.ToTestDisplayString());
12042
Assert.Equal("System.Int32 p2", comp1.GetTypeByMetadataName("C2").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Single().Key.ToTestDisplayString());
12043
Assert.Equal(2, comp1.GetTypeByMetadataName("C3").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
12073
Assert.Empty(comp2.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
12074
Assert.Empty(comp2.GetTypeByMetadataName("C2").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
12114
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
12158
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
12204
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
16379
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
19767
Assert.Single(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
20258
Assert.Empty(comp.GetTypeByMetadataName("C").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
Semantics\RecordTests.cs (1)
22195
Assert.Empty(((SynthesizedPrimaryConstructor)symbol.GetSymbol().ContainingSymbol).
GetCapturedParameters
());