91 references to GetCapturedParameters
Microsoft.CodeAnalysis.CSharp (16)
Binder\Binder.ValueChecks.cs (1)
1387
primaryConstructor.
GetCapturedParameters
().TryGetValue(parameterSymbol, out FieldSymbol backingField))
Binder\Binder_Expressions.cs (4)
471
primaryConstructor.
GetCapturedParameters
().ContainsKey(parameter))
1853
Debug.Assert(!primaryConstructor.
GetCapturedParameters
().ContainsKey(shadowedParameter)); // How could we capture a shadowed parameter?
2215
else if (primaryCtor.
GetCapturedParameters
().ContainsKey(parameter)) // check other references in the entire type
5081
if (primaryConstructor.
GetCapturedParameters
().ContainsKey(parameter))
Binder\Binder_Operators.cs (1)
4250
primaryConstructor.
GetCapturedParameters
().ContainsKey(parameterSymbol))
Compiler\MethodCompiler.cs (1)
1274
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))
10760
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)
14989
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
15031
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
20332
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
20422
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
21204
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
Semantics\PrimaryConstructorTests.cs (69)
2109
Assert.Empty(((SynthesizedPrimaryConstructor)symbol.GetSymbol().ContainingSymbol).
GetCapturedParameters
());
7978
var capturedParameters = comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
();
8843
Assert.Empty(((CSharpCompilation)verifier.Compilation).GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10026
Assert.Empty(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10086
Assert.Equal(1, comp.GetTypeByMetadataName("C2").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
10087
Assert.Empty(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10139
Assert.Empty(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10140
Assert.Equal(1, comp.GetTypeByMetadataName("C2").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
10141
Assert.Equal(1, comp.GetTypeByMetadataName("C3").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
10142
Assert.Equal(2, comp.GetTypeByMetadataName("C4").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
10161
Assert.Equal(1, comp.GetTypeByMetadataName("C3").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
10188
Assert.Equal(2, comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
10290
Assert.Equal(1, comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
10333
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10368
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10411
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10449
Assert.NotEmpty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10480
Assert.NotEmpty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10520
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10556
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10592
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10631
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10670
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10706
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10742
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10781
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10820
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10859
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10895
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10931
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
10971
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11018
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11062
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11102
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11145
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11192
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11234
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
());
11344
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11379
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11409
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11444
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11475
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11511
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11542
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11585
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11624
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11663
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11703
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11746
Assert.Empty(comp.GetTypeByMetadataName("Color+C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11936
Assert.Equal(isStatic, comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().IsEmpty());
11980
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11981
Assert.Empty(comp.GetTypeByMetadataName("S2").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
11982
Assert.NotEmpty(comp.GetTypeByMetadataName("S3").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
12054
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
12090
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
12133
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
12181
Assert.Equal("System.String P1", comp1.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Single().Key.ToTestDisplayString());
12182
Assert.Equal("System.Int32 p2", comp1.GetTypeByMetadataName("C2").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Single().Key.ToTestDisplayString());
12183
Assert.Equal(2, comp1.GetTypeByMetadataName("C3").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
().Count);
12213
Assert.Empty(comp2.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
12214
Assert.Empty(comp2.GetTypeByMetadataName("C2").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
12254
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
12298
Assert.Empty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
12344
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
16519
Assert.NotEmpty(comp.GetTypeByMetadataName("S1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
19907
Assert.Single(comp.GetTypeByMetadataName("C1").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
20398
Assert.Empty(comp.GetTypeByMetadataName("C").InstanceConstructors.OfType<SynthesizedPrimaryConstructor>().Single().
GetCapturedParameters
());
Semantics\RecordTests.cs (1)
22195
Assert.Empty(((SynthesizedPrimaryConstructor)symbol.GetSymbol().ContainingSymbol).
GetCapturedParameters
());