Details
-
Bug
-
Resolution: Done
-
P2: Important
-
Qt Creator 4.9.0-rc1
Description
Try to reformat (Tools->QML/JS->Reformat File) the following test file:
import QtQuick 2.0 Item { Component.onCompleted: { for (var a in []) { console.log(a) } } }
The result will be:
import QtQuick 2.0 Item { Component.onCompleted: { for (a in []) { console.log(a) } } }
var is removed so the following error will appear while executing the program with an array containing strings for example:
Error: Invalid write to global property "a"
It seems that this new behavior comes from the last commit of qmljsreformatter.cpp which removes the handling of LocalForStatement and LocalForEachStatement.