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

Block-scoped variable declaration is hoisted in QML

XMLWordPrintable

    • Windows
    • 1d3d7437ba (qt/qtdeclarative/dev) 1d3d7437ba (qt/tqtc-qtdeclarative/dev) 1d3d7437ba (qt/qtdeclarative/wip/material3) 1d3d7437ba (qt/tqtc-qtdeclarative/wip/material3)

      The let-declarations are hoisted even though they should not:

      function foo() {
          n = 0;
          console.log(n);  // should give a ReferenceError, but it doesn't
          let n;
      }
      

      ECMA-262, 7th Edition, ยง13.3.1:

      The variables are created when their containing Lexical Environment is instantiated but may not be accessed in any way until the variable's LexicalBinding is evaluated.

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

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            gooroo Serhii Olendarenko
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes