Files
2026-08-27 10:56:38 -06:00

74 lines
3.1 KiB
C#

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 FixedStatementBinder : LocalScopeBinder
{
private readonly FixedStatementSyntax _syntax;
internal override SyntaxNode ScopeDesignator => (SyntaxNode)(object)_syntax;
public FixedStatementBinder(Binder enclosing, FixedStatementSyntax syntax)
: base(enclosing)
{
_syntax = syntax;
}
protected override ImmutableArray<LocalSymbol> BuildLocals()
{
//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)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
if (_syntax.Declaration != null)
{
ArrayBuilder<LocalSymbol> val = new ArrayBuilder<LocalSymbol>(_syntax.Declaration.Variables.Count);
_syntax.Declaration.Type.VisitRankSpecifiers(delegate(ArrayRankSpecifierSyntax rankSpecifier, (FixedStatementBinder binder, ArrayBuilder<LocalSymbol> locals) args)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
Enumerator<ExpressionSyntax> enumerator2 = rankSpecifier.Sizes.GetEnumerator();
while (enumerator2.MoveNext())
{
ExpressionSyntax current2 = enumerator2.Current;
if (current2.Kind() != SyntaxKind.OmittedArraySizeExpression)
{
ExpressionVariableFinder.FindExpressionVariables(args.binder, args.locals, current2, null);
}
}
}, (this, val));
Enumerator<VariableDeclaratorSyntax> enumerator = _syntax.Declaration.Variables.GetEnumerator();
while (enumerator.MoveNext())
{
VariableDeclaratorSyntax current = enumerator.Current;
val.Add((LocalSymbol)MakeLocal(_syntax.Declaration, current, LocalDeclarationKind.FixedVariable, allowScoped: false));
ExpressionVariableFinder.FindExpressionVariables(this, val, current, null);
}
return val.ToImmutable();
}
return ImmutableArray<LocalSymbol>.Empty;
}
internal override ImmutableArray<LocalSymbol> GetDeclaredLocalsForScope(SyntaxNode scopeDesignator)
{
if ((object)_syntax == scopeDesignator)
{
return Locals;
}
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Binder/FixedStatementBinder.cs", 67);
}
internal override ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode scopeDesignator)
{
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Binder/FixedStatementBinder.cs", 72);
}
}