mindedsecurity/JStillery

how to handle comma?

Closed this issue · 4 comments

example:

        return e[n].call(o.exports, o, o.exports, t),
        o.loaded = !0,
        o.exports

what i want :

        e[n].call(o.exports, o, o.exports, t);
        o.loaded = !0;
        return o.exports;

Would it be sufficiently clear if comma expressions were parenthesized?

return (e[n].call(o.exports, o, o.exports, t),
        o.loaded = !0,
        o.exports)
wisec commented

quick and dirty 30 min fix:

function x(){
  return a=2,b=a,c;
}

rewrites to:

function x()
    /*Scope Closed:false | writes:false*/
    {
        {
            a = 2;
            b = a;
            return c;
        }
    }

It should be improved to remove that additional BlockStatement..
https://mindedsecurity.github.io/jstillery/#ZnVuY3Rpb24lMjB4KCklN0IlMEElMjAlMjByZXR1cm4lMjBhJTNEMiUyQ2IlM0RhJTJDYyUzQiUwQSU3RA==

@weituotian If that's enough for you can close the issue.
Thanks!

@wisec
Really cool stuff!
Excellent!
I will close this issue soon.

Before that, please allow me to ask more a question again. It is embarrassing to bring trouble to you.

var a = 1;
var b = 2;
if (a++, b++, a < b) {
    console.log('a<b')
}

to

var a = 1;
var b = 2;
a++;
b++;
if (a < b) {
    console.log('a<b')
}
wisec commented

No problem @weituotian, SequenceExpression is of course a broader problem than just together with ReturnStatement, it should be fixed converting it to a blockstatement.