reflaxe icon indicating copy to clipboard operation
reflaxe copied to clipboard

EIE fix short-circuiting

Open SomeRanDev opened this issue 1 year ago • 2 comments

This will break lmao. HOW COULD I BE SO STUPID.

// This:
final array: Array<Int>;
if(array.length > 0 && if(array[0] > 100) { array[0] == 111; } else { true; }) {
   // bruh
}

// Gets converted to this:
var tempBool;
if(array[0] > 100) tempBool = array[0] == 111;
else tempBool = true;

if(array.length > 0 && tempBool) {
   // bruh
}

SomeRanDev avatar Dec 23 '24 13:12 SomeRanDev

It should be converted to(?):

var tempBool = array.length > 0;
if(tempBool) {
    if(array[0] > 100) tempBool = array[0] == 111;
    else tempBool = true;
}

if(tempBool) {
    // bruh
}

SomeRanDev avatar Dec 23 '24 13:12 SomeRanDev

In other words, if the 2nd part of a binop need to be outlined, then we must outline the 1st too. this applies generally to all outlineing, not only EIAE.

Its not that stupid, some are saying that short circuting is stupid by itself, EIE besides its benefits is also not the norm, so its fair for 2 stupid things to cause a 3rd stupid thing.

neimanpinchas avatar Dec 23 '24 19:12 neimanpinchas