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