diff options
author | Christian Kamm <[email protected]> | 2010-09-16 15:29:37 +0200 |
---|---|---|
committer | Christian Kamm <[email protected]> | 2010-09-16 15:51:21 +0200 |
commit | c7b3e3c81c760bce7a15964a1b583b344e0db1b4 (patch) | |
tree | bd2f0d2ed1b3e91c7797d43dba6d336bdda250bc /src/libs/qmljs/qmljscheck.cpp | |
parent | 97c07292aa661754470d71af0774f247275cb9cb (diff) |
QmlJS: Speed up Link significantly, provide more info on imports.
Link now caches imports. That means importing the same library (say, Qt)
from more than one file no longer creates an importing namespace for
each one. Instead, a single one is created for the instance of Link.
To make this work, the type environment in ScopeChain has been given its
own type: Interpreter::TypeEnvironment. That has the added benefit of
being able to carry meta-information about imports. You can use
TypeEnvironment::importInfo(qmlComponentName) to get information about
the import node that caused the import of the component.
Diffstat (limited to 'src/libs/qmljs/qmljscheck.cpp')
-rw-r--r-- | src/libs/qmljs/qmljscheck.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp index 96d8d5e87cb..bcab73dcb8e 100644 --- a/src/libs/qmljs/qmljscheck.cpp +++ b/src/libs/qmljs/qmljscheck.cpp @@ -62,6 +62,20 @@ QColor QmlJS::toQColor(const QString &qmlColorString) return color; } +SourceLocation QmlJS::locationFromRange(const SourceLocation &start, + const SourceLocation &end) +{ + return SourceLocation(start.offset, + end.end() - start.begin(), + start.startLine, + start.startColumn); +} + +DiagnosticMessage QmlJS::errorMessage(const AST::SourceLocation &loc, const QString &message) +{ + return DiagnosticMessage(DiagnosticMessage::Error, loc, message); +} + namespace { class AssignmentCheck : public ValueVisitor @@ -371,12 +385,3 @@ void Check::warning(const AST::SourceLocation &loc, const QString &message) { _messages.append(DiagnosticMessage(DiagnosticMessage::Warning, loc, message)); } - -SourceLocation Check::locationFromRange(const SourceLocation &start, - const SourceLocation &end) -{ - return SourceLocation(start.offset, - end.end() - start.begin(), - start.startLine, - start.startColumn); -} |