ShaderTools.Hlsl.Binding.Binder.BindForStatementDeclaration C# (CSharp) Method

BindForStatementDeclaration() private method

private BindForStatementDeclaration ( VariableDeclarationSyntax syntax, Symbol parent ) : BoundMultipleVariableDeclarations
syntax VariableDeclarationSyntax
parent ShaderTools.Hlsl.Symbols.Symbol
return ShaderTools.Hlsl.Binding.BoundNodes.BoundMultipleVariableDeclarations
        private BoundMultipleVariableDeclarations BindForStatementDeclaration(VariableDeclarationSyntax syntax, Symbol parent)
        {
            // When binding for loop declarations, allow redefinition of variables from enclosing scope. (X3078)
            // Use most recently declared variable. Add a warning to diagnostics.

            return BindVariableDeclaration(syntax, parent, (d, t) =>
            {
                List<Symbol> existingSymbols;
                if (_symbols.TryGetValue(d.Identifier.Text, out existingSymbols))
                {
                    existingSymbols.Remove(existingSymbols.Last());
                    if (!existingSymbols.Any())
                        _symbols.Remove(d.Identifier.Text);
                    Diagnostics.ReportLoopControlVariableConflict(d);
                }
                return new VariableSymbol(d, parent, t);
            });
        }