• Per the standard, the condition in loops is an Expression, but Espruino evidently parses it as AssignmentExpression, disallowing the comma operator. This is particularly painful contexts like

    while (x = costlyAccessor(i++), p(x.a, x.b)) …;
    

    Minimal reproduction:

    >while(0,0);
    Uncaught SyntaxError: Got ',' expected ')'
     at line 1 col 8
    while(0,0);
           ^
    >for(;0,0;);
    Uncaught SyntaxError: Got ',' expected ';'
     at line 1 col 7
    for(;0,0;);
          ^
    >do;while(0,0);
    Uncaught SyntaxError: Got ',' expected ')'
     at line 1 col 11
    do;while(0,0);
    

    Oddly, if and switch have no such problem.

About

Avatar for Robin @Robin started