QmlJS: Improve performance by avoiding two links in SemanticHighlighter.

Reviewed-by: Roberto Raggi
This commit is contained in:
Christian Kamm
2010-08-31 10:39:07 +02:00
parent 2e8ec2f9e6
commit f3f3b96c85
3 changed files with 6 additions and 8 deletions

View File

@@ -154,10 +154,10 @@ public:
} // end of anonymous namespace
Check::Check(Document::Ptr doc, const Snapshot &snapshot, const QStringList &importPaths)
Check::Check(Document::Ptr doc, const Snapshot &snapshot, const Context *linkedContextNoScope)
: _doc(doc)
, _snapshot(snapshot)
, _link(&_context, doc, snapshot, importPaths)
, _context(*linkedContextNoScope)
, _scopeBuilder(doc, &_context)
, _ignoreTypeErrors(false)
{
@@ -171,7 +171,6 @@ QList<DiagnosticMessage> Check::operator()()
{
_messages.clear();
Node::accept(_doc->ast(), this);
_messages.append(_link.diagnosticMessages());
return _messages;
}

View File

@@ -32,7 +32,6 @@
#include <qmljs/qmljsdocument.h>
#include <qmljs/qmljsinterpreter.h>
#include <qmljs/qmljslink.h>
#include <qmljs/qmljsscopebuilder.h>
#include <qmljs/parser/qmljsastvisitor_p.h>
@@ -46,7 +45,7 @@ class QMLJS_EXPORT Check: protected AST::Visitor
Q_DECLARE_TR_FUNCTIONS(QmlJS::Check)
public:
Check(Document::Ptr doc, const Snapshot &snapshot, const QStringList &importPaths);
Check(Document::Ptr doc, const Snapshot &snapshot, const Interpreter::Context *linkedContextNoScope);
virtual ~Check();
QList<DiagnosticMessage> operator()();
@@ -72,7 +71,6 @@ private:
Snapshot _snapshot;
Interpreter::Context _context;
Link _link;
ScopeBuilder _scopeBuilder;
QList<DiagnosticMessage> _messages;