1 write to Method
Microsoft.CodeAnalysis.CSharp (1)
Binder\MethodArgumentInfo.cs (1)
28this.Method = method;
101 references to Method
Microsoft.CodeAnalysis.CSharp (60)
Binder\ForEachLoopBinder.cs (27)
234MethodSymbol getEnumeratorMethod = builder.GetEnumeratorInfo?.Method; 263var placeholder = new BoundAwaitableValuePlaceholder(expr, builder.MoveNextInfo?.Method.ReturnType ?? CreateErrorType()); 473ReportDiagnosticsIfObsolete(diagnostics, builder.MoveNextInfo.Method, foreachKeyword, hasBaseReceiver: false); 476Debug.Assert(!IsDisallowedExtensionInOlderLangVer(builder.MoveNextInfo.Method)); 585builder.GetEnumeratorInfo.Method.IsExtensionMethod || 586builder.GetEnumeratorInfo.Method.GetIsNewExtensionMember())) || 612: builder.PatternDisposeInfo.Method.ReturnType; 877Debug.Assert(!builder.ViaExtensionMethod || builder.GetEnumeratorInfo.Method.IsExtensionMethod || builder.GetEnumeratorInfo.Method.GetIsNewExtensionMember()); 924Debug.Assert(!builder.ViaExtensionMethod || builder.GetEnumeratorInfo.Method.IsExtensionMethod || builder.GetEnumeratorInfo.Method.GetIsNewExtensionMember()); 1035Debug.Assert(!(viaExtensionMethod && builder.GetEnumeratorInfo.Method.IsExtensionMethod && builder.GetEnumeratorInfo.Method.Parameters.IsDefaultOrEmpty)); 1036Debug.Assert(!(viaExtensionMethod && !builder.GetEnumeratorInfo.Method.IsExtensionMethod && !builder.GetEnumeratorInfo.Method.GetIsNewExtensionMember())); 1042if (builder.GetEnumeratorInfo.Method.IsExtensionMethod) 1044builder.CollectionType = builder.GetEnumeratorInfo.Method.Parameters[0].Type; 1048builder.CollectionType = builder.GetEnumeratorInfo.Method.ContainingType.ExtensionParameter.Type; 1065MethodSymbol getEnumeratorMethod = builder.GetEnumeratorInfo.Method; 1195builder.GetEnumeratorInfo.Method.ReturnType.SpecialType == SpecialType.System_Collections_IEnumerator); 1221TypeSymbol enumeratorType = builder.GetEnumeratorInfo.Method.ReturnType; 1334TypeSymbol.Equals(builder.GetEnumeratorInfo.Method.ReturnType, this.Compilation.GetSpecialType(SpecialType.System_Collections_IEnumerator), TypeCompareKind.ConsiderEverything2)); 1645Debug.Assert((object)builder.GetEnumeratorInfo.Method != null); 1647MethodSymbol getEnumeratorMethod = builder.GetEnumeratorInfo.Method; 1733moveNextMethodCandidate.Method.IsStatic || moveNextMethodCandidate.Method.DeclaredAccessibility != Accessibility.Public || 1734IsInvalidMoveNextMethod(moveNextMethodCandidate.Method, isAsync))
Binder\RefSafetyAnalysis.cs (1)
1120resultType: node.EnumeratorInfoOpt.GetEnumeratorInfo.Method.ContainingType,
Compilation\MemberSemanticModel.cs (3)
975if (enumeratorInfoOpt.PatternDisposeInfo is { Method: var method }) 989enumeratorInfoOpt.GetEnumeratorInfo.Method.GetPublicSymbol(), 990enumeratorInfoOpt.MoveNextInfo.Method.GetPublicSymbol(),
FlowAnalysis\NullableWalker.cs (7)
11608&& (enumeratorMethodInfo.Method.IsExtensionMethod || enumeratorMethodInfo.Method.GetIsNewExtensionMember())) 11618method: enumeratorMethodInfo.Method, 11679bool reportedDiagnostic = enumeratorInfoOpt?.GetEnumeratorInfo.Method is { } getEnumeratorMethod 11724reinferredGetEnumeratorMethod = (MethodSymbol)AsMemberOfType(getEnumeratorType, enumeratorInfoOpt.GetEnumeratorInfo.Method); 11746var moveNextAsyncMethod = (MethodSymbol)AsMemberOfType(reinferredGetEnumeratorMethod.ReturnType, enumeratorInfoOpt.MoveNextInfo.Method); 11759if (enumeratorInfoOpt.PatternDisposeInfo is { Method: var originalDisposeMethod }) // no statically known Dispose method if doing a runtime check
FlowAnalysis\NullableWalker.DebugVerifier.cs (1)
232if (enumeratorInfo.GetEnumeratorInfo.Method.IsExtensionMethod) // Tracked by https://github.com/dotnet/roslyn/issues/78828: Test this code path with new extensions
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (3)
177if (!ShouldUseIEnumerableBulkAddMethod(singleSpread.Expression.Type, toListOfElementType.Parameters[0].Type, singleSpread.EnumeratorInfoOpt?.GetEnumeratorInfo.Method)) 680&& ShouldUseIEnumerableBulkAddMethod(spreadExpression.Type!, linqToArrayMethod.Parameters[0].Type, spreadElement.EnumeratorInfoOpt?.GetEnumeratorInfo.Method)) 1182if (!ShouldUseIEnumerableBulkAddMethod(rewrittenSpreadOperand.Type, addRangeMethod.Parameters[0].Type, spreadElement.EnumeratorInfoOpt?.GetEnumeratorInfo.Method))
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (5)
155TypeSymbol enumeratorType = getEnumeratorInfo.Method.ReturnType; 163var receiver = ConvertReceiverForInvocation(forEachSyntax, rewrittenExpression, getEnumeratorInfo.Method, convertedCollection.Conversion, enumeratorInfo.CollectionType); 168if (getEnumeratorInfo.Method.IsExtensionMethod) 175getEnumeratorInfo.Method, 324MethodSymbol? disposeMethod = enumeratorInfo.PatternDisposeInfo?.Method; // pattern-based
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (2)
445MethodSymbol? disposeMethod = disposeInfo?.Method; 494MethodSymbol method = methodArgumentInfo.Method;
Operations\CSharpOperationFactory.cs (11)
1902enumeratorInfoOpt.GetEnumeratorInfo.Method.GetPublicSymbol(), 1904enumeratorInfoOpt.MoveNextInfo.Method.GetPublicSymbol(), 1911HasImplicitConversionToOrImplementsVarianceCompatibleInterface(enumeratorInfoOpt.GetEnumeratorInfo.Method.ReturnType, 1916enumeratorInfoOpt.PatternDisposeInfo?.Method.GetPublicSymbol(), 1943info.Method, 1947invokedAsExtensionMethod: info.Method.IsExtensionMethod 2039disposeMethod: boundUsingStatement.PatternDisposeInfoOpt.Method.GetPublicSymbol(), 2178disposeMethod: usingDecl.PatternDisposeInfoOpt.Method.GetPublicSymbol(), 2943Debug.Assert(!patternDisposeInfo.Method.IsStatic); 2945if (patternDisposeInfo.Method.ParameterCount == 0) 2951patternDisposeInfo.Method,
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (41)
Semantics\ForEachTests.cs (41)
1209Assert.Equal("System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()", info.GetEnumeratorInfo.Method.ToTestDisplayString()); 1212Assert.Equal("System.Boolean System.Collections.IEnumerator.MoveNext()", info.MoveNextInfo.Method.ToTestDisplayString()); 1247Assert.Equal("System.CharEnumerator System.String.GetEnumerator()", info.GetEnumeratorInfo.Method.ToTestDisplayString()); 1250Assert.Equal("System.Boolean System.CharEnumerator.MoveNext()", info.MoveNextInfo.Method.ToTestDisplayString()); 1291Assert.Equal("Enumerator Enumerable.GetEnumerator()", info.GetEnumeratorInfo.Method.ToTestDisplayString()); 1294Assert.Equal("System.Boolean Enumerator.MoveNext()", info.MoveNextInfo.Method.ToTestDisplayString()); 1335Assert.Equal("Enumerator Enumerable.GetEnumerator()", info.GetEnumeratorInfo.Method.ToTestDisplayString()); 1338Assert.Equal("System.Boolean Enumerator.MoveNext()", info.MoveNextInfo.Method.ToTestDisplayString()); 1368Assert.Equal("System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()", info.GetEnumeratorInfo.Method.ToTestDisplayString()); 1371Assert.Equal("System.Boolean System.Collections.IEnumerator.MoveNext()", info.MoveNextInfo.Method.ToTestDisplayString()); 1408Assert.Equal("System.Collections.Generic.IEnumerator<System.Int32> System.Collections.Generic.IEnumerable<System.Int32>.GetEnumerator()", info.GetEnumeratorInfo.Method.ToTestDisplayString()); 1411Assert.Equal("System.Boolean System.Collections.IEnumerator.MoveNext()", info.MoveNextInfo.Method.ToTestDisplayString()); //NB: not on generic interface 1450Assert.Equal("System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()", info.GetEnumeratorInfo.Method.ToTestDisplayString()); 1453Assert.Equal("System.Boolean System.Collections.IEnumerator.MoveNext()", info.MoveNextInfo.Method.ToTestDisplayString()); 1489Assert.Equal("System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()", info.GetEnumeratorInfo.Method.ToTestDisplayString()); 1492Assert.Equal("System.Boolean System.Collections.IEnumerator.MoveNext()", info.MoveNextInfo.Method.ToTestDisplayString()); 1522Assert.Equal("System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()", info.GetEnumeratorInfo.Method.ToTestDisplayString()); 1525Assert.Equal("System.Boolean System.Collections.IEnumerator.MoveNext()", info.MoveNextInfo.Method.ToTestDisplayString()); 1553Assert.Equal("System.CharEnumerator System.String.GetEnumerator()", info.GetEnumeratorInfo.Method.ToTestDisplayString()); 1556Assert.Equal("System.Boolean System.CharEnumerator.MoveNext()", info.MoveNextInfo.Method.ToTestDisplayString()); 1639Assert.Equal("System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()", info.GetEnumeratorInfo.Method.ToTestDisplayString()); 1642Assert.Equal("System.Boolean System.Collections.IEnumerator.MoveNext()", info.MoveNextInfo.Method.ToTestDisplayString()); 1670Assert.Equal("System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()", info.GetEnumeratorInfo.Method.ToTestDisplayString()); 1673Assert.Equal("System.Boolean System.Collections.IEnumerator.MoveNext()", info.MoveNextInfo.Method.ToTestDisplayString()); 1703Assert.Equal("System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()", info.GetEnumeratorInfo.Method.ToTestDisplayString()); 1706Assert.Equal("System.Boolean System.Collections.IEnumerator.MoveNext()", info.MoveNextInfo.Method.ToTestDisplayString()); 1744Assert.Equal("T Enumerable<T>.GetEnumerator()", info.GetEnumeratorInfo.Method.ToTestDisplayString()); 1747Assert.Equal("System.Boolean System.Collections.IEnumerator.MoveNext()", info.MoveNextInfo.Method.ToTestDisplayString()); 1828Assert.Equal("T Enumerable<T>.GetEnumerator()", info.GetEnumeratorInfo.Method.ToTestDisplayString()); 1831Assert.Equal("System.Boolean MyEnumerator.MoveNext()", info.MoveNextInfo.Method.ToTestDisplayString()); 1875Assert.Equal("Enumerator Enumerable.GetEnumerator()", info.GetEnumeratorInfo.Method.ToTestDisplayString()); 1878Assert.Equal("System.Boolean Enumerator.MoveNext()", info.MoveNextInfo.Method.ToTestDisplayString()); 3119Assert.Equal("System.CharEnumerator System.String.GetEnumerator()", info.GetEnumeratorInfo.Method.ToTestDisplayString()); 3122Assert.Equal("System.Boolean System.CharEnumerator.MoveNext()", info.MoveNextInfo.Method.ToTestDisplayString()); 3163Assert.Equal("void DisposableEnumerator.Dispose()", enumeratorInfo.PatternDisposeInfo.Method.ToTestDisplayString()); 3202Assert.Equal("void DisposableEnumerator.Dispose()", enumeratorInfo.PatternDisposeInfo.Method.ToTestDisplayString()); 3237Assert.Equal("C.Enumerator Extensions.GetEnumerator(this C self)", info.GetEnumeratorInfo.Method.ToTestDisplayString()); 3240Assert.Equal("System.Boolean C.Enumerator.MoveNext()", info.MoveNextInfo.Method.ToTestDisplayString()); 3276Assert.Equal(enumeratorInfo.GetEnumeratorInfo.Method.GetPublicSymbol(), statementInfo.GetEnumeratorMethod); 3278Assert.Equal(enumeratorInfo.MoveNextInfo.Method.GetPublicSymbol(), statementInfo.MoveNextMethod); 3284Assert.Equal(enumeratorInfo.PatternDisposeInfo.Method.GetPublicSymbol(), statementInfo.DisposeMethod);