115 references to ThisParameter
Microsoft.CodeAnalysis.CSharp (40)
Binder\Binder.ValueChecks.cs (4)
3771
var thisParam = ((MethodSymbol)_symbol).
ThisParameter
;
4066
var thisParam = ((MethodSymbol)_symbol).
ThisParameter
;
4378
var thisParam = ((MethodSymbol)_symbol).
ThisParameter
;
5038
var thisParam = ((MethodSymbol)_symbol).
ThisParameter
;
Binder\Binder_Expressions.cs (1)
2159
else if (primaryCtor is {
ThisParameter
.RefKind: not RefKind.None } &&
Compiler\MethodBodySynthesizer.cs (3)
185
var thisSymbol = accessor.
ThisParameter
;
282
field.IsStatic || field.ContainingSymbol is NamedTypeSymbol { IsExtension: true } ? null : new BoundThisReference(syntax, accessor.
ThisParameter
.Type),
352
ParameterSymbol thisParameter = accessor.
ThisParameter
;
Compiler\MethodCompiler.cs (1)
1573
method.
ThisParameter
,
FlowAnalysis\NullableWalker.cs (1)
2149
var thisParameter = method?.
ThisParameter
;
FlowAnalysis\ReadWriteWalker.cs (1)
99
var thisParameter = m.
ThisParameter
;
Lowering\AsyncRewriter\RuntimeAsyncRewriter.cs (2)
55
var thisParameter = rewriter._factory.CurrentFunction.
ThisParameter
;
305
var thisParameter = this._factory.CurrentFunction.
ThisParameter
;
Lowering\ClosureConversion\ClosureConversion.Analysis.Tree.cs (2)
495
AddIfCaptured(_topLevelMethod.
ThisParameter
, node.Syntax);
501
var thisParam = _topLevelMethod.
ThisParameter
;
Lowering\ClosureConversion\ClosureConversion.cs (4)
795
symbol == _currentMethod.
ThisParameter
&&
815
symbol != _currentMethod.
ThisParameter
||
847
return (_currentMethod == _topLevelMethod || _topLevelMethod.
ThisParameter
== null ?
1581
_currentFrameThis = synthesizedMethod.
ThisParameter
;
Lowering\StateMachineRewriter\IteratorAndAsyncCaptureWalker.cs (6)
75
walker.CaptureVariable(method.
ThisParameter
, node.Syntax);
318
var thisSymbol = topLevelMethod.
ThisParameter
;
327
CaptureVariable(topLevelMethod.
ThisParameter
, node.Syntax);
333
CaptureVariable(topLevelMethod.
ThisParameter
, node.Syntax);
421
Capture(_topLevelMethod.
ThisParameter
, node.Syntax);
427
Capture(_topLevelMethod.
ThisParameter
, node.Syntax);
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (4)
144
var thisParameter = originalMethod.
ThisParameter
;
799
CapturedSymbolReplacement proxy = proxies[this.OriginalMethod.
ThisParameter
];
816
var thisParameter = this.OriginalMethod.
ThisParameter
;
850
CapturedSymbolReplacement proxy = proxies[this.OriginalMethod.
ThisParameter
];
Lowering\StateMachineRewriter\StateMachineRewriter.cs (5)
313
Debug.Assert((object)method.
ThisParameter
!= null);
316
if (proxies.TryGetValue(method.
ThisParameter
, out proxy))
444
if (method.IsStatic || method.
ThisParameter
.Type.IsReferenceType)
470
if (copyDest.TryGetValue(method.
ThisParameter
, out proxy))
477
var rightExpression = copySrc[method.
ThisParameter
].Replacement(F.Syntax, static (stateMachineType, F) => F.This(), F);
Lowering\SyntheticBoundNodeFactory.cs (4)
224
Debug.Assert(CurrentFunction is { IsStatic: false,
ThisParameter
: { } });
225
return new BoundThisReference(Syntax, CurrentFunction.
ThisParameter
.Type) { WasCompilerGenerated = true };
1220
Debug.Assert(CurrentFunction is {
ThisParameter
: { } });
1221
NamedTypeSymbol baseType = CurrentFunction.
ThisParameter
.Type.BaseTypeNoUseSiteDiagnostics;
Symbols\SymbolExtensions.cs (2)
177
return method.
ThisParameter
;
196
return type.IsScriptClass ? type.InstanceConstructors.Single().
ThisParameter
: null;
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (44)
CodeGen\CodeGenReadonlyStructTests.cs (44)
853
Assert.Equal(RefKind.Out, namedType.Constructors[0].
ThisParameter
.RefKind);
854
Assert.Equal(RefKind.In, namedType.GetMethod("M1").
ThisParameter
.RefKind);
855
Assert.Equal(RefKind.In, namedType.GetMethod("ToString").
ThisParameter
.RefKind);
870
Assert.Equal(RefKind.Out, namedType.Constructors[0].
ThisParameter
.RefKind);
871
Assert.Equal(RefKind.In, namedType.GetMethod("M1").
ThisParameter
.RefKind);
872
Assert.Equal(RefKind.In, namedType.GetMethod("ToString").
ThisParameter
.RefKind);
877
Assert.Equal(RefKind.Out, namedType.Constructors[0].
ThisParameter
.RefKind);
878
Assert.Equal(RefKind.In, namedType.GetMethod("M1").
ThisParameter
.RefKind);
879
Assert.Equal(RefKind.In, namedType.GetMethod("ToString").
ThisParameter
.RefKind);
884
Assert.Equal(RefKind.Out, namedType.Constructors[0].
ThisParameter
.RefKind);
885
Assert.Equal(RefKind.In, namedType.GetMethod("M1").
ThisParameter
.RefKind);
886
Assert.Equal(RefKind.In, namedType.GetMethod("ToString").
ThisParameter
.RefKind);
891
Assert.Equal(RefKind.Out, namedType.Constructors[0].
ThisParameter
.RefKind);
892
Assert.Equal(RefKind.Ref, namedType.GetMethod("M1").
ThisParameter
.RefKind);
893
Assert.Equal(RefKind.Ref, namedType.GetMethod("ToString").
ThisParameter
.RefKind);
898
Assert.Equal(RefKind.None, namedType.Constructors[0].
ThisParameter
.RefKind);
899
Assert.Equal(RefKind.None, namedType.GetMethod("M1").
ThisParameter
.RefKind);
900
Assert.Equal(RefKind.None, namedType.GetMethod("ToString").
ThisParameter
.RefKind);
905
Assert.Equal(RefKind.None, namedType.Constructors[0].
ThisParameter
.RefKind);
906
Assert.Equal(RefKind.None, namedType.GetMethod("Invoke").
ThisParameter
.RefKind);
937
Assert.Equal(RefKind.Out, s1.Constructors[0].
ThisParameter
.RefKind);
938
Assert.Equal(RefKind.In, s1.GetMethod("M1").
ThisParameter
.RefKind);
939
Assert.Equal(RefKind.In, s1.GetMethod("ToString").
ThisParameter
.RefKind);
1027
Assert.Equal(RefKind.Out, namedType.Constructors[0].
ThisParameter
.RefKind);
1028
Assert.Equal(RefKind.In, namedType.GetMethod("M1").
ThisParameter
.RefKind);
1029
Assert.Equal(RefKind.In, namedType.GetMethod("ToString").
ThisParameter
.RefKind);
1034
Assert.Equal(RefKind.Out, namedType.Constructors[0].
ThisParameter
.RefKind);
1035
Assert.Equal(RefKind.In, namedType.GetMethod("M1").
ThisParameter
.RefKind);
1036
Assert.Equal(RefKind.In, namedType.GetMethod("ToString").
ThisParameter
.RefKind);
1041
Assert.Equal(RefKind.Out, namedType.Constructors[0].
ThisParameter
.RefKind);
1042
Assert.Equal(RefKind.In, namedType.GetMethod("M1").
ThisParameter
.RefKind);
1043
Assert.Equal(RefKind.In, namedType.GetMethod("ToString").
ThisParameter
.RefKind);
1048
Assert.Equal(RefKind.Out, namedType.Constructors[0].
ThisParameter
.RefKind);
1049
Assert.Equal(RefKind.In, namedType.GetMethod("M1").
ThisParameter
.RefKind);
1050
Assert.Equal(RefKind.In, namedType.GetMethod("ToString").
ThisParameter
.RefKind);
1055
Assert.Equal(RefKind.Out, namedType.Constructors[0].
ThisParameter
.RefKind);
1056
Assert.Equal(RefKind.Ref, namedType.GetMethod("M1").
ThisParameter
.RefKind);
1057
Assert.Equal(RefKind.Ref, namedType.GetMethod("ToString").
ThisParameter
.RefKind);
1062
Assert.Equal(RefKind.None, namedType.Constructors[0].
ThisParameter
.RefKind);
1063
Assert.Equal(RefKind.None, namedType.GetMethod("M1").
ThisParameter
.RefKind);
1064
Assert.Equal(RefKind.None, namedType.GetMethod("ToString").
ThisParameter
.RefKind);
1069
Assert.Equal(RefKind.None, namedType.Constructors[0].
ThisParameter
.RefKind);
1070
Assert.Equal(RefKind.None, namedType.GetMethod("Invoke").
ThisParameter
.RefKind);
1632
Assert.Equal(refKind, method.
ThisParameter
?.RefKind);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (1)
Semantics\ExtensionTests.cs (1)
40188
Assert.Null(method.
ThisParameter
);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (28)
Semantics\RefFieldTests.cs (28)
11592
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("C..ctor").
ThisParameter
, "C this", RefKind.None, ScopedKind.None);
11593
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("C.F1").
ThisParameter
, "C this", RefKind.None, ScopedKind.None);
11594
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1..ctor").
ThisParameter
, "out S1 this", RefKind.Out, ScopedKind.ScopedRef);
11595
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F1").
ThisParameter
, "ref S1 this", RefKind.Ref, ScopedKind.ScopedRef);
11596
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F2").
ThisParameter
, "in S1 this", RefKind.In, ScopedKind.ScopedRef);
11597
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R1..ctor").
ThisParameter
, "out R1 this", RefKind.Out, ScopedKind.ScopedRef);
11598
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R1.F1").
ThisParameter
, "ref R1 this", RefKind.Ref, ScopedKind.ScopedRef);
11599
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R1.F2").
ThisParameter
, "in R1 this", RefKind.In, ScopedKind.ScopedRef);
11600
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2..ctor").
ThisParameter
, "out S2 this", RefKind.Out, ScopedKind.ScopedRef);
11601
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F1").
ThisParameter
, "in S2 this", RefKind.In, ScopedKind.ScopedRef);
11602
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F2").
ThisParameter
, "in S2 this", RefKind.In, ScopedKind.ScopedRef);
11603
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R2..ctor").
ThisParameter
, "out R2 this", RefKind.Out, ScopedKind.ScopedRef);
11604
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R2.F1").
ThisParameter
, "in R2 this", RefKind.In, ScopedKind.ScopedRef);
11605
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R2.F2").
ThisParameter
, "in R2 this", RefKind.In, ScopedKind.ScopedRef);
23349
VerifyParameterSymbol(type.GetMethod("Get").
ThisParameter
, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false);
23350
VerifyParameterSymbol(type.GetMethod("get_Item").
ThisParameter
, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false);
23354
VerifyParameterSymbol(type.GetMethod("Get").
ThisParameter
, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true);
23355
VerifyParameterSymbol(type.GetMethod("get_Item").
ThisParameter
, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true);
23418
VerifyParameterSymbol(type.GetMethod("Get").
ThisParameter
, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false);
23419
VerifyParameterSymbol(type.GetMethod("get_Item").
ThisParameter
, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false);
23424
VerifyParameterSymbol(type.GetMethod("Get").
ThisParameter
, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true);
23425
VerifyParameterSymbol(type.GetMethod("get_Item").
ThisParameter
, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true);
25181
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F1").
ThisParameter
, "ref S1 this", RefKind.Ref, ScopedKind.ScopedRef);
25182
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F2").
ThisParameter
, "in S2 this", RefKind.In, ScopedKind.ScopedRef);
25224
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F1").
ThisParameter
, "ref S1 this", RefKind.Ref, ScopedKind.ScopedRef);
25225
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F2").
ThisParameter
, "in S2 this", RefKind.In, ScopedKind.ScopedRef);
25378
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S.F").
ThisParameter
, "ref S this", RefKind.Ref, scopedRefInCSharp10, expectedHasUnscopedRefAttribute: true);
25379
VerifyParameterSymbol(comp.GetMember<PropertySymbol>("S.P").GetMethod.
ThisParameter
, "ref S this", RefKind.Ref, scopedRefInCSharp10, expectedHasUnscopedRefAttribute: true);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (2)
Symbols\ExtensionMethodTests.cs (2)
2732
var parameter = methodSymbol.
ThisParameter
;
2743
Assert.Throws<InvalidOperationException>(() => methodSymbol.
ThisParameter
);