no unit test? :D


On Tue, Oct 1, 2013 at 12:11 AM, Milian Wolff <mail@milianw.de> wrote:
Git commit 29a72f5c1234f1a47404e02d763da923be97fb58 by Milian Wolff.
Committed on 30/09/2013 at 22:08.
Pushed by mwolff into branch 'master'.

Support UiObjectInitializer without ClassDeclarations.

This is valid QML and thus must be supported. In the future we
might want to create ClassDeclarations for UiObjectBinding as
well though.

BUG: 324690

M  +4    -3    duchain/declarationbuilder.cpp

http://commits.kde.org/kdev-qmljs/29a72f5c1234f1a47404e02d763da923be97fb58

diff --git a/duchain/declarationbuilder.cpp b/duchain/declarationbuilder.cpp
index 0d0bf93..44d85d7 100644
--- a/duchain/declarationbuilder.cpp
+++ b/duchain/declarationbuilder.cpp
@@ -185,9 +185,10 @@ bool DeclarationBuilder::visit(QmlJS::AST::UiObjectInitializer* node)
 {
     bool ret = DeclarationBuilderBase::visit(node);
     DUChainWriteLocker lock;
-    Q_ASSERT(currentContext());
-    Q_ASSERT(currentDeclaration<ClassDeclaration>());
-    currentDeclaration()->setInternalContext(currentContext());
+    if (currentDeclaration<ClassDeclaration>()) {
+        Q_ASSERT(currentContext());
+        currentDeclaration()->setInternalContext(currentContext());
+    }
     return ret;
 }