37 lines
798 B
C#
37 lines
798 B
C#
namespace Microsoft.CodeAnalysis.CSharp;
|
|
|
|
internal struct ExtensionMethodScopeEnumerator(Binder binder)
|
|
{
|
|
private readonly Binder _binder = binder;
|
|
|
|
private ExtensionMethodScope _current = default(ExtensionMethodScope);
|
|
|
|
public ExtensionMethodScope Current => _current;
|
|
|
|
public bool MoveNext()
|
|
{
|
|
if (_current.Binder == null)
|
|
{
|
|
_current = GetNextScope(_binder);
|
|
}
|
|
else
|
|
{
|
|
Binder binder = _current.Binder;
|
|
_current = GetNextScope(binder.Next);
|
|
}
|
|
return _current.Binder != null;
|
|
}
|
|
|
|
private static ExtensionMethodScope GetNextScope(Binder binder)
|
|
{
|
|
for (Binder binder2 = binder; binder2 != null; binder2 = binder2.Next)
|
|
{
|
|
if (binder2.SupportsExtensionMethods)
|
|
{
|
|
return new ExtensionMethodScope(binder2);
|
|
}
|
|
}
|
|
return default(ExtensionMethodScope);
|
|
}
|
|
}
|