| 86 | } |
| 87 | |
| 88 | void QmlJsParseJob::run(ThreadWeaver::JobPointer pointer, ThreadWeaver::Thread* thread) |
| 89 | { |
| 90 | Q_UNUSED(pointer) |
| 91 | Q_UNUSED(thread) |
| 92 | |
| 93 | UrlParseLock urlLock(document()); |
| 94 | if (abortRequested() || !isUpdateRequired(ParseSession::languageString())) { |
| 95 | return; |
| 96 | } |
| 97 | |
| 98 | // Don't parse this file if one of its dependencies is not up to date |
| 99 | const auto& dependencies = QmlJS::Cache::instance().dependencies(document()); |
| 100 | for (auto& dependency : dependencies) { |
| 101 | if (!QmlJS::Cache::instance().isUpToDate(dependency)) { |
| 102 | QmlJS::Cache::instance().setUpToDate(document(), false); |
| 103 | return; |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | qCDebug(KDEV_QMLJS) << "parsing" << document().str(); |
| 108 | |
| 109 | ProblemPointer p = readContents(); |
| 110 | if (p) { |
| 111 | //TODO: associate problem with topducontext |
| 112 | return; |
| 113 | } |
| 114 | |
| 115 | ParseSession session(document(), QString::fromUtf8(contents().contents), priority()); |
| 116 | |
| 117 | if (abortRequested()) { |
| 118 | return; |
| 119 | } |
| 120 | |
| 121 | ReferencedTopDUContext context; |
| 122 | { |
| 123 | DUChainReadLocker lock; |
| 124 | context = DUChainUtils::standardContextForUrl(document().toUrl()); |
| 125 | } |
| 126 | if (context) { |
| 127 | translateDUChainToRevision(context); |
| 128 | context->setRange(RangeInRevision(0, 0, INT_MAX, INT_MAX)); |
| 129 | } |
| 130 | |
| 131 | if (session.ast()) { |
| 132 | QReadLocker parseLock(languageSupport()->parseLock()); |
| 133 | |
| 134 | if (abortRequested()) { |
| 135 | abortJob(); |
| 136 | return; |
| 137 | } |
| 138 | |
| 139 | DeclarationBuilder builder(&session); |
| 140 | context = builder.build(document(), session.ast(), context); |
| 141 | |
| 142 | if (abortRequested()) { |
| 143 | abortJob(); |
| 144 | return; |
| 145 | } |
nothing calls this directly
no test coverage detected