110 references to ThisParameter
Microsoft.CodeAnalysis.CSharp (36)
Binder\Binder.ValueChecks.cs (4)
3486
var thisParam = ((MethodSymbol)_symbol).
ThisParameter
;
3819
var thisParam = ((MethodSymbol)_symbol).
ThisParameter
;
4170
var thisParam = ((MethodSymbol)_symbol).
ThisParameter
;
4901
var thisParam = ((MethodSymbol)_symbol).
ThisParameter
;
Binder\Binder_Expressions.cs (1)
2183
else if (primaryCtor is {
ThisParameter
.RefKind: not RefKind.None } &&
Compiler\MethodBodySynthesizer.cs (3)
183
var thisSymbol = accessor.
ThisParameter
;
280
field.IsStatic ? null : new BoundThisReference(syntax, accessor.
ThisParameter
.Type),
350
ParameterSymbol thisParameter = accessor.
ThisParameter
;
Compiler\MethodCompiler.cs (1)
1546
method.
ThisParameter
,
FlowAnalysis\NullableWalker.cs (1)
2123
var thisParameter = method?.
ThisParameter
;
FlowAnalysis\ReadWriteWalker.cs (1)
99
var thisParameter = m.
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 ?
1580
_currentFrameThis = synthesizedMethod.
ThisParameter
;
Lowering\StateMachineRewriter\IteratorAndAsyncCaptureWalker.cs (6)
68
walker.CaptureVariable(method.
ThisParameter
, node.Syntax);
299
var thisSymbol = topLevelMethod.
ThisParameter
;
308
CaptureVariable(topLevelMethod.
ThisParameter
, node.Syntax);
314
CaptureVariable(topLevelMethod.
ThisParameter
, node.Syntax);
402
Capture(_topLevelMethod.
ThisParameter
, node.Syntax);
408
Capture(_topLevelMethod.
ThisParameter
, node.Syntax);
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (4)
142
var thisParameter = originalMethod.
ThisParameter
;
953
CapturedSymbolReplacement proxy = proxies[this.OriginalMethod.
ThisParameter
];
970
var thisParameter = this.OriginalMethod.
ThisParameter
;
1004
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 (2)
225
return new BoundThisReference(Syntax, CurrentFunction.
ThisParameter
.Type) { WasCompilerGenerated = true };
1205
NamedTypeSymbol baseType = CurrentFunction.
ThisParameter
.Type.BaseTypeNoUseSiteDiagnostics;
Symbols\SymbolExtensions.cs (2)
176
return method.
ThisParameter
;
195
return type.IsScriptClass ? type.InstanceConstructors.Single().
ThisParameter
: null;
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (44)
CodeGen\CodeGenReadonlyStructTests.cs (44)
829
Assert.Equal(RefKind.Out, namedType.Constructors[0].
ThisParameter
.RefKind);
830
Assert.Equal(RefKind.In, namedType.GetMethod("M1").
ThisParameter
.RefKind);
831
Assert.Equal(RefKind.In, namedType.GetMethod("ToString").
ThisParameter
.RefKind);
846
Assert.Equal(RefKind.Out, namedType.Constructors[0].
ThisParameter
.RefKind);
847
Assert.Equal(RefKind.In, namedType.GetMethod("M1").
ThisParameter
.RefKind);
848
Assert.Equal(RefKind.In, namedType.GetMethod("ToString").
ThisParameter
.RefKind);
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);
860
Assert.Equal(RefKind.Out, namedType.Constructors[0].
ThisParameter
.RefKind);
861
Assert.Equal(RefKind.In, namedType.GetMethod("M1").
ThisParameter
.RefKind);
862
Assert.Equal(RefKind.In, namedType.GetMethod("ToString").
ThisParameter
.RefKind);
867
Assert.Equal(RefKind.Out, namedType.Constructors[0].
ThisParameter
.RefKind);
868
Assert.Equal(RefKind.Ref, namedType.GetMethod("M1").
ThisParameter
.RefKind);
869
Assert.Equal(RefKind.Ref, namedType.GetMethod("ToString").
ThisParameter
.RefKind);
874
Assert.Equal(RefKind.None, namedType.Constructors[0].
ThisParameter
.RefKind);
875
Assert.Equal(RefKind.None, namedType.GetMethod("M1").
ThisParameter
.RefKind);
876
Assert.Equal(RefKind.None, namedType.GetMethod("ToString").
ThisParameter
.RefKind);
881
Assert.Equal(RefKind.None, namedType.Constructors[0].
ThisParameter
.RefKind);
882
Assert.Equal(RefKind.None, namedType.GetMethod("Invoke").
ThisParameter
.RefKind);
913
Assert.Equal(RefKind.Out, s1.Constructors[0].
ThisParameter
.RefKind);
914
Assert.Equal(RefKind.In, s1.GetMethod("M1").
ThisParameter
.RefKind);
915
Assert.Equal(RefKind.In, s1.GetMethod("ToString").
ThisParameter
.RefKind);
1003
Assert.Equal(RefKind.Out, namedType.Constructors[0].
ThisParameter
.RefKind);
1004
Assert.Equal(RefKind.In, namedType.GetMethod("M1").
ThisParameter
.RefKind);
1005
Assert.Equal(RefKind.In, namedType.GetMethod("ToString").
ThisParameter
.RefKind);
1010
Assert.Equal(RefKind.Out, namedType.Constructors[0].
ThisParameter
.RefKind);
1011
Assert.Equal(RefKind.In, namedType.GetMethod("M1").
ThisParameter
.RefKind);
1012
Assert.Equal(RefKind.In, namedType.GetMethod("ToString").
ThisParameter
.RefKind);
1017
Assert.Equal(RefKind.Out, namedType.Constructors[0].
ThisParameter
.RefKind);
1018
Assert.Equal(RefKind.In, namedType.GetMethod("M1").
ThisParameter
.RefKind);
1019
Assert.Equal(RefKind.In, namedType.GetMethod("ToString").
ThisParameter
.RefKind);
1024
Assert.Equal(RefKind.Out, namedType.Constructors[0].
ThisParameter
.RefKind);
1025
Assert.Equal(RefKind.In, namedType.GetMethod("M1").
ThisParameter
.RefKind);
1026
Assert.Equal(RefKind.In, namedType.GetMethod("ToString").
ThisParameter
.RefKind);
1031
Assert.Equal(RefKind.Out, namedType.Constructors[0].
ThisParameter
.RefKind);
1032
Assert.Equal(RefKind.Ref, namedType.GetMethod("M1").
ThisParameter
.RefKind);
1033
Assert.Equal(RefKind.Ref, namedType.GetMethod("ToString").
ThisParameter
.RefKind);
1038
Assert.Equal(RefKind.None, namedType.Constructors[0].
ThisParameter
.RefKind);
1039
Assert.Equal(RefKind.None, namedType.GetMethod("M1").
ThisParameter
.RefKind);
1040
Assert.Equal(RefKind.None, namedType.GetMethod("ToString").
ThisParameter
.RefKind);
1045
Assert.Equal(RefKind.None, namedType.Constructors[0].
ThisParameter
.RefKind);
1046
Assert.Equal(RefKind.None, namedType.GetMethod("Invoke").
ThisParameter
.RefKind);
1608
Assert.Equal(refKind, method.
ThisParameter
?.RefKind);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (28)
Semantics\RefFieldTests.cs (28)
11616
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("C..ctor").
ThisParameter
, "C this", RefKind.None, ScopedKind.None);
11617
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("C.F1").
ThisParameter
, "C this", RefKind.None, ScopedKind.None);
11618
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1..ctor").
ThisParameter
, "out S1 this", RefKind.Out, ScopedKind.ScopedRef);
11619
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F1").
ThisParameter
, "ref S1 this", RefKind.Ref, ScopedKind.ScopedRef);
11620
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F2").
ThisParameter
, "in S1 this", RefKind.In, ScopedKind.ScopedRef);
11621
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R1..ctor").
ThisParameter
, "out R1 this", RefKind.Out, ScopedKind.ScopedRef);
11622
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R1.F1").
ThisParameter
, "ref R1 this", RefKind.Ref, ScopedKind.ScopedRef);
11623
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R1.F2").
ThisParameter
, "in R1 this", RefKind.In, ScopedKind.ScopedRef);
11624
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2..ctor").
ThisParameter
, "out S2 this", RefKind.Out, ScopedKind.ScopedRef);
11625
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F1").
ThisParameter
, "in S2 this", RefKind.In, ScopedKind.ScopedRef);
11626
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F2").
ThisParameter
, "in S2 this", RefKind.In, ScopedKind.ScopedRef);
11627
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R2..ctor").
ThisParameter
, "out R2 this", RefKind.Out, ScopedKind.ScopedRef);
11628
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R2.F1").
ThisParameter
, "in R2 this", RefKind.In, ScopedKind.ScopedRef);
11629
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R2.F2").
ThisParameter
, "in R2 this", RefKind.In, ScopedKind.ScopedRef);
23443
VerifyParameterSymbol(type.GetMethod("Get").
ThisParameter
, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false);
23444
VerifyParameterSymbol(type.GetMethod("get_Item").
ThisParameter
, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false);
23448
VerifyParameterSymbol(type.GetMethod("Get").
ThisParameter
, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true);
23449
VerifyParameterSymbol(type.GetMethod("get_Item").
ThisParameter
, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true);
23512
VerifyParameterSymbol(type.GetMethod("Get").
ThisParameter
, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false);
23513
VerifyParameterSymbol(type.GetMethod("get_Item").
ThisParameter
, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false);
23518
VerifyParameterSymbol(type.GetMethod("Get").
ThisParameter
, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true);
23519
VerifyParameterSymbol(type.GetMethod("get_Item").
ThisParameter
, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true);
25275
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F1").
ThisParameter
, "ref S1 this", RefKind.Ref, ScopedKind.ScopedRef);
25276
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F2").
ThisParameter
, "in S2 this", RefKind.In, ScopedKind.ScopedRef);
25318
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F1").
ThisParameter
, "ref S1 this", RefKind.Ref, ScopedKind.ScopedRef);
25319
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F2").
ThisParameter
, "in S2 this", RefKind.In, ScopedKind.ScopedRef);
25472
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S.F").
ThisParameter
, "ref S this", RefKind.Ref, scopedRefInCSharp10, expectedHasUnscopedRefAttribute: true);
25473
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
);