113 references to ThisParameter
Microsoft.CodeAnalysis.CSharp (36)
Binder\Binder.ValueChecks.cs (4)
2970
var thisParam = ((MethodSymbol)_symbol).
ThisParameter
;
3224
var thisParam = ((MethodSymbol)_symbol).
ThisParameter
;
3495
var thisParam = ((MethodSymbol)_symbol).
ThisParameter
;
3902
var thisParam = ((MethodSymbol)_symbol).
ThisParameter
;
Binder\Binder_Expressions.cs (1)
1947
else if (primaryCtor is {
ThisParameter
.RefKind: not RefKind.None } &&
Compiler\MethodBodySynthesizer.cs (3)
182
var thisSymbol = accessor.
ThisParameter
;
279
field.IsStatic ? null : new BoundThisReference(syntax, accessor.
ThisParameter
.Type),
347
ParameterSymbol thisParameter = accessor.
ThisParameter
;
Compiler\MethodCompiler.cs (1)
1478
method.
ThisParameter
,
FlowAnalysis\NullableWalker.cs (1)
1977
var thisParameter = method?.
ThisParameter
;
FlowAnalysis\ReadWriteWalker.cs (1)
94
var thisParameter = m.
ThisParameter
;
Lowering\ClosureConversion\ClosureConversion.Analysis.Tree.cs (2)
476
AddIfCaptured(_topLevelMethod.
ThisParameter
, node.Syntax);
482
var thisParam = _topLevelMethod.
ThisParameter
;
Lowering\ClosureConversion\ClosureConversion.cs (4)
775
symbol == _currentMethod.
ThisParameter
&&
795
symbol != _currentMethod.
ThisParameter
||
827
return (_currentMethod == _topLevelMethod || _topLevelMethod.
ThisParameter
== null ?
1549
_currentFrameThis = synthesizedMethod.
ThisParameter
;
Lowering\StateMachineRewriter\IteratorAndAsyncCaptureWalker.cs (6)
68
walker.CaptureVariable(method.
ThisParameter
, node.Syntax);
271
var thisSymbol = topLevelMethod.
ThisParameter
;
280
CaptureVariable(topLevelMethod.
ThisParameter
, node.Syntax);
286
CaptureVariable(topLevelMethod.
ThisParameter
, node.Syntax);
374
Capture(_topLevelMethod.
ThisParameter
, node.Syntax);
380
Capture(_topLevelMethod.
ThisParameter
, node.Syntax);
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (4)
137
var thisParameter = originalMethod.
ThisParameter
;
909
CapturedSymbolReplacement proxy = proxies[this.OriginalMethod.
ThisParameter
];
926
var thisParameter = this.OriginalMethod.
ThisParameter
;
960
CapturedSymbolReplacement proxy = proxies[this.OriginalMethod.
ThisParameter
];
Lowering\StateMachineRewriter\StateMachineRewriter.cs (5)
308
Debug.Assert((object)method.
ThisParameter
!= null);
311
if (proxies.TryGetValue(method.
ThisParameter
, out proxy))
430
if (method.IsStatic || method.
ThisParameter
.Type.IsReferenceType)
456
if (copyDest.TryGetValue(method.
ThisParameter
, out proxy))
461
copySrc[method.
ThisParameter
].Replacement(F.Syntax, stateMachineType => F.This())));
Lowering\SyntheticBoundNodeFactory.cs (2)
264
return new BoundThisReference(Syntax, CurrentFunction.
ThisParameter
.Type) { WasCompilerGenerated = true };
1124
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.ExpressionEvaluator.ExpressionCompiler (3)
CompilationContext.cs (2)
1372
var instance = new DisplayClassInstanceFromParameter(currentFrame.
ThisParameter
);
1514
possiblyCapturingTypeInstance.Instance = new DisplayClassInstanceFromParameter(currentFrame.
ThisParameter
);
Symbols\EEMethodSymbol.cs (1)
136
var substitutedSourceThisParameter = this.SubstitutedSourceMethod.
ThisParameter
;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (28)
Semantics\RefFieldTests.cs (28)
11100
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("C..ctor").
ThisParameter
, "C this", RefKind.None, ScopedKind.None);
11101
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("C.F1").
ThisParameter
, "C this", RefKind.None, ScopedKind.None);
11102
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1..ctor").
ThisParameter
, "out S1 this", RefKind.Out, ScopedKind.ScopedRef);
11103
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F1").
ThisParameter
, "ref S1 this", RefKind.Ref, ScopedKind.ScopedRef);
11104
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F2").
ThisParameter
, "in S1 this", RefKind.In, ScopedKind.ScopedRef);
11105
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R1..ctor").
ThisParameter
, "out R1 this", RefKind.Out, ScopedKind.ScopedRef);
11106
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R1.F1").
ThisParameter
, "ref R1 this", RefKind.Ref, ScopedKind.ScopedRef);
11107
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R1.F2").
ThisParameter
, "in R1 this", RefKind.In, ScopedKind.ScopedRef);
11108
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2..ctor").
ThisParameter
, "out S2 this", RefKind.Out, ScopedKind.ScopedRef);
11109
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F1").
ThisParameter
, "in S2 this", RefKind.In, ScopedKind.ScopedRef);
11110
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F2").
ThisParameter
, "in S2 this", RefKind.In, ScopedKind.ScopedRef);
11111
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R2..ctor").
ThisParameter
, "out R2 this", RefKind.Out, ScopedKind.ScopedRef);
11112
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R2.F1").
ThisParameter
, "in R2 this", RefKind.In, ScopedKind.ScopedRef);
11113
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("R2.F2").
ThisParameter
, "in R2 this", RefKind.In, ScopedKind.ScopedRef);
22296
VerifyParameterSymbol(type.GetMethod("Get").
ThisParameter
, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false);
22297
VerifyParameterSymbol(type.GetMethod("get_Item").
ThisParameter
, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false);
22301
VerifyParameterSymbol(type.GetMethod("Get").
ThisParameter
, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true);
22302
VerifyParameterSymbol(type.GetMethod("get_Item").
ThisParameter
, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true);
22365
VerifyParameterSymbol(type.GetMethod("Get").
ThisParameter
, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false);
22366
VerifyParameterSymbol(type.GetMethod("get_Item").
ThisParameter
, "ref R1<System.Int32> this", RefKind.Ref, ScopedKind.ScopedRef, expectedHasUnscopedRefAttribute: false);
22371
VerifyParameterSymbol(type.GetMethod("Get").
ThisParameter
, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true);
22372
VerifyParameterSymbol(type.GetMethod("get_Item").
ThisParameter
, "ref R2<System.Int32> this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true);
24128
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F1").
ThisParameter
, "ref S1 this", RefKind.Ref, ScopedKind.ScopedRef);
24129
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F2").
ThisParameter
, "in S2 this", RefKind.In, ScopedKind.ScopedRef);
24171
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S1.F1").
ThisParameter
, "ref S1 this", RefKind.Ref, ScopedKind.ScopedRef);
24172
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S2.F2").
ThisParameter
, "in S2 this", RefKind.In, ScopedKind.ScopedRef);
24315
VerifyParameterSymbol(comp.GetMember<MethodSymbol>("S.F").
ThisParameter
, "ref S this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true);
24316
VerifyParameterSymbol(comp.GetMember<PropertySymbol>("S.P").GetMethod.
ThisParameter
, "ref S this", RefKind.Ref, ScopedKind.None, expectedHasUnscopedRefAttribute: true);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (2)
Symbols\ExtensionMethodTests.cs (2)
2738
var parameter = methodSymbol.
ThisParameter
;
2749
Assert.Throws<InvalidOperationException>(() => methodSymbol.
ThisParameter
);