Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
NeutraleNull opened this issue Mar 8, 2021 · 0 comments
Open

Comments

@NeutraleNull
Copy link

NeutraleNull commented Mar 8, 2021

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;
@NeutraleNull NeutraleNull added the bug Error, flaw, failure or fault that causes to produce an incorrect result or crash label Mar 8, 2021
@X39 X39 added enhancement sqc and removed bug Error, flaw, failure or fault that causes to produce an incorrect result or crash labels Mar 10, 2021
@X39 X39 changed the title [BUG] Preincrement and Postincrement not working correctly on arrays Make Pre- and Post- increment/decrement operators work on all types Mar 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants