Nim: Simplify error message creation for missing compilers

NimToolChains are the only ones with Constants::C_NIMLANGUAGE_ID,
no need to double-check with dynamic cast.

Change-Id: I1542128903261f8cfd2e20533b0589f9ceb7bc50
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2023-07-27 13:29:21 +02:00
parent 80b23292b1
commit 07de94237c

View File

@@ -6,13 +6,13 @@
#include "../nimconstants.h" #include "../nimconstants.h"
#include "../nimtr.h" #include "../nimtr.h"
#include "nimbuildsystem.h" #include "nimbuildsystem.h"
#include "nimtoolchain.h"
#include <coreplugin/icontext.h> #include <coreplugin/icontext.h>
#include <projectexplorer/kitinformation.h> #include <projectexplorer/kitinformation.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectmanager.h> #include <projectexplorer/projectmanager.h>
#include <projectexplorer/toolchain.h>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils; using namespace Utils;
@@ -52,7 +52,7 @@ NimProject::NimProject(const FilePath &filePath) : Project(Constants::C_NIM_MIME
Tasks NimProject::projectIssues(const Kit *k) const Tasks NimProject::projectIssues(const Kit *k) const
{ {
Tasks result = Project::projectIssues(k); Tasks result = Project::projectIssues(k);
auto tc = dynamic_cast<NimToolChain *>(ToolChainKitAspect::toolChain(k, Constants::C_NIMLANGUAGE_ID)); auto tc = ToolChainKitAspect::toolChain(k, Constants::C_NIMLANGUAGE_ID);
if (!tc) { if (!tc) {
result.append(createProjectTask(Task::TaskType::Error, Tr::tr("No Nim compiler set."))); result.append(createProjectTask(Task::TaskType::Error, Tr::tr("No Nim compiler set.")));
return result; return result;