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

ES7: Template literals, nested strings are not working

    XMLWordPrintable

Details

    • All
    • 64ee4968b46019b8e4cb7523a6e41833fc4cf665 (qt/qtdeclarative/5.12.0)

    Description

      Ecmascript template literals are not working correctly if there are nested strings inside.

      For example

      `This is Text \nand this is newline`
      

      works just fine, but

          let a = 123;
          let b = `x ${a} \ny`;
          print(b);
      

      gives an error "Expected token `(template tail)'"

      However, this same javascript code seems to evaluate correctly with QJSEngine

          QJSEngine jsEngine;
          QJSValue value = jsEngine.evaluate("let a = 123; let b = `x${a}\ny`; b;");
      
          qDebug() << value.toString(); // prints "x123\ny"
      

      Please find the attached example project which demonstrates this issue

      Attachments

        Issue Links

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

          Activity

            People

              ulherman Ulf Hermann
              pekarjal Pekka Karjalainen
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes