Commit f3a1c3e2 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.rewriter: We use QmlJSCheck now to validate the document

We check the qml file/document now with QmlJSCheck.
We explicitly disable checking of qml types.
parent 0eb18f85
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include <qmljs/qmljslink.h> #include <qmljs/qmljslink.h>
#include <qmljs/qmljsscopebuilder.h> #include <qmljs/qmljsscopebuilder.h>
#include <qmljs/parser/qmljsast_p.h> #include <qmljs/parser/qmljsast_p.h>
#include <qmljs/qmljscheck.h>
#include <QtCore/QSet> #include <QtCore/QSet>
#include <QtGui/QMessageBox> #include <QtGui/QMessageBox>
...@@ -584,12 +585,24 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH ...@@ -584,12 +585,24 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH
setActive(false); setActive(false);
return false; return false;
} }
snapshot.insert(doc); snapshot.insert(doc);
ReadingContext ctxt(snapshot, doc, importPaths); ReadingContext ctxt(snapshot, doc, importPaths);
m_lookupContext = ctxt.lookupContext(); m_lookupContext = ctxt.lookupContext();
m_document = doc; m_document = doc;
QList<RewriterView::Error> errors;
Check check(doc, snapshot, m_lookupContext->context());
check.setIgnoreTypeErrors(true);
foreach (const QmlJS::DiagnosticMessage &diagnosticMessage, check())
if (diagnosticMessage.isError())
errors.append(RewriterView::Error(diagnosticMessage, QUrl::fromLocalFile(doc->fileName())));
if (!errors.isEmpty()) {
m_rewriterView->setErrors(errors);
setActive(false);
return false;
}
setupImports(doc, differenceHandler); setupImports(doc, differenceHandler);
UiObjectMember *astRootNode = 0; UiObjectMember *astRootNode = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment