diff --git a/duchain/builders/declarationbuilder.cpp b/duchain/builders/declarationbuilder.cpp --- a/duchain/builders/declarationbuilder.cpp +++ b/duchain/builders/declarationbuilder.cpp @@ -177,7 +177,7 @@ setComment(m_lastConstComment); } DUChainWriteLocker lock; - Declaration* dec = openDeclaration(identifierForNode(id), editorFindRange(id, 0)); + Declaration* dec = openDeclaration(identifier.last(), editorFindRange(id, 0)); dec->setType(type); dec->setKind(Declaration::Instance); closeDeclaration(); @@ -328,7 +328,7 @@ ClassDeclaration* decl; { DUChainWriteLocker lock; - decl = openDeclaration(identifierForNode(node->name), editorFindRange(node->name, 0)); + decl = openDeclaration(identifierForNode(node->name).last(), editorFindRange(node->name, 0)); //decl->setKind(Declaration::Namespace); decl->setKind(Declaration::Type); //force direct here because otherwise DeclarationId will mess up actual type declaration and method declarations @@ -431,20 +431,20 @@ if(node->packageName) {//create alias for package QualifiedIdentifier id = identifierForNode(node->packageName); - NamespaceAliasDeclaration* decl = openDeclaration(id, editorFindRange(node->importpath, 0)); + NamespaceAliasDeclaration* decl = openDeclaration(id.last(), editorFindRange(node->importpath, 0)); decl->setKind(Declaration::NamespaceAlias); decl->setImportIdentifier(packageName); //this needs to be actual package name closeDeclaration(); }else if(node->dot != -1) {//anonymous import - NamespaceAliasDeclaration* decl = openDeclaration(QualifiedIdentifier(globalImportIdentifier()), + NamespaceAliasDeclaration* decl = openDeclaration(QualifiedIdentifier(globalImportIdentifier()).last(), editorFindRange(node->importpath, 0)); decl->setKind(Declaration::NamespaceAlias); decl->setImportIdentifier(packageName); //this needs to be actual package name closeDeclaration(); }else { - Declaration* decl = openDeclaration(packageName, editorFindRange(node->importpath, 0)); + Declaration* decl = openDeclaration(packageName.last(), editorFindRange(node->importpath, 0)); decl->setKind(Declaration::Import); closeDeclaration(); } @@ -459,7 +459,7 @@ { setComment(m_session->commentBeforeToken(node->startToken)); DUChainWriteLocker lock; - Declaration* packageDeclaration = openDeclaration(identifierForNode(node->packageClause->packageName), editorFindRange(node->packageClause->packageName, 0)); + Declaration* packageDeclaration = openDeclaration(identifierForNode(node->packageClause->packageName).last(), editorFindRange(node->packageClause->packageName, 0)); packageDeclaration->setKind(Declaration::Namespace); openContext(node, editorFindRange(node, 0), DUContext::Namespace, identifierForNode(node->packageClause->packageName)); @@ -518,7 +518,7 @@ { DUChainWriteLocker lock; //import builtins - NamespaceAliasDeclaration* decl = openDeclaration(QualifiedIdentifier(globalImportIdentifier()), RangeInRevision()); + NamespaceAliasDeclaration* decl = openDeclaration(QualifiedIdentifier(globalImportIdentifier()).last(), RangeInRevision()); decl->setKind(Declaration::NamespaceAlias); decl->setImportIdentifier(QualifiedIdentifier("_builtins")); closeDeclaration(); @@ -590,7 +590,7 @@ DUChainWriteLocker lock; if(lastType()->toString() != "nil" && !m_switchTypeVariable.isEmpty()) {//in that case we also don't open declaration - Declaration* decl = openDeclaration(m_switchTypeVariable, editorFindRange(typeIter->element, 0)); + Declaration* decl = openDeclaration(m_switchTypeVariable.last(), editorFindRange(typeIter->element, 0)); decl->setAbstractType(lastType()); closeDeclaration(); }