Files
PURErat-crack-scode/decompiled/Libraries/microsoft.codeanalysis.csharp/Microsoft.CodeAnalysis.CSharp/SimpleProgramBinder.cs
T

97 lines
3.8 KiB
C#
Raw Normal View History

2026-08-27 10:56:38 -06:00
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.PooledObjects;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp;
internal sealed class SimpleProgramBinder : LocalScopeBinder
{
private readonly SynthesizedSimpleProgramEntryPointSymbol _entryPoint;
internal override bool IsLocalFunctionsScopeBinder => true;
internal override bool IsLabelsScopeBinder => true;
internal override SyntaxNode ScopeDesignator => (SyntaxNode)(object)_entryPoint.SyntaxNode;
public SimpleProgramBinder(Binder enclosing, SynthesizedSimpleProgramEntryPointSymbol entryPoint)
: base(enclosing, enclosing.Flags)
{
_entryPoint = entryPoint;
}
protected override ImmutableArray<LocalSymbol> BuildLocals()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
ArrayBuilder<LocalSymbol> instance = ArrayBuilder<LocalSymbol>.GetInstance(16);
Enumerator<MemberDeclarationSyntax> enumerator = _entryPoint.CompilationUnit.Members.GetEnumerator();
while (enumerator.MoveNext())
{
if (enumerator.Current is GlobalStatementSyntax globalStatementSyntax)
{
BuildLocals(this, globalStatementSyntax.Statement, instance);
}
}
return instance.ToImmutableAndFree();
}
protected override ImmutableArray<LocalFunctionSymbol> BuildLocalFunctions()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
ArrayBuilder<LocalFunctionSymbol> locals = null;
Enumerator<MemberDeclarationSyntax> enumerator = _entryPoint.CompilationUnit.Members.GetEnumerator();
while (enumerator.MoveNext())
{
if (enumerator.Current is GlobalStatementSyntax globalStatementSyntax)
{
BuildLocalFunctions(globalStatementSyntax.Statement, ref locals);
}
}
return locals?.ToImmutableAndFree() ?? ImmutableArray<LocalFunctionSymbol>.Empty;
}
protected override ImmutableArray<LabelSymbol> BuildLabels()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
ArrayBuilder<LabelSymbol> labels = null;
Enumerator<MemberDeclarationSyntax> enumerator = _entryPoint.CompilationUnit.Members.GetEnumerator();
while (enumerator.MoveNext())
{
if (enumerator.Current is GlobalStatementSyntax globalStatementSyntax)
{
LocalScopeBinder.BuildLabels(_entryPoint, globalStatementSyntax.Statement, ref labels);
}
}
return labels?.ToImmutableAndFree() ?? ImmutableArray<LabelSymbol>.Empty;
}
internal override ImmutableArray<LocalSymbol> GetDeclaredLocalsForScope(SyntaxNode scopeDesignator)
{
if (ScopeDesignator == scopeDesignator)
{
return Locals;
}
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Binder/SimpleProgramBinder.cs", 94);
}
internal override ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode scopeDesignator)
{
if ((object)ScopeDesignator == scopeDesignator)
{
return LocalFunctions;
}
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Binder/SimpleProgramBinder.cs", 112);
}
}