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

Add more fine grained logging category for "used before declaration" warning

    XMLWordPrintable

Details

    • 1bd18723f (dev)

    Description

      The snippet below works with Qt 5 and 6.2, but not with Qt 6.5. https://jshint.com/ claims this code is OK - but QML in Qt 6.5 says no:

      qt.qml.compiler: /home/andrhans/tmp/jstest/main.qml:8:30 Variable "exec" is used before its declaration at 16:17.
      QQmlComponent: Component is not ready
      qml: Did not load any objects, exiting.
      

      Snippet:

      import QtQuick
      
      MouseArea {
      
          onClicked: () => {
              var operatorMap = {
                      'and': function(context, params) {
                          params = exec(context, params);
                          if (!params) {
                              /* do something */
                          }
                          return true;
                      }
                  };
      
                  var exec = function(context, query) {
                      /* do stuff */
                  };
      
              operatorMap.and(1, 2);
          }
      }
      
      

      Attachments

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

        Activity

          People

            qtqmlteam Qt Qml Team User
            andrhans Andreas Aardal Hanssen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes