Make Pre- and Post- increment/decrement operators work on all types

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

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
25/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
cpp
Lĩnh vực
compilers

Hướng nghiên cứu

Start by reproducing the nested-array example and compare pre-increment with post-increment behavior in the SQF compiler or runtime. Trace how increment and decrement expressions are translated for array element access, then define and test behavior for all supported operand types, including the expected generated SQF.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement sqc

Describe the bug

Lets say i've got this little array here:
example = [ [0,1], [0, 1, 2] ];

Now i want to increase the second value in the first array by one by doing

example[0][1] = ++example[0][1];

However the output sqf code is:

   example = [[0, 1], [0, 1, 2]];
   example = (example + 1);
   example select 0 set [1, example select 0 select 1];

I tries to first increment example and thereafter assign the value to array.
Doing a post increment won't work at all in this context.

I guess this is a really specific usecase and i won't mind not fix it.
In the end it would generate the same code as i would if i had written:

let temp = example[0][1];
temp++;
example[0][1] = temp;
Ngôn ngữ chính
C++
Star
104
Fork
31
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 SQFvm/runtime

Tất cả issue của SQFvm/runtime

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.