39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
using System.Collections.Immutable;
|
|
using Microsoft.CodeAnalysis.CSharp.Symbols;
|
|
using Microsoft.CodeAnalysis.PooledObjects;
|
|
using Roslyn.Utilities;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp;
|
|
|
|
internal sealed class ExpressionVariableBinder : LocalScopeBinder
|
|
{
|
|
internal override SyntaxNode ScopeDesignator { get; }
|
|
|
|
internal ExpressionVariableBinder(SyntaxNode scopeDesignator, Binder next)
|
|
: base(next)
|
|
{
|
|
ScopeDesignator = scopeDesignator;
|
|
}
|
|
|
|
protected override ImmutableArray<LocalSymbol> BuildLocals()
|
|
{
|
|
ArrayBuilder<LocalSymbol> instance = ArrayBuilder<LocalSymbol>.GetInstance();
|
|
ExpressionVariableFinder.FindExpressionVariables(this, instance, (CSharpSyntaxNode)(object)ScopeDesignator, GetBinder((SyntaxNode)(object)(CSharpSyntaxNode)(object)ScopeDesignator));
|
|
return instance.ToImmutableAndFree();
|
|
}
|
|
|
|
internal override ImmutableArray<LocalSymbol> GetDeclaredLocalsForScope(SyntaxNode scopeDesignator)
|
|
{
|
|
if (ScopeDesignator == scopeDesignator)
|
|
{
|
|
return Locals;
|
|
}
|
|
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Binder/ExpressionVariableBinder.cs", 41);
|
|
}
|
|
|
|
internal override ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode scopeDesignator)
|
|
{
|
|
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Binder/ExpressionVariableBinder.cs", 46);
|
|
}
|
|
}
|