53 writes to CurrentFunction
Microsoft.CodeAnalysis.CSharp (53)
Compiler\MethodBodySynthesizer.Lowered.cs (5)
51F.CurrentFunction = this; 142F.CurrentFunction = this; 243F.CurrentFunction = (MethodSymbol)this.OriginalDefinition; 281F.CurrentFunction = (MethodSymbol)this.OriginalDefinition; 320F.CurrentFunction = this.OriginalDefinition;
Emitter\Model\SynthesizedPrivateImplementationDetailsStaticConstructor.cs (1)
32factory.CurrentFunction = this;
Lowering\AsyncRewriter\AsyncExceptionHandlerRewriter.cs (5)
39_F.CurrentFunction = containingMethod; 710_F.CurrentFunction = node.Symbol; 715_F.CurrentFunction = oldContainingSymbol; 726_F.CurrentFunction = node.Symbol; 731_F.CurrentFunction = oldContainingSymbol;
Lowering\AsyncRewriter\AsyncMethodToStateMachineRewriter.cs (1)
136F.CurrentFunction = moveNextMethod;
Lowering\AsyncRewriter\AsyncRewriter.AsyncIteratorRewriter.cs (1)
162F.CurrentFunction = stateMachineType.Constructor;
Lowering\AsyncRewriter\AsyncRewriter.cs (1)
197F.CurrentFunction = stateMachineType.Constructor;
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (2)
124methodBodyFactory.CurrentFunction = method; 135methodBodyFactory.CurrentFunction = oldMethod;
Lowering\IteratorRewriter\IteratorMethodToStateMachineRewriter.cs (4)
97F.CurrentFunction = moveNextMethod; 157F.CurrentFunction = disposeMethod; 390F.CurrentFunction = finallyMethod; 412F.CurrentFunction = origMethod;
Lowering\IteratorRewriter\IteratorRewriter.cs (1)
279F.CurrentFunction = stateMachineType.Constructor;
Lowering\LocalRewriter\LocalRewriter.cs (5)
70_factory.CurrentFunction = containingMethod; 363_factory.CurrentFunction = lambda; 373_factory.CurrentFunction = oldContainingSymbol; 428_factory.CurrentFunction = localFunction; 447_factory.CurrentFunction = oldContainingSymbol;
Lowering\SpillSequenceSpiller.cs (5)
32_F.CurrentFunction = method; 1397_F.CurrentFunction = node.Symbol; 1399_F.CurrentFunction = oldCurrentFunction; 1406_F.CurrentFunction = node.Symbol; 1408_F.CurrentFunction = oldCurrentFunction;
Lowering\StateMachineRewriter\StateMachineRewriter.cs (4)
285F.CurrentFunction = method; 348F.CurrentFunction = result; 360F.CurrentFunction = getter; 368F.CurrentFunction = result;
Lowering\SyntheticBoundNodeFactory.cs (3)
123this.CurrentFunction = topLevelMethodOpt; 160CurrentFunction = null; 578CurrentFunction = null;
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.SynthesizedMethodBase.cs (1)
226F.CurrentFunction = this;
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListConstructor.cs (1)
25f.CurrentFunction = this;
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListEnumeratorConstructor.cs (1)
25f.CurrentFunction = this;
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListMethod.cs (1)
24f.CurrentFunction = this;
Symbols\Synthesized\Records\SynthesizedRecordEqualityContractProperty.cs (1)
178F.CurrentFunction = this;
Symbols\Synthesized\SynthesizedHotReloadExceptionConstructorSymbol.cs (1)
41factory.CurrentFunction = this;
Symbols\Synthesized\SynthesizedInlineArrayAsReadOnlySpanMethod.cs (1)
24f.CurrentFunction = this;
Symbols\Synthesized\SynthesizedInlineArrayAsSpanMethod.cs (1)
24f.CurrentFunction = this;
Symbols\Synthesized\SynthesizedInlineArrayElementRefMethod.cs (1)
26f.CurrentFunction = this;
Symbols\Synthesized\SynthesizedInlineArrayElementRefReadOnlyMethod.cs (1)
26f.CurrentFunction = this;
Symbols\Synthesized\SynthesizedInlineArrayFirstElementRefMethod.cs (1)
25f.CurrentFunction = this;
Symbols\Synthesized\SynthesizedInlineArrayFirstElementRefReadOnlyMethod.cs (1)
25f.CurrentFunction = this;
Symbols\Synthesized\SynthesizedInstanceConstructor.cs (1)
289factory.CurrentFunction = this;
Symbols\Synthesized\SynthesizedParameterlessThrowMethod.cs (1)
27F.CurrentFunction = this;
Symbols\Synthesized\SynthesizedThrowSwitchExpressionExceptionMethod.cs (1)
25F.CurrentFunction = this;
73 references to CurrentFunction
Microsoft.CodeAnalysis.CSharp (73)
Compiler\MethodBodySynthesizer.Lowered.cs (3)
459RoslynDebug.AssertNotNull(F.CurrentFunction); 460foreach (var param in F.CurrentFunction.Parameters) 469return F.CurrentFunction.ReturnsVoid
Lowering\AsyncRewriter\AsyncExceptionHandlerRewriter.cs (10)
187var pendingExceptionLocal = new SynthesizedLocal(_F.CurrentFunction, TypeWithAnnotations.Create(exceptionType), SynthesizedLocalKind.TryAwaitPendingException, tryStatementSyntax); 189var pendingBranchVar = new SynthesizedLocal(_F.CurrentFunction, TypeWithAnnotations.Create(_F.SpecialType(SpecialType.System_Int32)), SynthesizedLocalKind.TryAwaitPendingBranch, tryStatementSyntax); 213if (_F.CurrentFunction.IsAsync && _F.CurrentFunction.IsIterator) 331var returnLabel = parent.ProxyReturnIfNeeded(_F.CurrentFunction, pendingValue, out returnValue); 378_F.CurrentFunction, 707var oldContainingSymbol = _F.CurrentFunction; 723var oldContainingSymbol = _F.CurrentFunction; 1044this.pendingCaughtException = new SynthesizedLocal(F.CurrentFunction, TypeWithAnnotations.Create(F.SpecialType(SpecialType.System_Object)), SynthesizedLocalKind.TryAwaitPendingCaughtException, tryStatementSyntax); 1045this.pendingCatch = new SynthesizedLocal(F.CurrentFunction, TypeWithAnnotations.Create(F.SpecialType(SpecialType.System_Int32)), SynthesizedLocalKind.TryAwaitPendingCatch, tryStatementSyntax);
Lowering\AsyncRewriter\AsyncRewriter.AsyncIteratorRewriter.cs (1)
169bodyBuilder.Add(F.Assignment(F.InstanceField(stateField), F.Parameter(F.CurrentFunction.Parameters[0]))); // this.state = state;
Lowering\AsyncRewriter\AsyncRewriter.cs (1)
185new BoundExpression[] { F.Parameter(F.CurrentFunction.Parameters[0]) })),
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (1)
123var oldMethod = methodBodyFactory.CurrentFunction;
Lowering\Instrumentation\LocalStateTracingInstrumenter.cs (7)
299Debug.Assert(_factory.CurrentFunction is not null); 301var isStateMachine = _factory.CurrentFunction.IsAsync || _factory.CurrentFunction.IsIterator; 303var prologueBuilder = ArrayBuilder<BoundStatement>.GetInstance(_factory.CurrentFunction.ParameterCount); 305foreach (var parameter in _factory.CurrentFunction.Parameters) 334new[] { _factory.MethodDefIndex(_factory.TopLevelMethod), _factory.MethodDefIndex(_factory.CurrentFunction) }), 340new[] { _factory.MethodDefIndex(_factory.TopLevelMethod), _factory.MethodDefIndex(_factory.CurrentFunction), _factory.StateMachineInstanceId() }),
Lowering\IteratorRewriter\IteratorMethodToStateMachineRewriter.cs (2)
348Debug.Assert(node.Label == proxyLabel || !(F.CurrentFunction is IteratorFinallyMethodSymbol), "should not be proxying branches in finally"); 387var origMethod = F.CurrentFunction;
Lowering\IteratorRewriter\IteratorRewriter.cs (1)
282bodyBuilder.Add(F.Assignment(F.Field(F.This(), stateField), F.Parameter(F.CurrentFunction.Parameters[0]))); // this.state = state;
Lowering\LocalRewriter\DelegateCacheRewriter.cs (2)
65Debug.Assert(_factory.CurrentFunction is { }); 93if (!TryGetOwnerFunction(_factory.CurrentFunction, boundDelegateCreation, out var ownerFunction))
Lowering\LocalRewriter\LocalRewriter.cs (3)
354var oldContainingSymbol = _factory.CurrentFunction; 419var oldContainingSymbol = _factory.CurrentFunction; 770if (_factory.CurrentFunction?.IsStatic == false)
Lowering\LocalRewriter\LocalRewriter_AssignmentOperator.cs (1)
286Debug.Assert(_factory.CurrentFunction.IsConstructor());
Lowering\LocalRewriter\LocalRewriter_Call.cs (3)
188var containingMethod = this._factory.CurrentFunction; 292_factory.CurrentFunction, 707_factory.CurrentFunction,
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (1)
995if (useKnownLength && elements.Length > 0 && _factory.CurrentFunction?.IsAsync == false)
Lowering\LocalRewriter\LocalRewriter_DeconstructionAssignmentOperator.cs (1)
390var localSymbol = new SynthesizedLocal(_factory.CurrentFunction, TypeWithAnnotations.Create(outputPlaceholder.Type), SynthesizedLocalKind.LoweringTemp);
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (3)
337Debug.Assert(_factory.CurrentFunction is { }); 338var conversions = _factory.CurrentFunction.ContainingAssembly.CorLibrary.TypeConversions; 347containingMember: _factory.CurrentFunction,
Lowering\LocalRewriter\LocalRewriter_Literal.cs (1)
70var curMethod = _factory.CurrentFunction;
Lowering\LocalRewriter\LocalRewriter_ReturnStatement.cs (2)
29(node.Syntax.Kind() == SyntaxKind.Block && _factory.CurrentFunction?.IsAsync == false)))) 41var method = _factory.CurrentFunction;
Lowering\LocalRewriter\LocalRewriter_SwitchExpression.cs (3)
160var diagnosticSyntax = factory.CurrentFunction.GetNonNullSyntaxNode(); 175var diagnosticSyntax = factory.CurrentFunction.GetNonNullSyntaxNode(); 189var diagnosticSyntax = factory.CurrentFunction.GetNonNullSyntaxNode();
Lowering\LocalRewriter\LocalRewriter_Yield.cs (1)
21(!node.WasCompilerGenerated || (node.Syntax.Kind() == SyntaxKind.Block && _factory.CurrentFunction?.IsAsync == false)))
Lowering\LocalRewriter\LoweredDynamicOperationFactory.cs (3)
552_factory.CurrentFunction, 688Debug.Assert(factory.CurrentFunction is { }); 694var synthesizedContainer = new DynamicSiteContainer(containerName, factory.TopLevelMethod, factory.CurrentFunction);
Lowering\SpillSequenceSpiller.cs (2)
1396var oldCurrentFunction = _F.CurrentFunction; 1405var oldCurrentFunction = _F.CurrentFunction;
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (1)
183get { return F.CurrentFunction; }
Lowering\SyntheticBoundNodeFactory.cs (20)
140Debug.Assert(CurrentFunction is null || 141CurrentFunction.MethodKind == MethodKind.AnonymousFunction || 142CurrentFunction.MethodKind == MethodKind.LocalFunction || 143TypeSymbol.Equals(CurrentFunction.ContainingType, CurrentType, TypeCompareKind.ConsiderEverything2)); 216Debug.Assert(CurrentFunction is { IsStatic: false }); 217return new BoundThisReference(Syntax, CurrentFunction.ThisParameter.Type) { WasCompilerGenerated = true }; 227Debug.Assert(CurrentFunction is { IsStatic: false }); 545Debug.Assert(CurrentFunction is { }); 556var conversion = Compilation.Conversions.ClassifyConversionFromType(expression.Type, CurrentFunction.ReturnType, isChecked: false, ref useSiteInfo); 561Debug.Assert(CurrentFunction.RefKind == RefKind.None); 562expression = BoundConversion.Synthesized(Syntax, expression, conversion, false, explicitCastInCode: false, conversionGroupOpt: null, ConstantValue.NotAvailable, CurrentFunction.ReturnType); 566return new BoundReturnStatement(Syntax, CurrentFunction.RefKind, expression, @checked: false) { WasCompilerGenerated = true }; 571Debug.Assert(CurrentFunction is { }); 577CompilationState.AddSynthesizedMethod(CurrentFunction, body); 595return new SynthesizedLocal(CurrentFunction, TypeWithAnnotations.Create(type), kind, syntax, isPinned, 614CurrentFunction, 1186Debug.Assert(CurrentFunction is { }); 1187NamedTypeSymbol baseType = CurrentFunction.ThisParameter.Type.BaseTypeNoUseSiteDiagnostics; 1644MethodSymbol? containingMethod = this.CurrentFunction; 1721temp = new SynthesizedLocal(this.CurrentFunction, TypeWithAnnotations.Create(node.Type), SynthesizedLocalKind.LoweringTemp);