VB -> C#: Pulling variables before the loop can rename variables in an unexpected way.

Đang mở
#916 2 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@Yozer đang làm issue này rồi.

Từ ngày 5/7/2022.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

compilation error Good for coding agent output logic error VB -> C#
VB.Net input code
Private Sub TestMethod()
    For i = 1 To 2
        If i = 1 Then
            Dim a As Integer
            a += 1
            System.Console.WriteLine(a)
        End If
    Next
End Sub
Erroneous output
private void TestMethod()
{
    var a = default(int);
    for (int i = 1; i <= 2; i++)
    {
        if (i == 1)
        {
            ph38013f178570470fb7aea44e2e2f4f41 += 1;
            System.Console.WriteLine(ph38013f178570470fb7aea44e2e2f4f41);
        }
    }
}
Expected output
private void TestMethod()
{
    var a = default(int);
    for (int i = 1; i <= 2; i++)
    {
        if (i == 1)
        {
            a+= 1;
            System.Console.WriteLine(a);
        }
    }
}
Details

I can try to take a look, probably the issue is related to nested scope that is not a loop.

Ngôn ngữ chính
C#
Star
918
Fork
244
Merge trung bình
1 ngày 10 giờ
Pull request đã merge (30 ngày)
29

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của icsharpcode/CodeConverter

Tất cả issue của icsharpcode/CodeConverter

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.