diff options
author | Alessandro Portale <alessandro.portale@qt.io> | 2018-07-11 07:31:38 +0200 |
---|---|---|
committer | Alessandro Portale <alessandro.portale@qt.io> | 2018-07-11 16:31:35 +0000 |
commit | 3d3f14e3feff558a764704334f33ef33b4e0ee72 (patch) | |
tree | b72ffe63d0121f1b8588a8a8607a2a7dc1484727 /src/plugins/qmljseditor | |
parent | 3c8dec2398ff92d8ad7dcb48f7c40925ecd5daba (diff) |
Prefer using 'override' instead of 'virtual'
warning: prefer using 'override' or (rarely) 'final' instead of
'virtual' [modernize-use-override]
Change-Id: I6dac7a62b627fa1353b4455e1af92f869c2571cc
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
Diffstat (limited to 'src/plugins/qmljseditor')
-rw-r--r-- | src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp | 4 | ||||
-rw-r--r-- | src/plugins/qmljseditor/qmljseditordocument.cpp | 32 | ||||
-rw-r--r-- | src/plugins/qmljseditor/qmljsfindreferences.cpp | 62 | ||||
-rw-r--r-- | src/plugins/qmljseditor/qmljsquickfixes.cpp | 4 | ||||
-rw-r--r-- | src/plugins/qmljseditor/qmljswrapinloader.cpp | 6 |
5 files changed, 54 insertions, 54 deletions
diff --git a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp index 456853633ff..2da26d1bf70 100644 --- a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp +++ b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp @@ -99,8 +99,8 @@ public: init(); } - virtual void performChanges(QmlJSRefactoringFilePtr currentFile, - const QmlJSRefactoringChanges &refactoring) + void performChanges(QmlJSRefactoringFilePtr currentFile, + const QmlJSRefactoringChanges &refactoring) override { QString componentName = m_componentName; diff --git a/src/plugins/qmljseditor/qmljseditordocument.cpp b/src/plugins/qmljseditor/qmljseditordocument.cpp index 9345042c11b..f8662774c0a 100644 --- a/src/plugins/qmljseditor/qmljseditordocument.cpp +++ b/src/plugins/qmljseditor/qmljseditordocument.cpp @@ -108,7 +108,7 @@ protected: using Visitor::visit; using Visitor::endVisit; - virtual bool visit(AST::UiScriptBinding *node) + bool visit(AST::UiScriptBinding *node) override { if (asString(node->qualifiedId) == QLatin1String("id")) { if (AST::ExpressionStatement *stmt = AST::cast<AST::ExpressionStatement*>(node->statement)) { @@ -130,7 +130,7 @@ protected: return false; } - virtual bool visit(AST::IdentifierExpression *node) + bool visit(AST::IdentifierExpression *node) override { if (!node->name.isEmpty()) { const QString &name = node->name.toString(); @@ -205,7 +205,7 @@ protected: decl->endColumn = last.startColumn + last.length; } - virtual bool visit(AST::UiObjectDefinition *node) + bool visit(AST::UiObjectDefinition *node) override { ++_depth; @@ -223,12 +223,12 @@ protected: return true; // search for more bindings } - virtual void endVisit(AST::UiObjectDefinition *) + void endVisit(AST::UiObjectDefinition *) override { --_depth; } - virtual bool visit(AST::UiObjectBinding *node) + bool visit(AST::UiObjectBinding *node) override { ++_depth; @@ -250,12 +250,12 @@ protected: return true; // search for more bindings } - virtual void endVisit(AST::UiObjectBinding *) + void endVisit(AST::UiObjectBinding *) override { --_depth; } - virtual bool visit(AST::UiScriptBinding *) + bool visit(AST::UiScriptBinding *) override { ++_depth; @@ -272,17 +272,17 @@ protected: return false; // more more bindings in this subtree. } - virtual void endVisit(AST::UiScriptBinding *) + void endVisit(AST::UiScriptBinding *) override { --_depth; } - virtual bool visit(AST::FunctionExpression *) + bool visit(AST::FunctionExpression *) override { return false; } - virtual bool visit(AST::FunctionDeclaration *ast) + bool visit(AST::FunctionDeclaration *ast) override { if (ast->name.isEmpty()) return false; @@ -309,7 +309,7 @@ protected: return false; } - virtual bool visit(AST::VariableDeclaration *ast) + bool visit(AST::VariableDeclaration *ast) override { if (ast->name.isEmpty()) return false; @@ -376,27 +376,27 @@ public: protected: using AST::Visitor::visit; - virtual bool visit(AST::UiObjectBinding *ast) + bool visit(AST::UiObjectBinding *ast) override { if (ast->initializer && ast->initializer->lbraceToken.length) _ranges.append(createRange(ast, ast->initializer)); return true; } - virtual bool visit(AST::UiObjectDefinition *ast) + bool visit(AST::UiObjectDefinition *ast) override { if (ast->initializer && ast->initializer->lbraceToken.length) _ranges.append(createRange(ast, ast->initializer)); return true; } - virtual bool visit(AST::FunctionExpression *ast) + bool visit(AST::FunctionExpression *ast) override { _ranges.append(createRange(ast)); return true; } - virtual bool visit(AST::FunctionDeclaration *ast) + bool visit(AST::FunctionDeclaration *ast) override { _ranges.append(createRange(ast)); return true; @@ -412,7 +412,7 @@ protected: return true; } - virtual bool visit(AST::UiScriptBinding *ast) + bool visit(AST::UiScriptBinding *ast) override { if (AST::Block *block = AST::cast<AST::Block *>(ast->statement)) _ranges.append(createRange(ast, block)); diff --git a/src/plugins/qmljseditor/qmljsfindreferences.cpp b/src/plugins/qmljseditor/qmljsfindreferences.cpp index af2750de0ce..6c8d2f4f982 100644 --- a/src/plugins/qmljseditor/qmljsfindreferences.cpp +++ b/src/plugins/qmljseditor/qmljsfindreferences.cpp @@ -95,7 +95,7 @@ protected: using Visitor::visit; - virtual bool visit(AST::UiPublicMember *node) + bool visit(AST::UiPublicMember *node) override { if (node->name == _name && _scopeChain.qmlScopeObjects().contains(_scope)) { @@ -110,7 +110,7 @@ protected: return true; } - virtual bool visit(AST::UiObjectDefinition *node) + bool visit(AST::UiObjectDefinition *node) override { _builder.push(node); Node::accept(node->initializer, this); @@ -118,7 +118,7 @@ protected: return false; } - virtual bool visit(AST::UiObjectBinding *node) + bool visit(AST::UiObjectBinding *node) override { if (node->qualifiedId && !node->qualifiedId->next @@ -133,7 +133,7 @@ protected: return false; } - virtual bool visit(AST::UiScriptBinding *node) + bool visit(AST::UiScriptBinding *node) override { if (node->qualifiedId && !node->qualifiedId->next @@ -151,7 +151,7 @@ protected: return true; } - virtual bool visit(AST::UiArrayBinding *node) + bool visit(AST::UiArrayBinding *node) override { if (node->qualifiedId && !node->qualifiedId->next @@ -162,7 +162,7 @@ protected: return true; } - virtual bool visit(AST::IdentifierExpression *node) + bool visit(AST::IdentifierExpression *node) override { if (node->name.isEmpty() || node->name != _name) return false; @@ -193,7 +193,7 @@ protected: return false; } - virtual bool visit(AST::FieldMemberExpression *node) + bool visit(AST::FieldMemberExpression *node) override { if (node->name != _name) return true; @@ -209,12 +209,12 @@ protected: return true; } - virtual bool visit(AST::FunctionDeclaration *node) + bool visit(AST::FunctionDeclaration *node) override { return visit(static_cast<FunctionExpression *>(node)); } - virtual bool visit(AST::FunctionExpression *node) + bool visit(AST::FunctionExpression *node) override { if (node->name == _name) { if (checkLookup()) @@ -227,7 +227,7 @@ protected: return false; } - virtual bool visit(AST::VariableDeclaration *node) + bool visit(AST::VariableDeclaration *node) override { if (node->name == _name) { if (checkLookup()) @@ -320,7 +320,7 @@ protected: using Visitor::visit; - virtual bool visit(AST::UiPublicMember *node) + bool visit(AST::UiPublicMember *node) override { if (node->memberTypeName() == _name){ const ObjectValue * tVal = _context->lookupType(_doc.data(), QStringList(_name)); @@ -336,7 +336,7 @@ protected: return true; } - virtual bool visit(AST::UiObjectDefinition *node) + bool visit(AST::UiObjectDefinition *node) override { checkTypeName(node->qualifiedTypeNameId); _builder.push(node); @@ -345,7 +345,7 @@ protected: return false; } - virtual bool visit(AST::UiObjectBinding *node) + bool visit(AST::UiObjectBinding *node) override { checkTypeName(node->qualifiedTypeNameId); _builder.push(node); @@ -354,7 +354,7 @@ protected: return false; } - virtual bool visit(AST::UiScriptBinding *node) + bool visit(AST::UiScriptBinding *node) override { if (AST::cast<Block *>(node->statement)) { Node::accept(node->qualifiedId, this); @@ -366,7 +366,7 @@ protected: return true; } - virtual bool visit(AST::IdentifierExpression *node) + bool visit(AST::IdentifierExpression *node) override { if (node->name != _name) return false; @@ -378,7 +378,7 @@ protected: return false; } - virtual bool visit(AST::FieldMemberExpression *node) + bool visit(AST::FieldMemberExpression *node) override { if (node->name != _name) return true; @@ -392,12 +392,12 @@ protected: return true; } - virtual bool visit(AST::FunctionDeclaration *node) + bool visit(AST::FunctionDeclaration *node) override { return visit(static_cast<FunctionExpression *>(node)); } - virtual bool visit(AST::FunctionExpression *node) + bool visit(AST::FunctionExpression *node) override { Node::accept(node->formals, this); _builder.push(node); @@ -406,13 +406,13 @@ protected: return false; } - virtual bool visit(AST::VariableDeclaration *node) + bool visit(AST::VariableDeclaration *node) override { Node::accept(node->expression, this); return false; } - virtual bool visit(UiImport *ast) + bool visit(UiImport *ast) override { if (ast && ast->importId == _name) { const Imports *imp = _context->imports(_doc.data()); @@ -499,7 +499,7 @@ protected: using Visitor::visit; - virtual bool preVisit(Node *node) + bool preVisit(Node *node) override { if (Statement *stmt = node->statementCast()) return containsOffset(stmt->firstSourceLocation(), stmt->lastSourceLocation()); @@ -510,7 +510,7 @@ protected: return true; } - virtual bool visit(IdentifierExpression *node) + bool visit(IdentifierExpression *node) override { if (containsOffset(node->identifierToken)) { _name = node->name.toString(); @@ -524,7 +524,7 @@ protected: return true; } - virtual bool visit(FieldMemberExpression *node) + bool visit(FieldMemberExpression *node) override { if (containsOffset(node->identifierToken)) { setScope(node->base); @@ -547,17 +547,17 @@ protected: return true; } - virtual bool visit(UiScriptBinding *node) + bool visit(UiScriptBinding *node) override { return !checkBindingName(node->qualifiedId); } - virtual bool visit(UiArrayBinding *node) + bool visit(UiArrayBinding *node) override { return !checkBindingName(node->qualifiedId); } - virtual bool visit(UiObjectBinding *node) + bool visit(UiObjectBinding *node) override { if ((!checkTypeName(node->qualifiedTypeNameId)) && (!checkBindingName(node->qualifiedId))) { @@ -569,7 +569,7 @@ protected: return false; } - virtual bool visit(UiObjectDefinition *node) + bool visit(UiObjectDefinition *node) override { if (!checkTypeName(node->qualifiedTypeNameId)) { Node *oldObjectNode = _objectNode; @@ -580,7 +580,7 @@ protected: return false; } - virtual bool visit(UiPublicMember *node) + bool visit(UiPublicMember *node) override { if (containsOffset(node->typeToken)){ if (node->isValid()) { @@ -598,12 +598,12 @@ protected: return true; } - virtual bool visit(FunctionDeclaration *node) + bool visit(FunctionDeclaration *node) override { return visit(static_cast<FunctionExpression *>(node)); } - virtual bool visit(FunctionExpression *node) + bool visit(FunctionExpression *node) override { if (containsOffset(node->identifierToken)) { _name = node->name.toString(); @@ -612,7 +612,7 @@ protected: return true; } - virtual bool visit(VariableDeclaration *node) + bool visit(VariableDeclaration *node) override { if (containsOffset(node->identifierToken)) { _name = node->name.toString(); diff --git a/src/plugins/qmljseditor/qmljsquickfixes.cpp b/src/plugins/qmljseditor/qmljsquickfixes.cpp index 49a15a3e685..e1afb052751 100644 --- a/src/plugins/qmljseditor/qmljsquickfixes.cpp +++ b/src/plugins/qmljseditor/qmljsquickfixes.cpp @@ -138,8 +138,8 @@ public: setDescription(tr("Add a Comment to Suppress This Message")); } - virtual void performChanges(QmlJSRefactoringFilePtr currentFile, - const QmlJSRefactoringChanges &) + void performChanges(QmlJSRefactoringFilePtr currentFile, + const QmlJSRefactoringChanges &) override { Utils::ChangeSet changes; const int insertLoc = _message.location.begin() - _message.location.startColumn + 1; diff --git a/src/plugins/qmljseditor/qmljswrapinloader.cpp b/src/plugins/qmljseditor/qmljswrapinloader.cpp index fca146e3d73..509a1daf9de 100644 --- a/src/plugins/qmljseditor/qmljswrapinloader.cpp +++ b/src/plugins/qmljseditor/qmljswrapinloader.cpp @@ -62,7 +62,7 @@ public: } protected: - virtual bool visit(UiObjectInitializer *ast) + bool visit(UiObjectInitializer *ast) override { UiScriptBinding *idBinding; QString id = idOfObject(ast, &idBinding); @@ -107,8 +107,8 @@ public: return tryName; } - virtual void performChanges(QmlJSRefactoringFilePtr currentFile, - const QmlJSRefactoringChanges &) + void performChanges(QmlJSRefactoringFilePtr currentFile, + const QmlJSRefactoringChanges &) override { UiScriptBinding *idBinding; const QString id = idOfObject(m_objDef, &idBinding); |