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

Block-scoped variable declaration is hoisted in QML

    XMLWordPrintable

Details

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

    Description

      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.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-77428
          # Subject Branch Project Status CR V

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes