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

未關閉
#916 2 則留言 0 個 reaction 已指派 1 人 在 GitHub 檢視

維護者通常 1 天內回覆

@Yozer 已經在處理了。

開始於 2022年7月5日。

評估

這個 Issue 還沒有評估資料。

描述

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.

主要語言
C#
星號
918
分支
244
平均合併
1 天 10 小時
30 天內合併 PR
29

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

icsharpcode/CodeConverter 的其他 Issue

查看 icsharpcode/CodeConverter 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。