public override object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data) { CodeVariableDeclarationStatement declStmt = null; for (int i = 0; i < localVariableDeclaration.Variables.Count; ++i) { CodeTypeReference type = ConvType(localVariableDeclaration.GetTypeForVariable(i) ?? new TypeReference("System.Object", true)); VariableDeclaration var = (VariableDeclaration)localVariableDeclaration.Variables[i]; if (!var.Initializer.IsNull) { declStmt = new CodeVariableDeclarationStatement(type, var.Name, (CodeExpression)((INode)var.Initializer).AcceptVisitor(this, data)); } else { declStmt = new CodeVariableDeclarationStatement(type, var.Name); } variables.Add(declStmt); AddStmt(declStmt); } return declStmt; }
public override object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data) { for (int i = 0; i < localVariableDeclaration.Variables.Count; ++i) { VariableDeclaration varDecl = (VariableDeclaration)localVariableDeclaration.Variables[i]; AddVariable(localVariableDeclaration.GetTypeForVariable(i), varDecl.Name, localVariableDeclaration.StartLocation, CurrentEndLocation, (localVariableDeclaration.Modifier & Modifiers.Const) == Modifiers.Const, false, varDecl.Initializer, null, false); } return base.VisitLocalVariableDeclaration(localVariableDeclaration, data); }