[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdev-ruby/gsoc] duchain: Clear the module mixins list when declaring a class. Improved tests regard
From: Miquel_Sabaté <mikisabate () gmail ! com>
Date: 2012-05-31 21:27:06
Message-ID: 20120531212706.E80C6A60A9 () git ! kde ! org
[Download RAW message or body]
Git commit 6df41781cde512594132baad3900e21f4509b813 by Miquel Sabaté.
Committed on 31/05/2012 at 23:18.
Pushed by mssola into branch 'gsoc'.
Clear the module mixins list when declaring a class. Improved tests regarding module \
mixins
M +2 -1 duchain/builders/declarationbuilder.cpp
M +15 -2 duchain/tests/duchain.cpp
http://commits.kde.org/kdev-ruby/6df41781cde512594132baad3900e21f4509b813
diff --git a/duchain/builders/declarationbuilder.cpp \
b/duchain/builders/declarationbuilder.cpp index e3427b7..21a87d1 100644
--- a/duchain/builders/declarationbuilder.cpp
+++ b/duchain/builders/declarationbuilder.cpp
@@ -83,8 +83,9 @@ void DeclarationBuilder::visitClassStatement(RubyAst *node)
/* First of all, open the declaration and set the comment */
setComment(getComment(node));
ClassDeclaration *decl = openDeclaration<ClassDeclaration>(id, range);
- decl->setKind(KDevelop::Declaration::Type);
decl->clearBaseClass();
+ decl->clearModuleMixins();
+ decl->setKind(KDevelop::Declaration::Type);
m_accessPolicyStack.push(Declaration::Public);
lastClassModule = decl;
insideClassModule = true;
diff --git a/duchain/tests/duchain.cpp b/duchain/tests/duchain.cpp
index fa91469..b366d3c 100644
--- a/duchain/tests/duchain.cpp
+++ b/duchain/tests/duchain.cpp
@@ -815,6 +815,7 @@ void TestDUChain::include1()
QVERIFY(md);
QCOMPARE(md->internalContext()->localDeclarations(md->topContext()).size(), 1);
QCOMPARE(md->moduleMixinsSize(), 1u);
+ QVERIFY(md->moduleMixins()[0].included);
QCOMPARE(md->moduleMixins()[0].module.type<StructureType>()->qualifiedIdentifier(), \
QualifiedIdentifier("AA::BB")); }
@@ -830,7 +831,13 @@ void TestDUChain::include2()
DUChainReleaser releaser(top);
DUChainWriteLocker lock(DUChain::lock());
- PENDING("Left as pending for some reason.");
+ Declaration *obj = top->findLocalDeclarations(Identifier("Klass")).first();
+ ModuleDeclaration *md = dynamic_cast<ModuleDeclaration *>(obj);
+ QVERIFY(md);
+ QCOMPARE(md->internalContext()->localDeclarations(md->topContext()).size(), 1);
+ QCOMPARE(md->moduleMixinsSize(), 1u);
+ QVERIFY(md->moduleMixins()[0].included);
+ QCOMPARE(md->moduleMixins()[0].module.type<StructureType>()->qualifiedIdentifier(), \
QualifiedIdentifier("AA::CC")); }
void TestDUChain::extend1()
@@ -842,7 +849,13 @@ void TestDUChain::extend1()
DUChainReleaser releaser(top);
DUChainWriteLocker lock(DUChain::lock());
- PENDING("Left as pending for some reason.");
+ Declaration *obj = top->findLocalDeclarations(Identifier("Klass")).first();
+ ModuleDeclaration *md = dynamic_cast<ModuleDeclaration *>(obj);
+ QVERIFY(md);
+ QCOMPARE(md->internalContext()->localDeclarations(md->topContext()).size(), 1);
+ QCOMPARE(md->moduleMixinsSize(), 1u);
+ QVERIFY(!md->moduleMixins()[0].included);
+ QCOMPARE(md->moduleMixins()[0].module.type<StructureType>()->qualifiedIdentifier(), \
QualifiedIdentifier("AA::BB")); }
//END: Include & Extend
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic