QmlJS: Move the exported-C++-type detection out of C++ code.

It now lives in qmljstools/qmljsfindexportedcpptypes, all in one place.

Also ensures that the source code is available when a file is being
scanned for QML exports. This will enable checking comments for
annotations about the URI a plugin is usually imported as.

Change-Id: I1da36d0678e0a8d34b171dbe0f6b5690d89eb18b
Reviewed-on: http://codereview.qt.nokia.com/3392
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
This commit is contained in:
Christian Kamm
2011-08-23 12:02:29 +02:00
parent c105ae47c1
commit 27d0830698
11 changed files with 616 additions and 450 deletions

View File

@@ -40,6 +40,7 @@
#include <QtCore/QDateTime>
#include <QtCore/QHash>
#include <QtCore/QFileInfo>
#include <QtCore/QAtomicInt>
namespace CPlusPlus {
@@ -125,11 +126,6 @@ public:
void check(CheckMode mode = FullCheck);
void findExposedQmlTypes();
void releaseSource();
void releaseTranslationUnit();
static Ptr create(const QString &fileName);
class DiagnosticMessage
@@ -320,18 +316,8 @@ public:
const MacroUse *findMacroUseAt(unsigned offset) const;
const UndefinedMacroUse *findUndefinedMacroUseAt(unsigned offset) const;
class ExportedQmlType {
public:
QString packageName;
QString typeName;
int majorVersion;
int minorVersion;
Scope *scope;
QString typeExpression;
};
QList<ExportedQmlType> exportedQmlTypes() const
{ return _exportedQmlTypes; }
void keepSourceAndAST();
void releaseSourceAndAST();
private:
QString _fileName;
@@ -344,11 +330,12 @@ private:
QList<Block> _skippedBlocks;
QList<MacroUse> _macroUses;
QList<UndefinedMacroUse> _undefinedMacroUses;
QList<ExportedQmlType> _exportedQmlTypes;
QByteArray _source;
QDateTime _lastModified;
QAtomicInt _keepSourceAndASTCount;
unsigned _revision;
unsigned _editorRevision;
bool _fastCheck;
friend class Snapshot;
};