// collect locals into provided scope // leave initializers in the tree if there are any public override BoundNode VisitMultipleLocalDeclarations(BoundMultipleLocalDeclarations node) { ArrayBuilder <BoundStatement> inits = null; foreach (var decl in node.LocalDeclarations) { var init = VisitLocalDeclaration(decl); if (init != null) { if (inits == null) { inits = ArrayBuilder <BoundStatement> .GetInstance(); } inits.Add((BoundStatement)init); } } if (inits != null) { return(BoundStatementList.Synthesized(node.Syntax, node.HasErrors, inits.ToReadOnlyAndFree())); } else { // no initializers return(null); // TODO: but what if hasErrors? Have we lost that? } }
public override object VisitMultipleLocalDeclarations(BoundMultipleLocalDeclarations node, object arg) { foreach (var v in node.LocalDeclarations) { Visit(v); } return(null); }
public override BoundNode VisitUsingStatement(BoundUsingStatement node) { var newLocals = RewriteLocals(node.Locals); BoundMultipleLocalDeclarations declarationsOpt = (BoundMultipleLocalDeclarations)this.Visit(node.DeclarationsOpt); BoundExpression expressionOpt = (BoundExpression)this.Visit(node.ExpressionOpt); BoundStatement body = (BoundStatement)this.Visit(node.Body); Conversion disposableConversion = RewriteConversion(node.IDisposableConversion); return node.Update(newLocals, declarationsOpt, expressionOpt, disposableConversion, body); }
// collect locals into provided scope // leave initializers in the tree if there are any public override BoundNode VisitMultipleLocalDeclarations(BoundMultipleLocalDeclarations node) { ArrayBuilder<BoundStatement> inits = null; foreach (var decl in node.LocalDeclarations) { var init = VisitLocalDeclaration(decl); if (init != null) { if (inits == null) { inits = ArrayBuilder<BoundStatement>.GetInstance(); } inits.Add((BoundStatement)init); } } if (inits != null) { return BoundStatementList.Synthesized(node.Syntax, node.HasErrors, inits.ToReadOnlyAndFree()); } else { // no initializers return null; // TODO: but what if hasErrors? Have we lost that? } }