Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-89605

[QML] Default parameters in ES functions throws syntax error

    XMLWordPrintable

    Details

    • Platform/s:
      All

      Description

      As claimed in the documentation, currently the JS engine is supposed to be compliant with the 7th edition of ECMA-262.

      However, as of the 6th edition, one should be able to set default values for function parameters:

      function multiply(a, b = 1) {
        return a * b;
      }
      
      console.log(multiply(5, 2));
      // expected output: 10
      
      console.log(multiply(5));
      // expected output: 5
      

      Currently we get the following compilation error at the function declaration point:

      error: Expected token `)'

      This issue might be the cause for QTBUG-89604

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            mmi_puya Puya Daravi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes