Changeset View
Changeset View
Standalone View
Standalone View
pythonparsejob.cpp
Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Line(s) | 72 | ParseJob::ParseJob(const IndexedString &url, ILanguageSupport* languageSupport) | |||
---|---|---|---|---|---|
75 | , m_duContext(nullptr) | 75 | , m_duContext(nullptr) | ||
76 | { | 76 | { | ||
77 | IDefinesAndIncludesManager* iface = IDefinesAndIncludesManager::manager(); | 77 | IDefinesAndIncludesManager* iface = IDefinesAndIncludesManager::manager(); | ||
78 | auto project = ICore::self()->projectController()->findProjectForUrl(url.toUrl()); | 78 | auto project = ICore::self()->projectController()->findProjectForUrl(url.toUrl()); | ||
79 | if ( project ) { | 79 | if ( project ) { | ||
80 | foreach (Path path, iface->includes(project->projectItem(), IDefinesAndIncludesManager::UserDefined)) { | 80 | foreach (Path path, iface->includes(project->projectItem(), IDefinesAndIncludesManager::UserDefined)) { | ||
81 | m_cachedCustomIncludes.append(path.toUrl()); | 81 | m_cachedCustomIncludes.append(path.toUrl()); | ||
82 | } | 82 | } | ||
83 | QMutexLocker lock(&Helper::cacheMutex); | 83 | QMutexLocker lock(&Helper::cacheMutex()); | ||
84 | Helper::cachedCustomIncludes[project] = m_cachedCustomIncludes; | 84 | Helper::cachedCustomIncludes()[project] = m_cachedCustomIncludes; | ||
85 | } | 85 | } | ||
86 | } | 86 | } | ||
87 | 87 | | |||
88 | ParseJob::~ParseJob() | 88 | ParseJob::~ParseJob() | ||
89 | { | 89 | { | ||
90 | } | 90 | } | ||
91 | 91 | | |||
92 | CodeAst *ParseJob::ast() const | 92 | CodeAst *ParseJob::ast() const | ||
93 | { | 93 | { | ||
94 | Q_ASSERT( isFinished() && m_ast ); | 94 | Q_ASSERT( isFinished() && m_ast ); | ||
95 | return m_ast.data(); | 95 | return m_ast.data(); | ||
96 | } | 96 | } | ||
97 | 97 | | |||
98 | 98 | | |||
99 | void ParseJob::run(ThreadWeaver::JobPointer /*self*/, ThreadWeaver::Thread* /*thread*/) | 99 | void ParseJob::run(ThreadWeaver::JobPointer /*self*/, ThreadWeaver::Thread* /*thread*/) | ||
100 | { | 100 | { | ||
101 | if ( abortRequested() || ICore::self()->shuttingDown() ) { | 101 | if ( abortRequested() || ICore::self()->shuttingDown() ) { | ||
102 | return abortJob(); | 102 | return abortJob(); | ||
103 | } | 103 | } | ||
104 | 104 | | |||
105 | qCDebug(KDEV_PYTHON) << " ====> PARSING ====> parsing file " << document().toUrl() << "; has priority" << parsePriority(); | 105 | qCDebug(KDEV_PYTHON) << " ====> PARSING ====> parsing file " << document().toUrl() << "; has priority" << parsePriority(); | ||
106 | 106 | | |||
107 | { | 107 | { | ||
108 | QMutexLocker l(&Helper::projectPathLock); | 108 | QMutexLocker l(&Helper::projectPathLock()); | ||
109 | Helper::projectSearchPaths.clear(); | 109 | Helper::projectSearchPaths().clear(); | ||
110 | foreach (IProject* project, ICore::self()->projectController()->projects() ) { | 110 | foreach (IProject* project, ICore::self()->projectController()->projects() ) { | ||
111 | Helper::projectSearchPaths.append(QUrl::fromLocalFile(project->path().path())); | 111 | Helper::projectSearchPaths().append(QUrl::fromLocalFile(project->path().path())); | ||
112 | } | 112 | } | ||
113 | } | 113 | } | ||
114 | 114 | | |||
115 | // lock the URL so no other parse job can run on this document | 115 | // lock the URL so no other parse job can run on this document | ||
116 | QReadLocker parselock(languageSupport()->parseLock()); | 116 | QReadLocker parselock(languageSupport()->parseLock()); | ||
117 | UrlParseLock urlLock(document()); | 117 | UrlParseLock urlLock(document()); | ||
118 | 118 | | |||
119 | readContents(); | 119 | readContents(); | ||
▲ Show 20 Lines • Show All 178 Lines • Show Last 20 Lines |