Adapt to latest kdevplatform API

parent 6b784626
......@@ -58,7 +58,7 @@ void PythonDeclarationCompletionItem::setTypeHint(PythonCodeCompletionContext::I
m_typeHint = type;
}
QString PythonDeclarationCompletionItem::shortenedTypeString(KDevelop::DeclarationPointer decl, int desiredTypeLength) const {
QString PythonDeclarationCompletionItem::shortenedTypeString(const KDevelop::DeclarationPointer& decl, int desiredTypeLength) const {
if ( !decl ) {
return {};
}
......
......@@ -32,7 +32,7 @@ public:
QExplicitlySharedDataPointer<KDevelop::CodeCompletionContext> context = QExplicitlySharedDataPointer<KDevelop::CodeCompletionContext>(),
int inheritanceDepth = 0);
QVariant data(const QModelIndex& index, int role, const KDevelop::CodeCompletionModel* model) const override;
QString shortenedTypeString(KDevelop::DeclarationPointer decl, int desiredTypeLength) const override;
QString shortenedTypeString(const KDevelop::DeclarationPointer& decl, int desiredTypeLength) const override;
void setTypeHint(PythonCodeCompletionContext::ItemTypeHint type);
void addMatchQuality(int add);
......
......@@ -37,7 +37,7 @@ PythonCodeCompletionWorker::PythonCodeCompletionWorker(PythonCodeCompletionModel
KDevelop::CodeCompletionContext* PythonCodeCompletionWorker::createCompletionContext(KDevelop::DUContextPointer context,
KDevelop::CodeCompletionContext* PythonCodeCompletionWorker::createCompletionContext(const KDevelop::DUContextPointer& context,
const QString& contextText,
const QString& followingText,
const KDevelop::CursorInRevision& position) const
......@@ -51,7 +51,8 @@ KDevelop::CodeCompletionContext* PythonCodeCompletionWorker::createCompletionCon
return completionContext;
}
void PythonCodeCompletionWorker::updateContextRange(KTextEditor::Range &contextRange, KTextEditor::View *view, KDevelop::DUContextPointer context) const
void PythonCodeCompletionWorker::updateContextRange(KTextEditor::Range &contextRange, KTextEditor::View *view,
const KDevelop::DUContextPointer& context) const
{
if ( ! context ) {
return;
......
......@@ -32,8 +32,8 @@ class KDEVPYTHONCOMPLETION_EXPORT PythonCodeCompletionWorker : public KDevelop::
public:
PythonCodeCompletionWorker(PythonCodeCompletionModel *parent, const QUrl& document);
KDevelop::CodeCompletionContext* createCompletionContext(KDevelop::DUContextPointer context, const QString& contextText, const QString& followingText, const KDevelop::CursorInRevision& position) const override;
void updateContextRange(KTextEditor::Range &contextRange, KTextEditor::View *view, KDevelop::DUContextPointer context) const override;
KDevelop::CodeCompletionContext* createCompletionContext(const KDevelop::DUContextPointer& context, const QString& contextText, const QString& followingText, const KDevelop::CursorInRevision& position) const override;
void updateContextRange(KTextEditor::Range &contextRange, KTextEditor::View *view, const KDevelop::DUContextPointer& context) const override;
PythonCodeCompletionModel* parent;
};
......
......@@ -53,8 +53,10 @@ using namespace KTextEditor;
namespace Python
{
ReferencedTopDUContext ContextBuilder::build(const IndexedString& url, Ast* node, ReferencedTopDUContext updateContext)
ReferencedTopDUContext ContextBuilder::build(const IndexedString& url, Ast* node,
const ReferencedTopDUContext& updateContext_)
{
ReferencedTopDUContext updateContext(updateContext_);
if (!updateContext) {
DUChainReadLocker lock(DUChain::lock());
updateContext = DUChain::self()->chainForDocument(url);
......
......@@ -53,7 +53,7 @@ public:
* @brief Entry function called by KDevPlatform API.
*/
ReferencedTopDUContext build(const KDevelop::IndexedString& url, Ast* node,
ReferencedTopDUContext updateContext = ReferencedTopDUContext()) override;
const ReferencedTopDUContext& updateContext = ReferencedTopDUContext()) override;
/**
* @brief Set the editor integrator.
......
......@@ -84,8 +84,10 @@ void DeclarationBuilder::setPrebuilding(bool prebuilding)
m_prebuilding = prebuilding;
}
ReferencedTopDUContext DeclarationBuilder::build(const IndexedString& url, Ast* node, ReferencedTopDUContext updateContext)
ReferencedTopDUContext DeclarationBuilder::build(const IndexedString& url, Ast* node,
const ReferencedTopDUContext& updateContext_)
{
ReferencedTopDUContext updateContext(updateContext_);
m_correctionHelper.reset(new CorrectionHelper(url, this));
// The declaration builder needs to run twice, so it can resolve uses of e.g. functions
......
......@@ -49,7 +49,7 @@ public:
* @brief Entry function, called by KDevPlatform.
*/
ReferencedTopDUContext build(const IndexedString& url, Ast* node,
ReferencedTopDUContext updateContext = ReferencedTopDUContext()) override;
const ReferencedTopDUContext& updateContext = ReferencedTopDUContext()) override;
/**
* @brief Set whether the current running pass is the first or the second one.
......
......@@ -153,7 +153,7 @@ AbstractType::WhichType UnsureType::whichType() const
return AbstractType::TypeUnsure;
}
void UnsureType::addType(IndexedType indexed) {
void UnsureType::addType(const IndexedType& indexed) {
auto type = indexed.abstractType();
auto hinted = type.cast<HintedType>(); // XXX: do we need a read locker here?
if ( ! hinted ) {
......
......@@ -52,7 +52,7 @@ public:
uint hash() const override;
QString toString() const override;
void addType(IndexedType type) override;
void addType(const IndexedType& type) override;
const QList<AbstractType::Ptr> typesRecursive() const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment