private BoundForStatement BindForParts(ForStatementSyntax node, Binder originalBinder, DiagnosticBag diagnostics) { BoundStatement initializer; if (node.Declaration != null) { Debug.Assert(node.Initializers.Count == 0); if (node.Declaration.IsDeconstructionDeclaration) { initializer = originalBinder.BindDeconstructionDeclaration(node.Declaration, node.Declaration, diagnostics); } else { ImmutableArray<BoundLocalDeclaration> unused; initializer = originalBinder.BindForOrUsingOrFixedDeclarations(node.Declaration, LocalDeclarationKind.ForInitializerVariable, diagnostics, out unused); } } else { initializer = originalBinder.BindStatementExpressionList(node.Initializers, diagnostics); } var condition = (node.Condition != null) ? originalBinder.BindBooleanExpression(node.Condition, diagnostics) : null; var increment = originalBinder.BindStatementExpressionList(node.Incrementors, diagnostics); var body = originalBinder.BindPossibleEmbeddedStatement(node.Statement, diagnostics); Debug.Assert(this.Locals == this.GetDeclaredLocalsForScope(node)); return new BoundForStatement(node, this.Locals, initializer, condition, increment, body, this.BreakLabel, this.ContinueLabel); }
private BoundForStatement BindForParts(ForStatementSyntax node, Binder originalBinder, DiagnosticBag diagnostics) { BoundStatement initializer; // Deconstruction, Declaration, and Initializers are mutually exclusive. if (_syntax.Deconstruction != null) { var assignment = originalBinder.BindDeconstructionDeclaration(node.Deconstruction, node.Deconstruction.VariableComponent, node.Deconstruction.Value, diagnostics); initializer = new BoundLocalDeconstructionDeclaration(node, assignment); } else if (_syntax.Declaration != null) { ImmutableArray <BoundLocalDeclaration> unused; initializer = originalBinder.BindForOrUsingOrFixedDeclarations(node.Declaration, LocalDeclarationKind.ForInitializerVariable, diagnostics, out unused); } else { initializer = originalBinder.BindStatementExpressionList(node.Initializers, diagnostics); } var condition = (node.Condition != null) ? originalBinder.BindBooleanExpression(node.Condition, diagnostics) : null; var increment = originalBinder.BindStatementExpressionList(node.Incrementors, diagnostics); var body = originalBinder.BindPossibleEmbeddedStatement(node.Statement, diagnostics); Debug.Assert(this.Locals == this.GetDeclaredLocalsForScope(node)); return(new BoundForStatement(node, this.Locals, initializer, condition, increment, body, this.BreakLabel, this.ContinueLabel)); }