diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2016-05-13 13:41:42 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2016-05-19 12:46:28 +0000 |
commit | 219873c65fed284310bfb6d32d8b7ddf8fc15da1 (patch) | |
tree | c61624106f0b42977ac9f7e0d5d829de15504b06 /src/qml/compiler/qqmlirbuilder.cpp | |
parent | ef6469a95948b8c95ed6fb0cbbe7daaa1960c956 (diff) |
Fix regression with assignments to default properties
With commit ad8d760decd5f1c6242a42688417b3c86122121c the precision of the
location (row/column) fields was reduced. The same fields are used to preserve
the insertion orer of bindings as they appear in the .qml file, which meant
that for large qml files without any line feeds we may end up with an overrun
in the column range (2048). This happened in the
Tests_TabView::test_mousePressOnTabBar test in qtquickcontrols.
The reduced precision is fine because those column/row fields should only be
used for error reporting. In this case where we need the precision we can just
as well use the file offset in the temporary QML-IR Binding data structure.
Task-number: QTBUG-53115
Change-Id: Ifb6f76b4f83a06fa228211134d12cc67c071bbec
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Diffstat (limited to 'src/qml/compiler/qqmlirbuilder.cpp')
-rw-r--r-- | src/qml/compiler/qqmlirbuilder.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp index df0b1f67b1..bd4261493c 100644 --- a/src/qml/compiler/qqmlirbuilder.cpp +++ b/src/qml/compiler/qqmlirbuilder.cpp @@ -190,7 +190,7 @@ Binding *Object::findBinding(quint32 nameIndex) const void Object::insertSorted(Binding *b) { - Binding *insertionPoint = bindings->findSortedInsertionPoint<QV4::CompiledData::Location, QV4::CompiledData::Binding, &QV4::CompiledData::Binding::valueLocation>(b); + Binding *insertionPoint = bindings->findSortedInsertionPoint<quint32, Binding, &Binding::offset>(b); bindings->insertAfter(insertionPoint, b); } @@ -1082,6 +1082,7 @@ void IRBuilder::appendBinding(const QQmlJS::AST::SourceLocation &qualifiedNameLo { Binding *binding = New<Binding>(); binding->propertyNameIndex = propertyNameIndex; + binding->offset = nameLocation.offset; binding->location.line = nameLocation.startLine; binding->location.column = nameLocation.startColumn; binding->flags = 0; @@ -1101,6 +1102,7 @@ void IRBuilder::appendBinding(const QQmlJS::AST::SourceLocation &qualifiedNameLo Binding *binding = New<Binding>(); binding->propertyNameIndex = propertyNameIndex; + binding->offset = nameLocation.offset; binding->location.line = nameLocation.startLine; binding->location.column = nameLocation.startColumn; @@ -1225,6 +1227,7 @@ bool IRBuilder::resolveQualifiedId(QQmlJS::AST::UiQualifiedId **nameToResolve, O if (!binding) { binding = New<Binding>(); binding->propertyNameIndex = propertyNameIndex; + binding->offset = qualifiedIdElement->identifierToken.offset; binding->location.line = qualifiedIdElement->identifierToken.startLine; binding->location.column = qualifiedIdElement->identifierToken.startColumn; binding->valueLocation.line = qualifiedIdElement->next->identifierToken.startLine; |