* This function has been copied from kdev-clang * * SPDX-FileCopyrightText: 2013 Olivier de Gaalon and Milian Wolff * Licensed under the GPL v2+ */
| 38 | * Licensed under the GPL v2+ |
| 39 | */ |
| 40 | ProjectFileItem* findProjectFileItem(const IndexedString& url) |
| 41 | { |
| 42 | ProjectFileItem* file = nullptr; |
| 43 | |
| 44 | const auto& projects = ICore::self()->projectController()->projects(); |
| 45 | for (auto project: projects) { |
| 46 | const auto files = project->filesForPath(url); |
| 47 | if (files.isEmpty()) { |
| 48 | continue; |
| 49 | } |
| 50 | |
| 51 | file = files.last(); |
| 52 | |
| 53 | // A file might be defined in different targets. |
| 54 | // Prefer file items defined inside a target with non-empty includes. |
| 55 | for (auto f: files) { |
| 56 | if (!dynamic_cast<ProjectTargetItem*>(f->parent())) { |
| 57 | continue; |
| 58 | } |
| 59 | file = f; |
| 60 | if (!IDefinesAndIncludesManager::manager()->includes(f, IDefinesAndIncludesManager::ProjectSpecific).isEmpty()) { |
| 61 | break; |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | return file; |
| 66 | } |
| 67 | |
| 68 | QmlJsParseJob::QmlJsParseJob(const IndexedString& url, ILanguageSupport* languageSupport) |
| 69 | : ParseJob(url, languageSupport) |
no test coverage detected