forked from qt-creator/qt-creator
QmlJS: Fix semantic and non-semantic QML error reporting.
The QML snapshot only ever contains valid Documents; to compile a list of parser problems we need to get at the invalid documents. To do that, the model manager now provides a Snapshot with up to date, but potentially invalid documents. That should also be useful for other things. Change-Id: I67892f63771c221bf2fe2c2bf0240a0f4e523227 Reviewed-on: http://codereview.qt.nokia.com/3012 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
This commit is contained in:
@@ -389,9 +389,9 @@ Snapshot::~Snapshot()
|
||||
{
|
||||
}
|
||||
|
||||
void Snapshot::insert(const Document::Ptr &document)
|
||||
void Snapshot::insert(const Document::Ptr &document, bool allowInvalid)
|
||||
{
|
||||
if (document && (document->qmlProgram() || document->jsProgram())) {
|
||||
if (document && (allowInvalid || document->qmlProgram() || document->jsProgram())) {
|
||||
const QString fileName = document->fileName();
|
||||
const QString path = document->path();
|
||||
|
||||
|
@@ -198,7 +198,7 @@ public:
|
||||
const_iterator begin() const { return _documents.begin(); }
|
||||
const_iterator end() const { return _documents.end(); }
|
||||
|
||||
void insert(const Document::Ptr &document);
|
||||
void insert(const Document::Ptr &document, bool allowInvalid = false);
|
||||
void insertLibraryInfo(const QString &path, const LibraryInfo &info);
|
||||
void remove(const QString &fileName);
|
||||
|
||||
|
@@ -119,7 +119,7 @@ public:
|
||||
static ModelManagerInterface *instance();
|
||||
|
||||
virtual WorkingCopy workingCopy() const = 0;
|
||||
virtual QmlJS::Snapshot snapshot() const = 0;
|
||||
virtual QmlJS::Snapshot snapshot(bool preferValid = true) const = 0;
|
||||
|
||||
virtual void updateSourceFiles(const QStringList &files,
|
||||
bool emitDocumentOnDiskChanged) = 0;
|
||||
|
Reference in New Issue
Block a user