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

qmlformat removes initialisation in if statemens

    XMLWordPrintable

Details

    Description

      qmlformat removes initialisation in if statements if not covered by a variable definitions:

      import QtQuick 2.15
      
      Item {
        function test() {
        let i = 0;
        for(i = 1; i < 10; i++) {
        }
        }
        }
      

      is formatted to

      import QtQuick 2.15
      
      Item {
          function test() {
              let i = 0;
              for (; i < 10; i++) {
              }
          }
      
      }
      

      Note the missing `i = 1` in the for loop. If I remove the `let` state and write `let i = 1` in the for loop, everything is okay.

      Attachments

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

        Activity

          People

            qtqmlteam Qt Qml Team User
            svenihoney Sven Fischer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes