• Ok, it looks like this is an Espruino issue caused by eval messing up the parse state.

    It can be caused just by:

    function test(){
     switch ("a"){
      case "a":
       eval(1);
       break;
     }
    }
    

    I've filed a bug for it here

    To work around this for now, add:

    function eval2(x) { return eval(x); }
    

    and then call eval2 instead of eval - hopefully that won't mess you up too much (although the new eval won't have access to the variables in the current scope).

About

Avatar for Gordon @Gordon started