SVN commit 933457 by apol: Fixed context creation. Now we can navigate again through the imported files. M +7 -9 parser/cmakeprojectvisitor.cpp M +1 -1 tests/cmakeduchaintest.cpp --- trunk/KDE/kdevelop/projectmanagers/cmake/parser/cmakeprojectvisitor.cpp #933456:933457 @@ -560,7 +560,7 @@ if(pack->noModule()) { - m_vars->insert(QString("%1_CONFIG"), QStringList(path)); + m_vars->insert(QString("%1_CONFIG").arg(pack->name()), QStringList(path)); } m_vars->take("CMAKE_CURRENT_LIST_FILE"); } @@ -578,6 +578,7 @@ { DUChainWriteLocker lock(DUChain::lock()); KDevelop::ReferencedTopDUContext topctx=DUChain::self()->chainForDocument(path); + if(topctx) { topctx->deleteLocalDeclarations(); @@ -592,11 +593,11 @@ } else { - topctx=new TopDUContext(IndexedString(path), - SimpleRange(0,0, endl, endc)); + topctx=new TopDUContext(IndexedString(path), SimpleRange(0,0, endl, endc)); DUChain::self()->addDocumentChain(topctx); Q_ASSERT(DUChain::self()->chainForDocument(path)); + topctx->addImportedParentContext(aux); aux->addImportedParentContext(topctx); } @@ -987,15 +988,11 @@ m_vars->insertMulti("ARGC", QStringList(QString::number(call->arguments().count()))); kDebug(9042) << "argn=" << m_vars->value("ARGN"); - kDebug() << "pppppppppp" << m_topctx << m_topctx->findDeclarations(Identifier(call->name())).count() - << m_topctx->localDeclarations().size(); //Executing int len = walk(code.code, 1); kDebug(9042) << "visited!" << call->name() << m_vars->value("ARGV") << "_" << m_vars->value("ARGN") << "..." << len; - kDebug() << "oooooooooo" << m_topctx << m_topctx->findDeclarations(Identifier(call->name())).count() - << m_topctx->localDeclarations().size(); //Restoring i=1; foreach(const QString& name, code.knownArgs) @@ -1861,7 +1858,7 @@ if(!m_topctx || m_topctx->url().toUrl()!=url) { kDebug(9042) << "Creating a context for" << url; - m_topctx=createContext(url, m_parentCtx, fc.last().endLine-1, fc.last().endColumn-1); + m_topctx=createContext(url, aux ? aux : m_parentCtx, fc.last().endLine-1, fc.last().endColumn-1); if(!aux) aux=m_topctx; } @@ -1888,6 +1885,7 @@ createUses(*it); // kDebug(9042) << "resolving:" << it->writeBack(); + CMakeFunctionDesc func = resolveVariables(*it); //FIXME not correct in while case bool correct = element->parseFunctionInfo(func); // kDebug(9042) << "resolved:" << func.writeBack() << correct; @@ -1971,7 +1969,7 @@ { QString var=arg.value.mid(it->first+1, it->second-it->first-1); QList decls=m_topctx->findDeclarations(Identifier(var)); - + if(!decls.isEmpty()) { int idx=m_topctx->indexForUsedDeclaration(decls.first()); --- trunk/KDE/kdevelop/projectmanagers/cmake/tests/cmakeduchaintest.cpp #933456:933457 @@ -203,7 +203,7 @@ } ReferencedTopDUContext m_fakeContext=new TopDUContext(IndexedString(file.fileName()), SimpleRange(0,0, endl, endc)); - QString inputIncluded="set(avalue 33)"; + QString inputIncluded="set(avalue 33)\n"; QFile includedFile("included.cmake"); QVERIFY(includedFile.open(QIODevice::WriteOnly | QIODevice::Text));