jit: Function argument in ternary

Posted on
  • According to the documentation the ternary operator is supported in the jit, but it fails in this minimal example on latest firmware:

    const test = (arg) => {
      "jit";
      return arg > 0 ? arg : 0;
    };
    
    console.log(test(1));
    

    I get the following error:

    Uncaught InternalError: Variable type cannot be converted to string

    Without the "jit" string the function works as expected. Also assigning the argument to a temporary variable does:

    const test = (arg) => {
      "jit";
      const tmp = arg;
      return arg > 0 ? arg : 0;
    };
    
    console.log(test(1));
    

    1

    Is this a bug or is it me doing something wrong?

  • Thanks for tracking this down to just the one expression - that makes my life much easier!

    I've just looked into this and it's definitely a bug - I've got a fix in now, so if you install the latest cutting edge build it should work!

  • Cool, thanks.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

jit: Function argument in ternary

Posted by Avatar for user140377 @user140377

Actions