diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-02-27 08:11:40 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-02 17:10:56 +0100 |
commit | 6f6f822dfc4180264a4de1e98d3411a964570aa3 (patch) | |
tree | 8ca6e1ee6e650041ae587d8e7804bc81a0940573 /src/qml/compiler/qqmlcodegenerator.cpp | |
parent | 16e70231d7b59b5ab181597c295253cccb80b235 (diff) |
[new compiler] Fix a few more tests related to property declarations with initializers
Consistently declare the property first before processing the initializer tree or binding
statement. Some tests expect errors in the declaration to show up before errors in the
statement for example.
Change-Id: If66bc4969fe9db7ae32f00023f3c90343bbe98e0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler/qqmlcodegenerator.cpp')
-rw-r--r-- | src/qml/compiler/qqmlcodegenerator.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/qml/compiler/qqmlcodegenerator.cpp b/src/qml/compiler/qqmlcodegenerator.cpp index cedbc92f8e..fe90f18db6 100644 --- a/src/qml/compiler/qqmlcodegenerator.cpp +++ b/src/qml/compiler/qqmlcodegenerator.cpp @@ -829,12 +829,7 @@ bool QQmlCodeGenerator::visit(QQmlJS::AST::UiPublicMember *node) propertyValue += alias.at(2); } property->aliasPropertyValueIndex = registerString(propertyValue); - } else if (node->statement) { - qSwap(_propertyDeclaration, property); - appendBinding(node->identifierToken, node->identifierToken, _propertyDeclaration->nameIndex, node->statement); - qSwap(_propertyDeclaration, property); } - QQmlJS::AST::SourceLocation errorLocation; QString error; @@ -855,12 +850,14 @@ bool QQmlCodeGenerator::visit(QQmlJS::AST::UiPublicMember *node) return false; } + qSwap(_propertyDeclaration, property); if (node->binding) { - qSwap(_propertyDeclaration, property); // process QML-like initializers (e.g. property Object o: Object {}) QQmlJS::AST::Node::accept(node->binding, this); - qSwap(_propertyDeclaration, property); + } else if (node->statement && type != QV4::CompiledData::Property::Alias) { + appendBinding(node->identifierToken, node->identifierToken, _propertyDeclaration->nameIndex, node->statement); } + qSwap(_propertyDeclaration, property); } return false; |