VB -> C#: Local variables should be pulled before labels
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Bắt đầu từ đường dẫn chuyển đổi từ VB.NET sang C# xử lý các khai báo biến cục bộ và nhãn, sau đó so sánh nó với đầu vào được cung cấp và đầu ra mong đợi. Thêm một bài kiểm thử hồi quy cho ví dụ và xác nhận rằng khai báo cục bộ được tạo ra đứng trước nhãn, để chương trình đã chuyển đổi không lặp vô hạn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
VB.Net input code
Public Shared Sub Main()
Label:
Dim number As Integer
number += 1
If number = 1 Then GoTo Label
Console.WriteLine(number) ' will print 2
End Sub
Erroneous output
public static void Main()
{
Label:
; // that's ugly but still compiles
var number = default(int);
number += 1;
if (number == 1)
goto Label;
Console.WriteLine(number); // will never be called, infinite loop
}
Expected output
public static void Main()
{
var number = default(int);
Label:
number += 1;
if (number == 1)
goto Label;
Console.WriteLine(number);
}
Details
- Product in use: e.g. codeconverter.icsharpcode.net / VS extension / both
- Version in use: e.g. 5.6.3 or a commit hash https://github.com/icsharpcode/CodeConverter/commit/73d55b29c6c1e09dd9e3b6e9b30073d639d9e00d
- Did you see it working in a previous version, which? no
- Any other relevant information to the issue, or your interest in contributing a fix.
Very rare but unfortunately possible to happen in large, legacy code bases.
Maybe every variable initialization should be moved to the beginning of the procedure/before all labels when there are goto statements?
Related to #897
Even if the scope of a variable is limited to a block, its lifetime is still that of the entire procedure. If you enter the block more than once during the procedure, each block variable retains its previous value. To avoid unexpected results in such a case, it is wise to initialize block variables at the beginning of the block.
- 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
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của icsharpcode/CodeConverter
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
icsharpcode/CodeConverter#1271 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
icsharpcode/CodeConverter#1243 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
VB -> C#: Enum Values as IntegerCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởGood for coding agent VB -> C#
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
icsharpcode/CodeConverter#1212 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Good for coding agent VB -> C#
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
icsharpcode/CodeConverter#1211 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
C# -> VB
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
icsharpcode/CodeConverter#1171 · 7 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của icsharpcode/CodeConverter
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
umbraco/Umbraco.Automate#612 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
崩溃日志只按 CRLF 分行Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
PCL-Community/PCL-CE#3872 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
type:task ux
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
elsa-workflows/elsa-foundation#5253 ·
Maintainer thường phản hồi trong vòng 1 ngày