LSP: do not potentially call the move assignment operator twice

This was caused by a diamond shaped inheritance hierarchy. Remove this
hierarchy by copying all accessor functions to the specialized class.

Change-Id: I877ee22a944a188bbcedda22de33a528529bf423
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
David Schulz
2018-09-05 08:23:11 +02:00
parent f76c5dc8e3
commit 50c808b1ef
2 changed files with 21 additions and 12 deletions

View File

@@ -42,7 +42,7 @@ public:
{ return checkOptional<bool>(error, resolveProviderKey); }
};
class LANGUAGESERVERPROTOCOL_EXPORT TextDocumentRegistrationOptions : public virtual JsonObject
class LANGUAGESERVERPROTOCOL_EXPORT TextDocumentRegistrationOptions : public JsonObject
{
public:
using JsonObject::JsonObject;
@@ -198,7 +198,7 @@ public:
using ColorProviderOptions = JsonObject;
class LANGUAGESERVERPROTOCOL_EXPORT StaticRegistrationOptions : public virtual JsonObject
class LANGUAGESERVERPROTOCOL_EXPORT StaticRegistrationOptions : public JsonObject
{
public:
using JsonObject::JsonObject;
@@ -245,12 +245,27 @@ public:
{ insert(definitionProviderKey, definitionProvider); }
void clearDefinitionProvider() { remove(definitionProviderKey); }
class LANGUAGESERVERPROTOCOL_EXPORT RegistrationOptions
: public TextDocumentRegistrationOptions, public StaticRegistrationOptions
class LANGUAGESERVERPROTOCOL_EXPORT RegistrationOptions : public JsonObject
{
public:
using TextDocumentRegistrationOptions::TextDocumentRegistrationOptions;
bool isValid(QStringList *error) const override;
using JsonObject::JsonObject;
LanguageClientArray<DocumentFilter> documentSelector() const
{ return clientArray<DocumentFilter>(documentSelectorKey); }
void setDocumentSelector(const LanguageClientArray<DocumentFilter> &documentSelector)
{ insert(documentSelectorKey, documentSelector.toJson()); }
bool filterApplies(const Utils::FileName &fileName,
const Utils::MimeType &mimeType = Utils::MimeType()) const;
// The id used to register the request. The id can be used to deregister
// the request again. See also Registration#id.
Utils::optional<QString> id() const { return optionalValue<QString>(idKey); }
void setId(const QString &id) { insert(idKey, id); }
void clearId() { remove(idKey); }
bool isValid(QStringList *error) const override
{ return checkArray<DocumentFilter>(error, documentSelectorKey) && checkOptional<bool>(error, idKey); }
};
// The server provides Goto Type Definition support.