Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
6.8
-
None
Description
For the following code:
Item {
property int propWithoutBinding
function a() {
++i;
}
}
This would confuse the IndentingLineWriter and the resulting indentation will be:
Item {
property int propWithoutBinding
function a() {
++i;
}
}
We found a fix by modifying the handleTokens function from qqmldomcodeformatter.cpp for the case BindingOrObjectdefinition, we add a case for T_FUNCTION:
case StateType::BindingOrObjectdefinition: switch (kind) { case QQmlJSGrammar::T_COLON: enter(StateType::BindingAssignment); break; case QQmlJSGrammar::T_LBRACE: enter(StateType::ObjectdefinitionOpen); break; // property definition without binding: case QQmlJSGrammar::T_FUNCTION: leave(true); enter(StateType::FunctionStart); break; } break;